emacsでキーを設定して、バッファ内のファイルに対してシェルコマンドを実行し、プロンプトを表示せずにバッファを元に戻したいとします。シェルコマンドは次のとおりです。p4 edit 'currentfilename.ext'
elisp:現在のファイルのコマンドを呼び出す
(global-set-key [\C-E] (funcall 'revert-buffer 1 1 1))
;; my attempt above to call revert-buffer with a non-nil
;; argument (ignoring the shell command for now) -- get an init error:
;; Error in init file: error: "Buffer does not seem to be associated with any file"
完全に新しいelispです。 emacs manualから、ここで差し戻しバッファの定義は次のとおりです。
Command: revert-buffer &optional ignore-auto noconfirm preserve-modes
ありがとう!
バッファがすでに編集されているため、またはシェルコマンドがバッファの内容を壊すため、バッファを元に戻しますか? – zwol
バッファは読み取り専用ではなく書き込みに変更され、バージョンコントロールに追加されるためです。 – ash