继续我的移动最新和最新的过程最大的Emacs 23.2,我又遇到了另一个令人不快的惊喜:
“迷你缓冲区中的动态扩展”是指让您盲目点击空格键以完成文件名,变量等的功能。
我还调用了'Emacs -Q'(以排除任何.emacs工件),这个问题不仅存在于Windows XP上的Emacs 23.2上,而且甚至存在于Ubuntu上的Emacs 22.1上。
Emacs的默认行为发生了变化,但它是什么?
答案 0 :(得分:2)
来自(22.1)NEWS文件:
** When Emacs prompts for file names, SPC no longer completes the file name. This is so filenames with embedded spaces could be input without the need to quote the space with a C-q. The underlying changes in the keymaps that are active in the minibuffer are described below under "New keymaps for typing file names". If you want the old behavior back, add these two key bindings to your ~/.emacs init file: (define-key minibuffer-local-filename-completion-map " " 'minibuffer-complete-word) (define-key minibuffer-local-must-match-filename-map " " 'minibuffer-complete-word)
答案 1 :(得分:1)
发布的解决方案有效,但一旦我们到达Emacs v24及更高版本,它就会中断。我建议改为将define-key
电话绑定到新地图的存在,如下所示:
(if (boundp 'minibuffer-local-filename-completion-map)
(define-key minibuffer-local-filename-completion-map " " 'minibuffer-complete-word))
(if (boundp 'minibuffer-local-must-match-filename-map)
(define-key minibuffer-local-must-match-filename-map " " 'minibuffer-complete-word))
这应适用于所有Emacs版本。
答案 2 :(得分:0)
回答我的第二个问题(在评论中):
(defmacro GNUEmacs23 (&rest body)
(list 'if (string-match "GNU Emacs 23" (version))
(cons 'progn body)))
(defmacro GNUEmacs22 (&rest body)
(list 'if (string-match "GNU Emacs 22" (version))
(cons 'progn body)))
(GNUEmacs22
(define-key minibuffer-local-filename-completion-map " " 'minibuffer-complete-word)
(define-key minibuffer-local-must-match-filename-map " " 'minibuffer-complete-word)
)
(GNUEmacs23
(define-key minibuffer-local-filename-completion-map " " 'minibuffer-complete-word)
(define-key minibuffer-local-must-match-filename-map " " 'minibuffer-complete-word)
)
如果你想出一个更优雅的解决方案,那就太好了,但上面的工作对我来说(现在)。