unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dmitry@gutov.dev>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 71419@debbugs.gnu.org
Subject: bug#71419: 30.0.50; Completion does not always highlight the "common part" corresponding to suffix
Date: Sun, 9 Jun 2024 23:38:57 +0300	[thread overview]
Message-ID: <1dc364dc-1a16-4de4-9372-767906494610@gutov.dev> (raw)
In-Reply-To: <jwved96rzzh.fsf-monnier+emacs@gnu.org>

On 09/06/2024 16:52, Stefan Monnier wrote:
>> For example:
>>
>> 1. Type (fo|-function
>> 2. C-M-i
>>
>> You get 5 completions (the exact number is not important), where "fo" is
>> highlighted in all of them, but "function is not.
> 
> Looks like a bug in the `basic` completion style: it filters things that
> match the glob pattern `fo*-function` yet it only highlights the prefix.

Yes, thanks. Looks like this one-liner fixes it:

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index f62cb2566b2..144cda8cfdc 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3816,7 +3816,7 @@ completion-basic-all-completions
                              'point
                              (substring afterpoint 0 (cdr bounds)))))
           (all (completion-pcm--all-completions prefix pattern table 
pred)))
-    (completion-hilit-commonality all point (car bounds))))
+    (completion-pcm--hilit-commonality pattern all)))

  ;;; Partial-completion-mode style completion.



>> Also, highlighting is information. If it was more uniform, we could use
>> it to e.g. address the FIXME in completion-all-completions.
> 
> I don't think it could be trusted to always provide the needed data (and
> even if it does, it would be sufficiently clunky to use that I'm not
> sure we'd want to rely on it).

You're probably right.

But it would have been nice to be able to use it in the "progressive 
improvement" kind of fashion: when the suffix and the other parts are 
highlighted correctly, we do the right thing; if the style missed the 
suffix highlighting, we do the other thing - and put the responsibility 
on the third party.





  reply	other threads:[~2024-06-09 20:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-07 22:36 bug#71419: 30.0.50; Completion does not always highlight the "common part" corresponding to suffix Dmitry Gutov
2024-06-07 22:47 ` Dmitry Gutov
2024-06-09 13:52 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-09 20:38   ` Dmitry Gutov [this message]
2024-06-09 21:06     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-12 23:57       ` Dmitry Gutov

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=1dc364dc-1a16-4de4-9372-767906494610@gutov.dev \
    --to=dmitry@gutov.dev \
    --cc=71419@debbugs.gnu.org \
    --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 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).