From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.devel 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 Message-ID: <87h9cuyeip.fsf@gmx.net> References: <20160614214332.2901.16184@vcs.savannah.gnu.org> <20160614214332.C030F220116@vcs.savannah.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1465983772 23984 80.91.229.3 (15 Jun 2016 09:42:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 Jun 2016 09:42:52 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 15 11:42:43 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bD7LO-0005HX-U3 for ged-emacs-devel@m.gmane.org; Wed, 15 Jun 2016 11:42:43 +0200 Original-Received: from localhost ([::1]:41039 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bD7LO-0001Us-0Z for ged-emacs-devel@m.gmane.org; Wed, 15 Jun 2016 05:42:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bD7LF-0001JI-DH for emacs-devel@gnu.org; Wed, 15 Jun 2016 05:42:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bD7LA-0000VJ-ET for emacs-devel@gnu.org; Wed, 15 Jun 2016 05:42:33 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:51751) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bD7LA-0000VC-4D for emacs-devel@gnu.org; Wed, 15 Jun 2016 05:42:28 -0400 Original-Received: from rosalinde ([89.245.94.221]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0LaXIV-1bhChz3Flf-00mMZi; Wed, 15 Jun 2016 11:42:24 +0200 In-Reply-To: (Stefan Monnier's message of "Tue, 14 Jun 2016 22:12:01 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-Provags-ID: V03:K0:r4fI9RezxLCrvbiN18gvMRlsZmIxkYcEU2LSe9KDBkhWbDziZRe lH/GuVM893wb7xN/dPpZur76gGwixTpgsb9adLTsOu8hlPxoZghJBWjgLUPoflW58XrKmGS Dc0gvgGKTpoocRQ9rEgXumfx0TJrbUD2Ey/rGpILbJ1xTTgf7Ake2Z2xQTiET9u8SBAjZ7U HkOBxp9uxlyfPsFICfibA== X-UI-Out-Filterresults: notjunk:1;V01:K0:AkrgpRGcCiU=:eTLiPi91bHRu9uV3LPZBd4 JnVkRdnFaKti/d+qbjvvoTFUB4LXDOGht487g92j7O1N1Za3jJyXQfRPbbUtClV+RGPNYmJ7D e4XMuAFQuZF7syYSC+tmyB0BWOMw/MIKVlYdBreE7tmKUI+7Uj+piY3pdg7r+cqOU8etaRubF LQ5Twg34YBQXlS1KrxYpv3QjPoEv/G46nA42xzl7X4duKC2VbvH7TwzTM/xMwAruAGUtirk8p lkjqiIWYc3Ls61nR1TEdq3TqiAm6sLGDcdKyw1blUqDNZpvlgJdTUGadSPmb+mHJ6dzI3xyGx 2NtWqiJsC+F7x6iSRj/7y7T3j+285+HtvJOPTGxADhlNPsv1ufhLxa25SyxWLcvdB+eTSQ5Tp RoTsrEIesmzBlIfoYENDL7Yi08hrsGRYltjhgYGk+0pdyCoMv4iLn3qA6P5XEagUfJNUrt8gS bgY7WXJRbd4HuF2VDEs9l24f5Dlq2QjMaYNe7XNzFVzqBf7lJChXTjWFU/wZroJk+2MOhV8s2 b5kZsBL8FUWGmPDFy7lKcDDfLaORKM4/WAkvYcGFh+aw/BLRPN01HxWmT4ziWi+YP8eK/BBZQ 2WxgmSeKSfee3YL7TU90lr1meV6v8m+Okr+K2/E+uR6KJduqhYgruZEyPC8fyuMn6AYDKJoHN kAQwi2xYrB5cKlI8CKQzSeFP/o2OCMW/7+1IZx1W6NglMweSp+TLLy1OWxjJtWrDaUEzPZKQ5 Q1zvg41eBsS0Mrccz/8ip9vMmPVNdMp/c3vLTrEFDY5AXyyDMhV+TWpWk6W0K23n0Ycq2w/2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.18 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:204378 Archived-At: On Tue, 14 Jun 2016 22:12:01 -0400 Stefan Monnier 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