unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Mendler via "Emacs development discussions." <emacs-devel@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Eli Zaretskii <eliz@gnu.org>,  Juri Linkov <juri@linkov.net>,
	me@eshelyaron.com,  emacs-devel@gnu.org,
	Dmitry Gutov <dmitry@gutov.dev>
Subject: Re: master 431f8ff1e38: * lisp/imenu.el: Support more values for imenu-flatten (bug#70846)
Date: Tue, 14 May 2024 22:58:44 +0200	[thread overview]
Message-ID: <874jb0dsaj.fsf@daniel-mendler.de> (raw)
In-Reply-To: <jwv4jb0tuc4.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue, 14 May 2024 09:10:05 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> +(defcustom completion-allow-text-properties nil
>>> +  "Non-nil means `choose-completion' should not discard text properties.
>>> +This also affects `completing-read' and any of the functions that do
>>> +minibuffer input with completion."
>>
>> This new user option should be announced in NEWS.
>>
>> I also wonder whether it should be a user option, i.e. is it
>> reasonable that a user would like all of his/her completions to
>> preserve text properties?  Stefan, WDYT?
>
> I can't see how it can make sense as a user-option, no.  AFAICT it's
> a hack for specific front-ends or specific backends (or combinations
> thereof) to work around limitations in the completion API (or maybe
> rather to allow abusing the completion API as a selection API 🙂).

As far as I can tell, both Corfu and Company preserve the text
properties if a candidate is selected explicitly. The same could work
for default completion when operating in "selection mode", i.e., when
the user explicitly selects a candidate explicitly in the *Completions*
buffer. However in the regular mode of operation, where the user
step-wise builds up input in the minibuffer, text properties wouldn't
and shouldn't be preserved.

Preserving text properties during selection can be useful when
distinguishing equal candidates, even if regular completion will
continue to work as is. For example Eglot provides both snippet and
identifier candidates (which may be equal). Then the user can explicitly
select among them. Similarly, Eglot may return equal candidates for
overloaded methods with argument list expansion like in Java.

However I am not sure if my proposal would help with the Imenu duplicate
candidate issue you are discussing here. When completing, the first
equal candidate would win, but the user could perhaps opt-in to select
another one explicitly.

Daniel



  parent reply	other threads:[~2024-05-14 20:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <171558357066.26019.9766615061719600757@vcs2.savannah.gnu.org>
     [not found] ` <20240513065931.0D83AC12C31@vcs2.savannah.gnu.org>
2024-05-13  9:22   ` master 431f8ff1e38: * lisp/imenu.el: Support more values for imenu-flatten (bug#70846) Eshel Yaron
2024-05-13 16:30     ` Juri Linkov
2024-05-14  6:08       ` Juri Linkov
2024-05-14  6:38         ` Eli Zaretskii
2024-05-14 13:10           ` Stefan Monnier
2024-05-14 16:46             ` Juri Linkov
2024-05-14 20:58             ` Daniel Mendler via Emacs development discussions. [this message]
2024-05-14 23:26               ` FW: [External] : " Drew Adams
2024-05-15 16:51           ` Juri Linkov
2024-05-15 18:03             ` Eli Zaretskii
2024-05-15 18:30             ` Eshel Yaron
2024-05-16  6:08               ` Juri Linkov
2024-05-16  9:51                 ` Eli Zaretskii
2024-05-17  6:48                   ` Juri Linkov
2024-05-17 15:36                     ` Stefan Monnier
2024-05-17 16:43                       ` Juri Linkov
2024-05-18 15:12                         ` Stefan Monnier
2024-05-20  6:46                           ` Juri Linkov
2024-05-27 18:18                             ` Juri Linkov
2024-05-14 15:26         ` [External] : " Drew Adams

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=874jb0dsaj.fsf@daniel-mendler.de \
    --to=emacs-devel@gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    --cc=mail@daniel-mendler.de \
    --cc=me@eshelyaron.com \
    --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).