GNU bug report logs - #62700
29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Thu, 6 Apr 2023 17:57:01 UTC

Severity: normal

Found in version 29.0.60

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 62700 <at> debbugs.gnu.org, sbaugh <at> catern.com, Juri Linkov <juri <at> linkov.net>
Subject: bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer
Date: Tue, 13 Jun 2023 16:59:19 -0400
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Juri Linkov <juri <at> linkov.net>
>> Cc: sbaugh <at> janestreet.com,  62700 <at> debbugs.gnu.org,  sbaugh <at> catern.com
>> Date: Tue, 13 Jun 2023 19:54:04 +0300
>> 
>> >> I checked that no problems occurred in minibuffer.el on the master branch.
>> >
>> > Thanks.  I wasn't sure that my manual resolution of the merge conflict
>> > in this case was correct.
>> 
>> I looked at the patch that should be pushed to master, and noticed
>> that probably it needs the same change that was applied in emacs-29.
>> Maybe Spencer could confirm what would be the right patch for master.
>
> Yes, Spencer, please take a look.

Indeed it needs the same change.  Here's the version of the patch that
should be pushed to master.

[0001-Handle-point-not-at-EOB-in-minibuffer-choose-complet.patch (text/x-patch, inline)]
From 4769e70e2e9af6eb68947d6c2ed0dcff0831def0 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Mon, 24 Apr 2023 10:05:24 -0400
Subject: [PATCH] Handle point not at EOB in minibuffer-choose-completion

Without this change, only the minibuffer contents before point are
cleared when a completion is chosen, which results in stray text when
point is in the middle of the minibuffer.

After this change, we heuristically decide either to clear the whole
buffer or only part of it, taking into account the location of point.

* lisp/minibuffer.el (minibuffer-completion-help): Use point when
calculating completion-base-affixes. (Bug#62700)
---
 lisp/minibuffer.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 539206a19e4..d079dc0bcdf 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2395,7 +2395,11 @@ minibuffer-completion-help
              (prefix (unless (zerop base-size) (substring string 0 base-size)))
              (base-prefix (buffer-substring (minibuffer--completion-prompt-end)
                                             (+ start base-size)))
-             (base-suffix (buffer-substring (point) (point-max)))
+             (base-suffix
+              (if (eq (alist-get 'category (cdr md)) 'file)
+                  (buffer-substring (save-excursion (or (search-forward "/" nil t) (point-max)))
+                                    (point-max))
+                ""))
              (all-md (completion--metadata (buffer-substring-no-properties
                                             start (point))
                                            base-size md
-- 
2.39.3


This bug report was last modified 1 year and 40 days ago.

Previous Next


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