views:

27

answers:

2

Continuing my process of migrating the latest & greatest Emacs 23.2, I hit another unpleasant surprise: dynamic expansion in minibuffer no longer works!

By "dynamic expansion in the minibuffer" I mean the feature that lets you blindly hit the spacebar to complete filenames, variables, etc.

I also invoked 'Emacs -Q' (to rule out any .emacs artifacts) and the problem exists not only with Emacs 23.2 on Windows XP, but even with Emacs 22.1 on Ubuntu.

Something has changed in Emacs' default behavior, but what is it?

+2  A: 

From the (22.1) NEWS file:

** 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)
scottfrazer
That indeed solved the problem. Thank you Scott. Unfortunately however "minibuffer-local-must-match-filename-map" generates an error in Emacs 21.2 which I still run on a few other machines. Any way to make older versions of Emacs ignore it?
Android Eve
A: 

Answering my 2nd question (in the comment):

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

If you come up with a more elegant solution, that would be great, but the above works for me (for now).

Android Eve