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