2010-08-16 68 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版本正常工作。