読者です 読者をやめる 読者になる 読者になる

by shigemk2

当面は技術的なことしか書かない

interactive改

Emacs Lisp
(defun interactive-form-test (str compl num filename buffer y-or-n)
  (interactive
   ;; リストの要素はそれぞれの引数に代入し、メッセージを出力する
   ;; リストを返すフォームを指定する
   (list (read-string "str: ")
	 (completing-read "compl: " '("foo" "bar" "baz") nil t)
	 (read-number "num: ")
	 (read-file-name "filename: ")
	 (read-buffer "buffer: " nil t)
	 (y-or-n-p "y-or-n" )))
  (message "str: %s\ncompl: %s\nnum: %s\nfilename: %s\nbuffer:
  %s\ny-or-n: %s"
	   str compl num filename buffer y-or-n))

(defun interactive-exercise (buffer filename number string)
  (interactive "Bbuffer: \nFfilename: \nnnumber: \nsstring: ")
  (message "%S" (list buffer filename number string)))

(defun interactive-exercise2 (buffer filename number string)
  (interactive
   (list (read-buffer "buffer: " nil t)
	 (read-file-name "filename: ")
	 (read-number "number: ")
	 (read-string "string: ")))
  (message "%S" (list buffer filename number string)))

P118

Emacs Lispテクニックバイブル

Emacs Lispテクニックバイブル