unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <87h9cuyeip.fsf@gmx.net> (raw)
In-Reply-To: <jwvbn33td6l.fsf-monnier+emacsdiffs@gnu.org> (Stefan Monnier's message of "Tue, 14 Jun 2016 22:12:01 -0400")

On Tue, 14 Jun 2016 22:12:01 -0400 Stefan Monnier <monnier@IRO.UMontreal.CA> 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
nil?

> 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	other threads:[~2016-06-15  9:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20160614214332.2901.16184@vcs.savannah.gnu.org>
     [not found] ` <20160614214332.C030F220116@vcs.savannah.gnu.org>
2016-06-15  2:12   ` [Emacs-diffs] emacs-25 d7084f2: Fix todo-mode use of minibuffer completion keymap (bug#23695) Stefan Monnier
2016-06-15  9:42     ` Stephen Berman [this message]
2016-06-15 13:16       ` Stefan Monnier
2016-06-15 15:09         ` Stephen Berman
2016-06-15 15:19           ` Eli Zaretskii
2016-06-15 17:31             ` John Wiegley
2016-06-15 18:10               ` Stephen Berman
2016-06-16  3:04                 ` Noam Postavsky
2016-06-16  9:11                   ` Stephen Berman
2016-06-15 15:23           ` Generalizing make-composed-keymap (was: [Emacs-diffs] emacs-25 d7084f2: Fix todo-mode use of minibuffer completion keymap (bug#23695).) Stefan Monnier
2016-06-15 15:34             ` Generalizing make-composed-keymap Clément Pit--Claudel
2016-06-15 15:41               ` Stefan Monnier
2016-06-15 15:37           ` [Emacs-diffs] emacs-25 d7084f2: Fix todo-mode use of minibuffer completion keymap (bug#23695) Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h9cuyeip.fsf@gmx.net \
    --to=stephen.berman@gmx.net \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).