unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Gregory Heytings <gregory@heytings.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 47699@debbugs.gnu.org
Subject: bug#47699: [PATCH] Improve completion-list-mode-map
Date: Tue, 25 May 2021 08:34:13 +0000	[thread overview]
Message-ID: <e19e2fa8603c199bf1c9@heytings.org> (raw)
In-Reply-To: <878s43qn58.fsf@gnus.org>

[-- Attachment #1: Type: text/plain, Size: 694 bytes --]


>> 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.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff; name=Further-improvements-to-completion-list-mode-map.patch, Size: 4316 bytes --]

From a5f1e8a16df0d4fc8616c2b77830f0646ecf79d1 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Tue, 25 May 2021 08:20:26 +0000
Subject: [PATCH] Further improvements to completion-list-mode-map

* lisp/simple.el (completion-list-mode-map): Change the M-g key to M-g M-c.
(read-expression-map): Bind M-g M-c to read-expression-switch-to-completions.
(read-expression-switch-to-completions): New function.

* lisp/minibuffer.el (minibuffer-local-completion-map): Change the M-g key to
M-g M-c.

* doc/emacs/mini.texi (Completion Commands): Mention the change, and mention
the 'n' and 'p' keys bound to 'next-completion' and 'previous-completion'.
---
 doc/emacs/mini.texi | 6 ++++--
 etc/NEWS            | 4 ++--
 lisp/minibuffer.el  | 2 +-
 lisp/simple.el      | 9 ++++++++-
 4 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi
index 564e576300..2fdb1e7072 100644
--- a/doc/emacs/mini.texi
+++ b/doc/emacs/mini.texi
@@ -375,8 +375,8 @@ Completion Commands
 Typing @kbd{M-v}, while in the minibuffer, selects the window showing
 the completion list (@code{switch-to-completions}).  This paves the
 way for using the commands below.  @key{PageUp}, @key{prior} and
-@kbd{M-g} does the same.  You can also select the window in other ways
-(@pxref{Windows}).
+@kbd{M-g M-c} does the same.  You can also select the window in other
+ways (@pxref{Windows}).
 
 @findex choose-completion
 @item @key{RET}
@@ -388,12 +388,14 @@ Completion Commands
 @findex next-completion
 @item @key{TAB}
 @item @key{RIGHT}
+@item @key{n}
 While in the completion list buffer, these keys move point to the
 following completion alternative (@code{next-completion}).
 
 @findex previous-completion
 @item @key{S-TAB}
 @item @key{LEFT}
+@item @key{p}
 While in the completion list buffer, these keys move point to the
 previous completion alternative (@code{previous-completion}).
 
diff --git a/etc/NEWS b/etc/NEWS
index d163c18871..1541b74a3b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -444,8 +444,8 @@ major mode.
 
 ** Completion List Mode
 New key bindings have been added: 'n' and 'p' to navigate completions,
-and 'M-g' to switch to the minibuffer, and you can also switch back
-to the completion list buffer with 'M-g'.
+and 'M-g M-c' to switch to the minibuffer, and you can also switch back
+to the completion list buffer with 'M-g M-c'.
 
 ** Benchmark
 *** New function 'benchmark-call' to measure the execution time of a function.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 36fb8e72c1..ec21b7b93b 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2603,7 +2603,7 @@ minibuffer-local-completion-map
     (define-key map "?" 'minibuffer-completion-help)
     (define-key map [prior] 'switch-to-completions)
     (define-key map "\M-v"  'switch-to-completions)
-    (define-key map "\M-g"  'switch-to-completions)
+    (define-key map "\M-g\M-c"  'switch-to-completions)
     map)
   "Local keymap for minibuffer input with completion.")
 
diff --git a/lisp/simple.el b/lisp/simple.el
index b3470ac7b0..8849919360 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1661,6 +1661,7 @@ read-expression-map
     (define-key m "\t" 'completion-at-point)
     (define-key m "\r" 'read--expression-try-read)
     (define-key m "\n" 'read--expression-try-read)
+    (define-key m "\M-g\M-c" 'read-expression-switch-to-completions)
     (set-keymap-parent m minibuffer-local-map)
     m))
 
@@ -8848,7 +8849,7 @@ completion-list-mode-map
     (define-key map "z" 'kill-current-buffer)
     (define-key map "n" 'next-completion)
     (define-key map "p" 'previous-completion)
-    (define-key map "\M-g" 'switch-to-minibuffer)
+    (define-key map "\M-g\M-c" 'switch-to-minibuffer)
     map)
   "Local map for completion list buffers.")
 
@@ -9138,6 +9139,12 @@ switch-to-completions
       (when (bobp)
 	(next-completion 1)))))
 
+(defun read-expression-switch-to-completions ()
+  "Select the completion list window while reading an expression."
+  (interactive)
+  (completion-help-at-point)
+  (switch-to-completions))
+
 (defun switch-to-minibuffer ()
   "Select the minibuffer window."
   (interactive)
-- 
2.30.2


  reply	other threads:[~2021-05-25  8:34 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-11  1:03 bug#47699: [PATCH] Improve completion-list-mode-map Gregory Heytings
2021-04-11  7:24 ` Eli Zaretskii
2021-04-11  7:31 ` Eli Zaretskii
2021-04-11  7:58   ` Gregory Heytings
2021-04-11  8:14     ` Eli Zaretskii
2021-04-11  8:31       ` Gregory Heytings
2021-04-11  8:34         ` Eli Zaretskii
2021-04-11 10:14           ` Gregory Heytings
2021-04-11 10:40             ` Eli Zaretskii
2021-04-11 10:50               ` Gregory Heytings
2021-04-11 13:31                 ` Eli Zaretskii
2021-04-11 18:30                   ` Gregory Heytings
2021-04-11 18:46                     ` Eli Zaretskii
2021-04-11 19:13                       ` Gregory Heytings
2021-04-11 19:37                         ` Eli Zaretskii
2021-04-11 20:44                           ` Gregory Heytings
2021-04-12  7:24                             ` Gregory Heytings
2021-04-11 18:59                     ` bug#47699: [External] : " Drew Adams
2021-04-11 19:21                       ` Gregory Heytings
2021-04-11 22:33                         ` Drew Adams
2021-04-12  6:49                           ` Gregory Heytings
2021-04-12 14:50                             ` Drew Adams
2021-05-25  4:39                     ` Lars Ingebrigtsen
2021-05-25  7:32                       ` Gregory Heytings
2021-05-25  7:37                         ` Lars Ingebrigtsen
2021-05-25  8:34                           ` Gregory Heytings [this message]
2021-05-25  8:40                             ` Lars Ingebrigtsen
2021-05-25  8:42                               ` Gregory Heytings
2021-05-25 12:31                       ` Basil L. Contovounesios
2021-05-25 19:22                         ` Lars Ingebrigtsen
2021-05-25 19:25                         ` Gregory Heytings
2021-05-25 19:27                           ` Gregory Heytings
2021-04-11 22:36         ` Juri Linkov

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=e19e2fa8603c199bf1c9@heytings.org \
    --to=gregory@heytings.org \
    --cc=47699@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /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).