Next: Command Modes, Previous: Interactive Codes, Up: Defining Commands [Contents][Index]
interactive
の使用例以下にinteractive
の例をいくつか示します:
(defun foo1 () ; foo1
は1つの引数をとり
(interactive) ; 単に2単語分前に移動する
(forward-word 2))
⇒ foo1
(defun foo2 (n) ;foo2
は引数を1つとる (interactive "^p") ; 引数は数引数 ;shift-select-mode
では、 ; リージョンをアクティブにするか、拡張する (forward-word (* 2 n))) ⇒ foo2
(defun foo3 (n) ; foo3
は引数を1つとる
(interactive "nCount:") ; 引数はミニバッファーで読み取られる
(forward-word (* 2 n)))
⇒ foo3
(defun three-b (b1 b2 b3) "Select three existing buffers. Put them into three windows, selecting the last one."
(interactive "bBuffer1:\nbBuffer2:\nbBuffer3:") (delete-other-windows) (split-window (selected-window) 8) (switch-to-buffer b1) (other-window 1) (split-window (selected-window) 8) (switch-to-buffer b2) (other-window 1) (switch-to-buffer b3)) ⇒ three-b
(three-b "*scratch*" "declarations.texi" "*mail*") ⇒ nil