all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Juri Linkov <juri@linkov.net>
Cc: Eli Zaretskii <eliz@gnu.org>,
	74616@debbugs.gnu.org, monnier@iro.umontreal.ca
Subject: bug#74616: 30.0.92; tmm always displays the *Completions* buffer
Date: Sun, 15 Dec 2024 11:02:29 +0100	[thread overview]
Message-ID: <87bjxdfemi.fsf@daniel-mendler.de> (raw)
In-Reply-To: <87o71d2xxb.fsf@mail.linkov.net> (Juri Linkov's message of "Sun,  15 Dec 2024 09:44:00 +0200")

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

Juri Linkov <juri@linkov.net> writes:

>> Thanks for finding this. The problem was that `initial-input' was passed
>> directly to `completion-metadata'. I replaced `initial-input' with `(or
>> initial-input "")'. See the updated patch attached to this mail.
>
> It seems this change caused another regression: 'ffap' on a file name
> fails with the error:

Oh, I see. The INITIAL-INPUT argument can be a cons pair too.  See the
patch attached to this mail which fixes the problem.

Daniel


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-completion-eager-display-Handle-INITIAL-INPUT-cons.patch --]
[-- Type: text/x-diff, Size: 1604 bytes --]

From 234fbf9b2e05c73b6197f4db9e88c694e54a95a2 Mon Sep 17 00:00:00 2001
From: Daniel Mendler <mail@daniel-mendler.de>
Date: Sun, 15 Dec 2024 10:57:59 +0100
Subject: [PATCH] completion-eager-display: Handle INITIAL-INPUT cons

The INITIAL-ARGUMENT passed to `completing-read' can either be
nil, or a string or a pair (STRING . POSITION).  Handle each of
these three cases.

* lisp/minibuffer.el (completing-read-default): Handle cons pair
INITIAL-ARGUMENT.
---
 lisp/minibuffer.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index dfc62c25f38..9a8545c56a6 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -4857,8 +4857,12 @@ completing-read-default
                 ;; `completion-eager-display' is t or if eager display
                 ;; has been requested by the completion table.
                 (when completion-eager-display
-                  (let* ((md (completion-metadata (or initial-input "")
-                                                  collection predicate))
+                  (let* ((md (completion-metadata
+                              (pcase initial-input
+                                (`(,str . ,pos) (substring str 0 pos))
+                                ((pred stringp) initial-input)
+                                (_ ""))
+                              collection predicate))
                          (fun (completion-metadata-get md 'eager-display)))
                     (when (or fun (eq completion-eager-display t))
                       (funcall (if (functionp fun)
-- 
2.45.2


  reply	other threads:[~2024-12-15 10:02 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-30  6:42 bug#74616: 30.0.92; tmm always displays the *Completions* buffer Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30  8:04 ` Eli Zaretskii
2024-11-30  8:12   ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30 18:55   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-01  4:00     ` Sean Whitton
2024-12-07 12:55     ` Eli Zaretskii
2024-12-07 14:38       ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08  7:17         ` Eli Zaretskii
2024-12-08  7:49           ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08 15:33         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08 19:59           ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-09 14:19             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-09 14:44               ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-09 15:25                 ` Eli Zaretskii
2024-12-09 15:42                   ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-09 19:03             ` Juri Linkov
2024-12-09 19:28               ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-09 20:06                 ` Eli Zaretskii
2024-12-09 20:12                   ` Eli Zaretskii
2024-12-09 19:52               ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-09 20:08                 ` Eli Zaretskii
2024-12-09 20:32                   ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-10 12:32                     ` Eli Zaretskii
2024-12-11 15:37                       ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-14 10:31                         ` Eli Zaretskii
2024-12-14 11:44                           ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-14 12:40                             ` Eli Zaretskii
2024-12-15  7:44                             ` Juri Linkov
2024-12-15 10:02                               ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-12-15 15:29                                 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-15 23:04                                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-10  7:43                 ` 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

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

  git send-email \
    --in-reply-to=87bjxdfemi.fsf@daniel-mendler.de \
    --to=bug-gnu-emacs@gnu.org \
    --cc=74616@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    --cc=mail@daniel-mendler.de \
    --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 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.