【发布时间】:2009-02-17 15:15:03
【问题描述】:
编辑: 我知道有键盘退出(通常绑定到 C-g);但我更想知道如何处理 Emacs 附带的编辑功能(如本例中)。当我想改变一些内置函数时,我有时会遇到这种情况。
在 emacs 中,当你按 M-ESC ESC(或 ESC 三次)时,你可以摆脱很多情况,如瞬态标记等。但我习惯性地按了转义键(我实际上将它重新映射为一次按一下转义键)超出了我的预期,这最终会杀死我的 Windows 配置,这很烦人。函数keyboard-escape-quit在simple.el中定义:
(defun keyboard-escape-quit ()
"Exit the current \"mode\" (in a generalized sense of the word).
This command can exit an interactive command such as `query-replace',
can clear out a prefix argument or a region,
can get out of the minibuffer or other recursive edit,
cancel the use of the current buffer (for special-purpose buffers),
or go back to just one window (by deleting all but the selected window)."
(interactive)
(cond ((eq last-command 'mode-exited) nil)
((> (minibuffer-depth) 0)
(abort-recursive-edit))
(current-prefix-arg
nil)
((and transient-mark-mode mark-active)
(deactivate-mark))
((> (recursion-depth) 0)
(exit-recursive-edit))
(buffer-quit-function
(funcall buffer-quit-function))
((not (one-window-p t))
(delete-other-windows))
((string-match "^ \\*" (buffer-name (current-buffer)))
(bury-buffer))))
我可以看到我不想要这些线条:
((not (one-window-p t))
(delete-other-windows))
但是修改此功能的最佳方法是什么?我只能看到两种方法:1)修改 simple.el 2)将此函数复制到我的 .emacs 文件并在那里进行修改。这两种方式都不是真的好;理想情况下,我希望在 defadvice 上看到一些东西,但在这种情况下我不知道该怎么做。
【问题讨论】: