[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

[MD:1832]call-last-kbd-macro



堀口です. エラーでました^^

At 17 Jul 2000 18:46:23 +0900, Keiichi Suzuki <keiichi@xxxxxxxxx> wrote in <uzonhozrk.fsf@xxxxxxxxxxxxx>
> (defadvice forward-word (after skip-comma activate)
...
> ですので、 noninteractive で呼ばれれば、エラーになるのは当然ですね。
> ということで、 20.6 も 20.7 でも変わりは無いようです。
> 
> ;; やっぱり defadvice の使い方が悪いような気がしてきました。 ^^;;;

 でもなんかちょっと変な感じです. これはエラーが出たときのバック
トレースです.

| Signaling: (wrong-type-argument integerp nil)
|   ad-Orig-forward-word(nil)
|   forward-word(nil)
|   call-interactively(forward-word)
    ~~~~~~~~~~~~~~~~~~
|   call-last-kbd-macro(1)
|   call-interactively(call-last-kbd-macro)

C-x : (forward-word) は エラー.
C-x : (call-interactively 'forward-word) は skip-comma 付きで通ります.

 とおもったらありました.

| defadvice is a Lisp macro in `advice'.
| (defadvice FUNCTION ARGS &rest BODY)
...
|   (defadvice FUNCTION (CLASS NAME [POSITION] [ARGLIST] FLAG...)
|     [DOCSTRING] [INTERACTIVE-FORM]
|     BODY... )   ~~~~~~~~~~~~~~~~~~
... 
| INTERACTIVE-FORM ::= Optional interactive form to be used for the advised
|     function.  The first one found in before/around/after-advices will be used.

これが正解のようです.

(defadvice forward-word (after skip-comma activate )
  (interactive "p")
  (when (and (interactive-p)
	     (eq major-mode 'c-mode)
	     (eq (char-after) ?,))
    (forward-char)))


-- 
堀口恭太郎