[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] emacs-25 d7084f2: Fix todo-mode use of minibuffer comp

From: Stephen Berman
Subject: Re: [Emacs-diffs] emacs-25 d7084f2: Fix todo-mode use of minibuffer completion keymap (bug#23695).
Date: Wed, 15 Jun 2016 11:42:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

On Tue, 14 Jun 2016 22:12:01 -0400 Stefan Monnier <address@hidden> wrote:

>> -  (let ((map minibuffer-local-completion-map))
>> -    (define-key map " " nil)
>> +  (let ((minibuffer-local-completion-map
>> +         (copy-keymap minibuffer-local-completion-map)))
>> +    (define-key minibuffer-local-completion-map " " 'self-insert-command)
> Why bind it to `self-insert-command` rather than to nil?

When I found the todo-mode bug I grepped the lisp/ tree for
minibuffer-local-completion-map and saw that in all packages that want
SPC to insert " " in the minibuffer it's bound to self-insert-command,
so I concluded that was best practice and changed it accordingly.  The
reasoning seems to be that if someone rebinds SPC in the global map, it
still should be used to insert " " in these cases.  But I suppose that
whoever does rebind SPC in the global map still must have some binding
for inserting " ", so maybe packages should respect that rebinding and
just use nil; is that what you suggest?  (Oh, now I see that in
minibuffer-local-filename-completion-map you did bind it to nil, so I
guess that answers the question.)  Is that a general recommendation,
e.g. to make the `?' key insert `?' in the minibuffer also bind it to

> PS: You can avoid copying with something like
>   (let ((minibuffer-local-completion-map
>          (let ((map (make-sparse-keymap)))
>            (set-parent-keymap map minibuffer-local-completion-map)
>            (define-key minibuffer-local-completion-map
>                        " " 'self-insert-command))))

It seems that currently slightly more packages use copy-keymap
(calc-store, mh-alias, mh-seq, org, supercite, viper-ex) than
set-keymap-parent (cc-styles, mm-decode, crm, minibuffer) to override
minibuffer-local-completion-map bindings (though for all uses in in
lisp/ I count 83 occurrences of "(copy-keymap" and 165 of
"(set-keymap-parent").  Are you saying it is generally better to use the
latter?  If so, when is it better to use the former?

Steve Berman

reply via email to

[Prev in Thread] Current Thread [Next in Thread]