这是来自我的 .emacs 文件中加载的 .el 文件。你怎么认为?
;;; Sun keyboard bindings
;; the below line does not work:
;; when <cancel> is pressed, the minibuffer echoes "Quit"
;; but that is the only thing it does
;; (global-set-key [cancel] 'keyboard-quit)
;; Note: I got the 'keyboard-quit from C-h c and then C-g
;; (C-g is the normal way for me to abort)
;; Those work, so it has probably something to do
;; with the peculiarities of 'keyboard-quit, rather than
;; the actual keybinding (or?)
(global-set-key [SunProps] 'describe-variable)
(global-set-key [SunFront] 'next-buffer)
(global-set-key [SunOpen] 'list-buffers)
(global-set-key [XF86Copy] 'clipboard-kill-ring-save)
(global-set-key [XF86Paste] 'x-clipboard-yank)
(global-set-key [XF86Cut] 'clipboard-kill-region)
答案1
由于Control+G必须在执行其他操作(而不是读取正常输入)时中断 Emacs,因此它被硬编码到 Emacs 核心中,并且无法使用正常方法进行反弹。有一个set-quit-char
函数,但它只适用于 ASCII 字符。
(set-quit-char QUIT)
Specify character used for quitting.
QUIT must be an ASCII character.
This function only has an effect on the controlling tty of the Emacs
process.
简而言之,您必须修补并重新编译 Emacs 才能完成您想要的操作。
然而,有可能得到一些你想要什么。如果你这样做
(define-key local-function-key-map [cancel] [7]) ; 7 is C-g
thencancel
应该像 一样工作C-g
,但仅当 Emacs 读取正常输入时才有效。它不会像那样中断长时间运行的 Elisp 函数C-g
。但它会取消C-x C-f
从迷你缓冲区读取输入的命令或类似命令。