2010-08-16 23 views
0

继续升级迁移我的最新&的过程时不再起作用最大的Emacs 23.2,我打另一个令人不快的意外:动态扩展在小缓冲区不再起作用!小缓冲区中的动态扩展,从Emacs的21.2

通过我的意思是让你一味地打空格键来完成文件名,变量功能“在迷你动态扩展”等

我还援引“Emacs的-Q”(以排除任何的.emacs工件),并且问题不仅存在于Windows XP上的Emacs 23.2,甚至在Ubuntu上也存在Emacs 22.1。

Emacs的默认行为发生了变化,但它是什么?

回答

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) 
+0

确实解决了这个问题。谢谢Scott。不幸的是,“minibuffer-local-must-match-filename-map”在Emacs 21.2中产生一个错误,我仍然在其他一些机器上运行。任何方式使旧版本的Emacs忽略它? – 2010-08-16 19:19:01

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) 
) 

如果你拿出一个更优雅的解决方案,那将是巨大的,但上述作品适合我(现在)。

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版本正常工作。