Emacs Part 40
■ このスレッドは過去ログ倉庫に格納されています
0857名無しさん@お腹いっぱい。
2012/08/12(日) 01:51:38.66ido.elでのido-write-fileのように別に関数を作ってremapする、というのはどうでしょうか。
(defun my-write-file (filename &optional confirm)
(interactive
(list (if buffer-file-name
(read-file-name "Write file: "
nil nil nil nil)
(read-file-name "Write file: " (concat default-directory "scratch-" (format-time-string "%Y%m%d" (current-time)) ".el")
nil
nil nil))
(not current-prefix-arg)))
(write-file filename confirm))
(let ((map (make-sparse-keymap)))
(define-key map [remap write-file] 'my-write-file))
なお、write-fileにdefadviceしたらどうかと思い、以下のようにやってみたのですが
これはうまく動きませんでした。
(defadvice write-file
(around write-file-aaa first (filename &optional confirm) activate)
(let ((default-directory (concat default-directory "scratch-" (format-time-string "%Y%m%d" (current-time)) ".el")))
ad-do-it))
■ このスレッドは過去ログ倉庫に格納されています