(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"
(global-set-key (kbd "C-S-e") '(lambda () (revert-buffer t t t)))
您 funcall 实际上在 .emacs 加载时进行了评估,这就是导致错误的原因。
然后,为了获得整个内容,您可以创建一个如下命令:
(defun call-something-on-current-buffers-file ()
"run a command on the current file and revert the buffer"
(interactive)
(shell-command
(format "/home/tjackson/bin/dummy.sh %s"
(shell-quote-argument (buffer-file-name))))
(revert-buffer t t t))
(global-set-key (kbd "C-S-e") 'call-something-on-current-buffers-file)