GNU bug report logs - #47699
[PATCH] Improve completion-list-mode-map

Previous Next

Package: emacs;

Reported by: Gregory Heytings <gregory <at> heytings.org>

Date: Sun, 11 Apr 2021 01:05:01 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 47699 in the body.
You can then email your comments to 47699 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 01:05:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gregory Heytings <gregory <at> heytings.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 11 Apr 2021 01:05:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 01:03:56 +0000
[Message part 1 (text/plain, inline)]
Currently completion-list-mode-map does not give a specific meaning to 
most keys, which means that most keypresses display an error "Buffer is 
read-only #<buffer *Completions*>".  I suggest to make it a child of 
special-mode-map, and to bind the "n" and "p" keys to "next-completion" 
and "previous-completion".

Patch attached.
[0001-Improve-completion-list-mode-map.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 07:25:01 GMT) Full text and rfc822 format available.

Message #8 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 10:24:30 +0300
> Date: Sun, 11 Apr 2021 01:03:56 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> 
> Currently completion-list-mode-map does not give a specific meaning to 
> most keys, which means that most keypresses display an error "Buffer is 
> read-only #<buffer *Completions*>".  I suggest to make it a child of 
> special-mode-map, and to bind the "n" and "p" keys to "next-completion" 
> and "previous-completion".
> 
> Patch attached.

Thanks.

Since your legal paperwork is not yet complete, please wait with
posting patches until that time, so that people will not be tempted to
install more of your changes when we are way past the threshold of
what we can accept without an assignment.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 07:32:02 GMT) Full text and rfc822 format available.

Message #11 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 10:31:03 +0300
> Date: Sun, 11 Apr 2021 01:03:56 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> 
> Currently completion-list-mode-map does not give a specific meaning to 
> most keys, which means that most keypresses display an error "Buffer is 
> read-only #<buffer *Completions*>".  I suggest to make it a child of 
> special-mode-map, and to bind the "n" and "p" keys to "next-completion" 
> and "previous-completion".

Why just 'n' and 'p'?  If we want more commands to move between
completions, I could think about several others: <, >, C-f, C-b, C-n,
C-p, Home, End, the arrow keys, etc.

However, these bindings are only available if one makes *Completions*
the current buffer, right?  Which rarely if ever happens in
TAB-completion scenarios, right?  If so, is that really helpful to
have these additional bindings, and if so, in what use cases?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 07:59:02 GMT) Full text and rfc822 format available.

Message #14 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 07:58:04 +0000
>> Currently completion-list-mode-map does not give a specific meaning to 
>> most keys, which means that most keypresses display an error "Buffer is 
>> read-only #<buffer *Completions*>".  I suggest to make it a child of 
>> special-mode-map, and to bind the "n" and "p" keys to "next-completion" 
>> and "previous-completion".
>
> Why just 'n' and 'p'?  If we want more commands to move between 
> completions, I could think about several others: <, >, C-f, C-b, C-n, 
> C-p, Home, End, the arrow keys, etc.
>

It's not "just 'n' and 'p'", it adds 'n' and 'p' to the already available 
choices, completion-list-mode-map already defines:

TAB, right = next-completion
backtab, left = previous-completion

and C-{p,n} and the arrow keys work as usual.

>
> However, these bindings are only available if one makes *Completions* 
> the current buffer, right?
>

Yes, of course.

>
> Which rarely if ever happens in TAB-completion scenarios, right?  If so, 
> is that really helpful to have these additional bindings, and if so, in 
> what use cases?
>

Well, vanilla Emacs defines M-v = switch-to-completions, which opens 
*Completions* and makes it the current buffer.  In a selection-like 
scenario, it makes sense to switch to the completions buffer where you can 
freely move around, use isearch, and so forth.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 08:15:01 GMT) Full text and rfc822 format available.

Message #17 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 11:14:02 +0300
> Date: Sun, 11 Apr 2021 07:58:04 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: 47699 <at> debbugs.gnu.org
> 
> > Why just 'n' and 'p'?  If we want more commands to move between 
> > completions, I could think about several others: <, >, C-f, C-b, C-n, 
> > C-p, Home, End, the arrow keys, etc.
> 
> It's not "just 'n' and 'p'"

The question was why add only those 2.

> Well, vanilla Emacs defines M-v = switch-to-completions, which opens 
> *Completions* and makes it the current buffer.  In a selection-like 
> scenario, it makes sense to switch to the completions buffer where you can 
> freely move around, use isearch, and so forth.

I wonder how many people use this paradigm

(And how does one switch back without closing the window that shows
completions?)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 08:32:02 GMT) Full text and rfc822 format available.

Message #20 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 08:31:00 +0000
>>> Why just 'n' and 'p'?  If we want more commands to move between 
>>> completions, I could think about several others: <, >, C-f, C-b, C-n, 
>>> C-p, Home, End, the arrow keys, etc.
>>
>> It's not "just 'n' and 'p'"
>
> The question was why add only those 2.
>

As many as you want could be added.  But there are already three ways to 
move between completions.  < and > are assigned by special-mode-map to 
beginning-of-buffer and end-of-buffer.  IMO changing the C-{fbnp} commands 
is not necessary, given that that moving around with their usual meaning 
makes sense.

>> Well, vanilla Emacs defines M-v = switch-to-completions, which opens 
>> *Completions* and makes it the current buffer.  In a selection-like 
>> scenario, it makes sense to switch to the completions buffer where you 
>> can freely move around, use isearch, and so forth.
>
> I wonder how many people use this paradigm
>

I do, from time to time.  I'd be surprised if I were the only one, as I 
remember that it's something I already did during the first days I used 
Emacs.  When you see a window with lots of information appearing, is it 
not natural to enter that window and to move around?

>
> (And how does one switch back without closing the window that shows 
> completions?)
>

C-x o.  Perhaps it would make sense to bind "o" for this, too.  And/or 
"Q".  WDYT?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 08:35:01 GMT) Full text and rfc822 format available.

Message #23 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 11:34:10 +0300
> Date: Sun, 11 Apr 2021 08:31:00 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: 47699 <at> debbugs.gnu.org
> 
> > (And how does one switch back without closing the window that shows 
> > completions?)
> 
> C-x o.  Perhaps it would make sense to bind "o" for this, too.  And/or 
> "Q".  WDYT?

'o' could be a good idea, IMO.

But I'm puzzled by the lack of symmetry: why bind M-v when "C-x o" is
available.  But I guess that ship sailed long ago.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 10:15:02 GMT) Full text and rfc822 format available.

Message #26 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 10:14:14 +0000
>>> (And how does one switch back without closing the window that shows 
>>> completions?)
>>
>> C-x o.  Perhaps it would make sense to bind "o" for this, too.  And/or 
>> "Q".  WDYT?
>
> 'o' could be a good idea, IMO.
>

Okay.

>
> But I'm puzzled by the lack of symmetry:
>

If you agreed with it, I would be pleased to add symmetry there.  I use 
M-c for both purposes locally:

(define-key minibuffer-local-map (kbd "M-c") 'switch-to-completions) 
(define-key completion-list-mode-map (kbd "M-c") 'other-window)

>
> why bind M-v when "C-x o" is available.
>

Because M-v does something very different: it opens the *Completions*. 
So it's the equivalent of TAB TAB C-- C-x o.

>
> But I guess that ship sailed long ago.
>

Yes, M-v was already present in Emacs 20.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 10:41:01 GMT) Full text and rfc822 format available.

Message #29 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 13:40:04 +0300
> Date: Sun, 11 Apr 2021 10:14:14 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: 47699 <at> debbugs.gnu.org
> 
> If you agreed with it, I would be pleased to add symmetry there.  I use 
> M-c for both purposes locally:
> 
> (define-key minibuffer-local-map (kbd "M-c") 'switch-to-completions) 
> (define-key completion-list-mode-map (kbd "M-c") 'other-window)

I don't think other-window is the right command, because with some
window configurations it might land you in the wrong window.  It has
to be a command that lands you back in the mini-window.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 10:51:02 GMT) Full text and rfc822 format available.

Message #32 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 10:50:15 +0000
>> If you agreed with it, I would be pleased to add symmetry there.  I use 
>> M-c for both purposes locally:
>>
>> (define-key minibuffer-local-map (kbd "M-c") 'switch-to-completions)
>> (define-key completion-list-mode-map (kbd "M-c") 'other-window)
>
> I don't think other-window is the right command, because with some 
> window configurations it might land you in the wrong window.  It has to 
> be a command that lands you back in the mini-window.
>

In practice other-window works well there, but now that you mention it, I 
agree with you that it's not safe enough.  What about:

(defun switch-to-minibuffer ()
  "Select the minibuffer window."
  (interactive)
  (when (active-minibuffer-window)
    (select-window (active-minibuffer-window))))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 13:32:02 GMT) Full text and rfc822 format available.

Message #35 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 16:31:10 +0300
> Date: Sun, 11 Apr 2021 10:50:15 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: 47699 <at> debbugs.gnu.org
> 
> In practice other-window works well there, but now that you mention it, I 
> agree with you that it's not safe enough.  What about:
> 
> (defun switch-to-minibuffer ()
>    "Select the minibuffer window."
>    (interactive)
>    (when (active-minibuffer-window)
>      (select-window (active-minibuffer-window))))

LGTM, thanks.  Did you test this with minibuffer-only frames?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 18:31:02 GMT) Full text and rfc822 format available.

Message #38 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 18:30:03 +0000
[Message part 1 (text/plain, inline)]
>
> LGTM, thanks.  Did you test this with minibuffer-only frames?
>

Thanks.  Here is the updated patch.  I tested it with minibuffer-only 
frames, and it seems to work.

Are you sure that it's okay to rebind M-c in 
minibuffer-local-completion-map?  It's a good mnemonic for "completion", 
but it hides the capitalize-word binding, that users might possibly want 
to use there (I don't, it's only when thinking about this patch that I 
realized this).

Another option would be M-g, which would not hide anything that is 
possibly useful in the minibuffer, and is still a mnemonic of "goto".
[Improve-completion-list-mode-map.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 18:47:02 GMT) Full text and rfc822 format available.

Message #41 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 21:46:19 +0300
> Date: Sun, 11 Apr 2021 18:30:03 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: 47699 <at> debbugs.gnu.org
> 
> Are you sure that it's okay to rebind M-c in 
> minibuffer-local-completion-map?

No, I was only talking about the command itself.  The binding needs a
separate discussion, I think.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 19:00:02 GMT) Full text and rfc822 format available.

Message #44 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Gregory Heytings <gregory <at> heytings.org>, Eli Zaretskii <eliz <at> gnu.org>
Cc: "47699 <at> debbugs.gnu.org" <47699 <at> debbugs.gnu.org>
Subject: RE: [External] : bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 18:59:32 +0000
> Are you sure that it's okay to rebind M-c in
> minibuffer-local-completion-map?  It's a good mnemonic for "completion",
> but it hides the capitalize-word binding, that users might possibly want
> to use there (I don't, it's only when thinking about this patch that I
> realized this).
> 
> Another option would be M-g, which would not hide anything that is
> possibly useful in the minibuffer, and is still a mnemonic of "goto".

FWIW, my voice says don't do any of this.  Just
leave keymap `completion-list-mode-map' alone.
(Likewise, the minibuffer keymaps.)

Yes, I can (and do) override whatever bindings
are unwise there.  Still...

As for a key to switch between the minibuffer
and *Completions*, FWIW Icicles uses `C-<insert>',
by default.  (Has done so for decades.)

And the commands for that key don't just switch
windows.  Moving to *Completions* puts the cursor
on the first occurrence of the current minibuffer
content, and moving to the minibuffer inserts the
current candidate in `*Completions*' (under the
cursor) as the current candidate for the minibuffer.

If vanilla Emacs insists on binding a key for
switching windows, for Icicles users it would be
better for vanilla Emacs to use `C-<insert>' as
well - the behavior would be similar with and
without Icicles.

IMO, `M-c' or any other editing key is a poor
choice for anything in the minibuffer.  For the
most part,uUsers should be able to do ordinary
editing in the minibuffer - including `M-c'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 19:14:01 GMT) Full text and rfc822 format available.

Message #47 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 19:13:32 +0000
>> Are you sure that it's okay to rebind M-c in 
>> minibuffer-local-completion-map?
>
> No, I was only talking about the command itself.  The binding needs a 
> separate discussion, I think.
>

Where?  I don't want to start another keybinding discussion on 
emacs-devel, last time I did it wasn't a pleasant experience...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 19:22:01 GMT) Full text and rfc822 format available.

Message #50 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 47699 <at> debbugs.gnu.org
Subject: RE: [External] : bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 19:21:54 +0000
>> Are you sure that it's okay to rebind M-c in 
>> minibuffer-local-completion-map?  It's a good mnemonic for 
>> "completion", but it hides the capitalize-word binding, that users 
>> might possibly want to use there (I don't, it's only when thinking 
>> about this patch that I realized this).
>>
>> Another option would be M-g, which would not hide anything that is 
>> possibly useful in the minibuffer, and is still a mnemonic of "goto".
>
> FWIW, my voice says don't do any of this.  Just leave keymap 
> `completion-list-mode-map' alone.
>

Why?  Almost no keys are defined in completion-list-mode-map, so why would 
it not be okay to define a few of them?

>
> (Likewise, the minibuffer keymaps.)
>

Why?  And as I just said, if some object against M-c (as you just did), 
M-g is the other choice, its meanings in global-map can't be used in the 
minibuffer.

>
> As for a key to switch between the minibuffer and *Completions*, FWIW 
> Icicles uses `C-<insert>', by default.
>

C-<insert> doesn't exist on laptop keyboard, and can't be used in a 
terminal, so it isn't exactly a good candidate.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 19:38:02 GMT) Full text and rfc822 format available.

Message #53 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 22:37:11 +0300
> Date: Sun, 11 Apr 2021 19:13:32 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: 47699 <at> debbugs.gnu.org
> 
> 
> >> Are you sure that it's okay to rebind M-c in 
> >> minibuffer-local-completion-map?
> >
> > No, I was only talking about the command itself.  The binding needs a 
> > separate discussion, I think.
> >
> 
> Where?

Right here, I think.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 20:45:01 GMT) Full text and rfc822 format available.

Message #56 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 20:44:57 +0000
>
> Right here, I think.
>

;-)

Okay, so what do you and others think of the following:

1. bind M-g in minibuffer-local-completion-map to switch-to-completions

2. bind M-g in completion-list-mode-map to switch-to-minibuffer, defined as follows:

(defun switch-to-minibuffer ()
  "Select the minibuffer window."
  (interactive)
  (when (active-minibuffer-window)
    (select-window (active-minibuffer-window))))

3. bind M-g in read-expression-map to read-expression-switch-to-completion, defined as follows:

(defun read-expression-switch-to-completions ()
  "Select the completion list window."
  (interactive)
  (let ((completion-auto-help t)
        (minibuffer-message-timeout 0))
    (completion-at-point)
    (switch-to-completions)))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 22:34:02 GMT) Full text and rfc822 format available.

Message #59 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>,
 "47699 <at> debbugs.gnu.org" <47699 <at> debbugs.gnu.org>
Subject: RE: [External] : bug#47699: [PATCH] Improve completion-list-mode-map
Date: Sun, 11 Apr 2021 22:33:42 +0000
> > FWIW, my voice says don't do any of this.  Just leave keymap
> > `completion-list-mode-map' alone.
> 
> Why?  Almost no keys are defined in completion-list-mode-map,
> so why would it not be okay to define a few of them?

I didn't say it isn't okay.  It's okay, of course.
I prefer that you don't; that's all.

I bind keys in it.  The more vanilla keys Emacs
binds there, the more I'll need to worry about
changing default bindings, and the more new users
will perhaps expect vanilla keys.

> > (Likewise, the minibuffer keymaps.)
> 
> Why?

Same reason - but a thousand times stronger.
Much more time (in Icicles) is spent in the
minibuffer than is ever spent in *Completions* -
thousands, maybe millions more key uses there
(not even counting self-inserting keys).

> And as I just said, if some object against M-c (as you just did),
> M-g is the other choice, its meanings in global-map can't be used 
> in the minibuffer.

Its global meanings can't be used in the minibuffer,
but other, minibuffer-specific meanings can.  I bind
lots of keys, including `M-g', in the minibuffer maps
(for Icicle minor mode).

The logic you're following, that key XYZ is "free",
and that its global binding is useless in the
minibuffer, is fine.  It's the same logic that others,
3rd-party libraries, use.  It's yet another case of
Emacs conquering more territory for itself, leaving
less for 3rd-party code.

Yes, I know things are different for a minor-mode
map.  Nothing prevents Icicle mode from continuing
with the same bindings.  Still, I'd prefer that
Emacs leave it alone - as it has done for 40 years. 

> C-<insert> doesn't exist on laptop keyboard, and can't be
> used in a terminal, so it isn't exactly a good candidate.

Is `emacs -nw' considered a "terminal"?  (I can never
remember the nuances)  If so then I can use it in a
terminal.  And users with laptops that don't have it
can rebind the command.  I haven't heard a complaint
about it (and I have heard about other keys not OK
for terminals).

But suit yourself.  I use it partly because "insert"
is mnemonic (for the Icicles behavior, which doesn't
just switch to another window).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Sun, 11 Apr 2021 22:59:01 GMT) Full text and rfc822 format available.

Message #62 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Mon, 12 Apr 2021 01:36:10 +0300
>>> Well, vanilla Emacs defines M-v = switch-to-completions, which opens
>>> *Completions* and makes it the current buffer.  In a selection-like
>>> scenario, it makes sense to switch to the completions buffer where you
>>> can freely move around, use isearch, and so forth.
>>
>> I wonder how many people use this paradigm
>
> I do, from time to time.  I'd be surprised if I were the only one, as
> I remember that it's something I already did during the first days I used
> Emacs.  When you see a window with lots of information appearing, is it not
> natural to enter that window and to move around?

I use this all the time: type PgUp to switch to the completions buffer,
then use the same key PgUp together with PgDn to scroll completions,
and use isearch to search in completions.

The existing useful key 'q' closes the completions buffer,
and switches back to the minibuffer.

But then I have such customization, with it using the completions buffer
is more handy:

(defun choose-completion-no-auto-exit ()
  (interactive)
  (let ((completion-no-auto-exit t))
    (call-interactively 'choose-completion)))

(define-key completion-list-mode-map [M-return] 'choose-completion-no-auto-exit)

where M-RET inserts the selected completion to the minibuffer without exiting it,
and switches back to the minibuffer.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Mon, 12 Apr 2021 06:50:01 GMT) Full text and rfc822 format available.

Message #65 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [External] : bug#47699: [PATCH] Improve
 completion-list-mode-map
Date: Mon, 12 Apr 2021 06:49:17 +0000
>>> FWIW, my voice says don't do any of this.  Just leave keymap 
>>> `completion-list-mode-map' alone.
>>
>> Why?  Almost no keys are defined in completion-list-mode-map, so why 
>> would it not be okay to define a few of them?
>
> I bind keys in it.
>
>>> (Likewise, the minibuffer keymaps.)
>>
>> Why?
>
> Same reason
>

I don't want to start another keybinding dispute with you, but it seems to 
me that you are wrong.  Can you perhaps explain how you (and Icicles 
users) would be affected by this change?  You said that you already have a 
(different) keybinding that does what I suggest, and that you bind the M-g 
key in the minibuffer to something else.  IOW, this change will have zero 
effect on you (and Icicles users): it will neither override one of your 
keys nor make one of the functionalities of vanilla Emacs unavailable for 
you (and Icicles users).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Mon, 12 Apr 2021 07:25:02 GMT) Full text and rfc822 format available.

Message #68 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Mon, 12 Apr 2021 07:24:25 +0000
[Message part 1 (text/plain, inline)]
>> Right here, I think.
>
> Okay, so what do you and others think of the following:
>

Here is the complete patch, with an improved 
read-expression-switch-to-completions function, so that you can try it 
out.
[Switch-between-minibuffer-and-Completions.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Mon, 12 Apr 2021 14:52:02 GMT) Full text and rfc822 format available.

Message #71 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: "47699 <at> debbugs.gnu.org" <47699 <at> debbugs.gnu.org>
Subject: RE: bug#47699: [External] : bug#47699: [PATCH] Improve
 completion-list-mode-map
Date: Mon, 12 Apr 2021 14:50:56 +0000
> this change will have zero
> effect on you (and Icicles users): it will neither
> override one of your keys nor make one of the
> functionalities of vanilla Emacs unavailable for
> you (and Icicles users).

I already explained.  The more keys you bind
there the more new Icicles users might expect
those vanilla keys.  There's no key conflict
per se, except possibly in the habits and minds
of users.

I already corrected your claim that I'm saying
it's somehow not OK to do what you propose.
I said, "I prefer that you don't; that's all."
I just made a request; you seem to want to argue. 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Tue, 25 May 2021 04:40:01 GMT) Full text and rfc822 format available.

Message #74 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Tue, 25 May 2021 06:39:21 +0200
Gregory Heytings <gregory <at> heytings.org> writes:

> Thanks.  Here is the updated patch.  I tested it with minibuffer-only
> frames, and it seems to work.
>
> Are you sure that it's okay to rebind M-c in
> minibuffer-local-completion-map?  It's a good mnemonic for
> "completion", but it hides the capitalize-word binding, that users
> might possibly want to use there (I don't, it's only when thinking
> about this patch that I realized this).
>
> Another option would be M-g, which would not hide anything that is
> possibly useful in the minibuffer, and is still a mnemonic of "goto".

Thanks; applied to Emacs 28.

I went with `M-g' -- it seems pretty natural here.  If anybody else
wants a different key binding, go ahead and change it.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 25 May 2021 04:40:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 47699 <at> debbugs.gnu.org and Gregory Heytings <gregory <at> heytings.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 25 May 2021 04:40:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Tue, 25 May 2021 07:33:02 GMT) Full text and rfc822 format available.

Message #81 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Tue, 25 May 2021 07:32:49 +0000
[Message part 1 (text/plain, inline)]
>> Thanks.  Here is the updated patch.  I tested it with minibuffer-only 
>> frames, and it seems to work.
>>
>> Are you sure that it's okay to rebind M-c in 
>> minibuffer-local-completion-map?  It's a good mnemonic for 
>> "completion", but it hides the capitalize-word binding, that users 
>> might possibly want to use there (I don't, it's only when thinking 
>> about this patch that I realized this).
>>
>> Another option would be M-g, which would not hide anything that is 
>> possibly useful in the minibuffer, and is still a mnemonic of "goto".
>
> Thanks; applied to Emacs 28.
>
> I went with `M-g' -- it seems pretty natural here.  If anybody else 
> wants a different key binding, go ahead and change it.
>

Juri said recently that he uses some of the keys in M-g in the minibuffer, 
so I changed my mind, and I now think that it would be better to use 'M-g 
M-c' for this, which is unused, and does not hide the complete M-g map. 
Updated patch attached.  WDYT?
[Switch-between-minibuffer-and-Completions.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Tue, 25 May 2021 07:39:02 GMT) Full text and rfc822 format available.

Message #84 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Tue, 25 May 2021 09:37:55 +0200
Gregory Heytings <gregory <at> heytings.org> writes:

> Juri said recently that he uses some of the keys in M-g in the
> minibuffer, so I changed my mind, and I now think that it would be
> better to use 'M-g M-c' for this, which is unused, and does not hide
> the complete M-g map. Updated patch attached.  WDYT?

Sure, `M-g M-c' is fine by me.  But could you send a new patch against
the current tree?  The previous version of the patch has already been
applied and pushed.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Tue, 25 May 2021 08:35:01 GMT) Full text and rfc822 format available.

Message #87 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Tue, 25 May 2021 08:34:13 +0000
[Message part 1 (text/plain, inline)]
>> Juri said recently that he uses some of the keys in M-g in the 
>> minibuffer, so I changed my mind, and I now think that it would be 
>> better to use 'M-g M-c' for this, which is unused, and does not hide 
>> the complete M-g map. Updated patch attached.  WDYT?
>
> Sure, `M-g M-c' is fine by me.  But could you send a new patch against 
> the current tree?  The previous version of the patch has already been 
> applied and pushed.
>

Hmmm...  Why did you remove "read-expression-switch-to-completions" from 
the patch?  I know that you can, in vanilla Emacs, achieve the same effect 
with TAB TAB C-- C-x o, which is I think too complicated.  Patch attached, 
against the current trunk.
[Further-improvements-to-completion-list-mode-map.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Tue, 25 May 2021 08:41:02 GMT) Full text and rfc822 format available.

Message #90 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Tue, 25 May 2021 10:40:44 +0200
Gregory Heytings <gregory <at> heytings.org> writes:

> Hmmm...  Why did you remove "read-expression-switch-to-completions"
> from the patch?

Did I?

> I know that you can, in vanilla Emacs, achieve the
> same effect with TAB TAB C-- C-x o, which is I think too complicated.
> Patch attached, against the current trunk.

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Tue, 25 May 2021 08:43:02 GMT) Full text and rfc822 format available.

Message #93 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Tue, 25 May 2021 08:42:40 +0000
>> I know that you can, in vanilla Emacs, achieve the same effect with TAB 
>> TAB C-- C-x o, which is I think too complicated. Patch attached, 
>> against the current trunk.
>
> Thanks; applied.
>

Thanks!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Tue, 25 May 2021 12:32:01 GMT) Full text and rfc822 format available.

Message #96 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Gregory Heytings <gregory <at> heytings.org>, 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Tue, 25 May 2021 13:31:19 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Gregory Heytings <gregory <at> heytings.org> writes:
>
>> Thanks.  Here is the updated patch.  I tested it with minibuffer-only
>> frames, and it seems to work.
>>
>> Are you sure that it's okay to rebind M-c in
>> minibuffer-local-completion-map?  It's a good mnemonic for
>> "completion", but it hides the capitalize-word binding, that users
>> might possibly want to use there (I don't, it's only when thinking
>> about this patch that I realized this).
>>
>> Another option would be M-g, which would not hide anything that is
>> possibly useful in the minibuffer, and is still a mnemonic of "goto".
>
> Thanks; applied to Emacs 28.

Thanks, but test/lisp/help-tests.el also needs updating:

  Test help-tests-substitute-command-keys/keymaps condition:
      (ert-test-failed
       ((should
         (equal
          (substitute-command-keys orig)
          result))
        :form
        (equal
         #("key             binding..." ...)
         "key             binding...")
        :value nil :explanation
        (arrays-of-different-length 715 688 ... first-mismatch-at 495)))
     FAILED  16/24  help-tests-substitute-command-keys/keymaps (0.000349 sec)

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Tue, 25 May 2021 19:24:02 GMT) Full text and rfc822 format available.

Message #99 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: Gregory Heytings <gregory <at> heytings.org>, 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Tue, 25 May 2021 21:22:59 +0200
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

> Thanks, but test/lisp/help-tests.el also needs updating:

Yup; fixed now.  (I'm not quite sure that test is very helpful...)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Tue, 25 May 2021 19:26:01 GMT) Full text and rfc822 format available.

Message #102 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Tue, 25 May 2021 19:25:39 +0000
[Message part 1 (text/plain, inline)]
>
> Thanks, but test/lisp/help-tests.el also needs updating:
>

Whoops, yes, indeed.  Patch attached.
[Fix-test-in-help-tests.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47699; Package emacs. (Tue, 25 May 2021 19:28:02 GMT) Full text and rfc822 format available.

Message #105 received at 47699 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 47699 <at> debbugs.gnu.org
Subject: Re: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Tue, 25 May 2021 19:27:12 +0000
>> Thanks, but test/lisp/help-tests.el also needs updating:
>
> Whoops, yes, indeed.  Patch attached.
>

... but Lars fixed this a few minutes ago ;-)




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 23 Jun 2021 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 299 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.