all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Gregory Heytings <gregory@heytings.org>
To: Knut Anders Hatlen <kahatlen@gmail.com>
Cc: 60411@debbugs.gnu.org
Subject: bug#60411: 29.0.60; minibuffer-next-completion skips first candidate when completions-header-format and completion-show-help are nil
Date: Fri, 30 Dec 2022 21:54:21 +0000	[thread overview]
Message-ID: <6c9d91cffcdbff97f034@heytings.org> (raw)
In-Reply-To: <87zgb5lx6y.fsf@oracle.com>

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


>
> 1. Evaluate: (setopt completions-header-format nil completion-show-help 
> nil)
>
> 2. Type M-x followed by TAB. The *Completions* buffer pops up and shows 
> all available commands.
>
> 3. Type M-<down>.
>
> Expected result: The first candidate in *Completions* is selected.
>
> Actual result: The second candidate in *Completions* is selected.
>

Thanks for your bug report.

I attach a patch to fix that bug, can you please try it?

It's a workaround, but it's the cleanest fix I can think of.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Fix-selection-of-completions-with-completions-header.patch --]
[-- Type: text/x-diff; name=Fix-selection-of-completions-with-completions-header.patch, Size: 1320 bytes --]

From 10d86c8025b3387644089fa3774b2c9883fabf36 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Fri, 30 Dec 2022 21:45:24 +0000
Subject: [PATCH] Fix selection of completions with completions-header-format
 nil

* lisp/minibuffer.el (display-completion-list): Insert an
invisible line when completions-header-format is nil.
Fixes bug#60411.
---
 lisp/minibuffer.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 7a720cf2c0..95b8962759 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2275,8 +2275,12 @@ display-completion-list
 
     (with-current-buffer standard-output
       (goto-char (point-max))
-      (when completions-header-format
-        (insert (format completions-header-format (length completions))))
+      (if completions-header-format
+          (insert (format completions-header-format (length completions)))
+        ;; Insert an invisible line, otherwise the first call to
+        ;; 'minibuffer-next-completion' might select the second
+        ;; completion candidate.  See bug#60411.
+        (insert (propertize "\n" 'invisible t)))
       (completion--insert-strings completions group-fun)))
 
   (run-hooks 'completion-setup-hook)
-- 
2.39.0


  parent reply	other threads:[~2022-12-30 21:54 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-29 21:25 bug#60411: 29.0.60; minibuffer-next-completion skips first candidate when completions-header-format and completion-show-help are nil Knut Anders Hatlen
2022-12-30  8:11 ` Eli Zaretskii
2022-12-30 11:04   ` Knut Anders Hatlen
2022-12-30 21:54 ` Gregory Heytings [this message]
2022-12-31  6:27   ` Knut Anders Hatlen
2022-12-31 15:02     ` Gregory Heytings
2022-12-31 15:33       ` Knut Anders Hatlen
2022-12-31 15:35         ` Gregory Heytings
2022-12-31 16:40       ` Eli Zaretskii
2023-01-01 17:00       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-01 17:05         ` Gregory Heytings
2023-01-01 17:55           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-01 18:56             ` Gregory Heytings
2023-01-05 17:37               ` Juri Linkov
2023-01-05 21:04                 ` Gregory Heytings
2023-01-06  6:43                   ` Eli Zaretskii
2023-01-06  8:22                     ` Gregory Heytings
2023-01-06  8:52                       ` Eli Zaretskii
2023-01-06  9:01                         ` Gregory Heytings
2023-01-06 11:40                           ` Eli Zaretskii
2023-01-06 12:13                             ` Gregory Heytings
2023-01-06 12:21                               ` Eli Zaretskii
2023-01-06 12:39                                 ` Gregory Heytings
2023-01-06 12:59                                   ` Eli Zaretskii
2023-01-06 13:10                                     ` Gregory Heytings
2023-01-06 13:26                                       ` Eli Zaretskii
2023-01-06 17:07                                         ` Gregory Heytings
2023-01-06 18:05                                           ` Eli Zaretskii
2023-01-06 18:23                                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-06 18:51                                               ` Gregory Heytings
2023-01-07 18:11                                           ` Juri Linkov
2023-01-07 18:15                                             ` Juri Linkov
2023-01-07 22:35                                               ` Gregory Heytings
2023-01-08  8:42                                                 ` Juri Linkov
2023-01-08 22:43                                                   ` Gregory Heytings
2023-01-12 17:48                                                 ` Juri Linkov
2023-01-06 17:51                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-06 18:11                                   ` Eli Zaretskii
2023-01-06 18:49                                   ` Gregory Heytings

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

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

  git send-email \
    --in-reply-to=6c9d91cffcdbff97f034@heytings.org \
    --to=gregory@heytings.org \
    --cc=60411@debbugs.gnu.org \
    --cc=kahatlen@gmail.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.