unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Daniel Mendler <mail@daniel-mendler.de>,
	Eli Zaretskii <eliz@gnu.org>,
	61283@debbugs.gnu.org, Augusto Stoffel <arstoffel@gmail.com>,
	liuhui1610@gmail.com
Subject: bug#61283: 29.0.60; pcomplete-completions-at-point loses text properties, breaking pcomplete-from-help annotations
Date: Thu, 18 May 2023 00:11:09 -0700	[thread overview]
Message-ID: <e447e45e-f3b1-586e-40b8-640ec1da007e@gmail.com> (raw)
In-Reply-To: <jwvcz2yy8gs.fsf-monnier+emacs@gnu.org>

On 5/17/2023 2:20 PM, Stefan Monnier via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> I think the crux of the problem is in:
> 
>                  :annotation-function
>                  (lambda (cand)
>                    (when (stringp cand)
>                      (get-text-property 0 'pcomplete-annotation cand)))
>                  :company-docsig
>                  (lambda (cand)
>                    (when (stringp cand)
>                      (get-text-property 0 'pcomplete-help cand)))
> 
> Rather than fetch the info directly from `cand`, we should maybe
> lookup the info from elsewhere (maybe `completions`?).

Yeah, that's what my patch does.

> Then again, I'm not sure how much `cand` can differ from the matching
> entry in `completions`: it's affected by `completion-table-subvert` and
> `completion-table-with-quoting` so in general it can be non-trivial to
> figure out which entry of `completions` corresponds to the `cand` we
> got :-(

Hmm, yeah. That would be pretty tricky to get working 100% reliably. 
Like Daniel mentions, I think this doesn't come up (often?) for the 
specific case in this bug, but a fully-robust solution would be ideal. 
Maybe the 'metadata' operation[1] would be usable for this with some 
extra work. I'll have to think about this...

... since getting a 100% reliable solution here might take quite a bit 
more work than I thought, how about a not-quite-100% hack? Instead of 
propertizing the first character of each candidate, propertize the 
*last* character (or the entire string?). That won't get thrown out 
quite so easily.

[1] 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Programmed-Completion.html





  parent reply	other threads:[~2023-05-18  7:11 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-05  0:23 bug#61283: 29.0.60; pcomplete-completions-at-point loses text properties, breaking pcomplete-from-help annotations Daniel Mendler
2023-05-16  1:49 ` Liu Hui
2023-05-16  6:19   ` Daniel Mendler
2023-05-16 10:30     ` Eli Zaretskii
2023-05-16 10:44       ` Daniel Mendler
2023-05-16 21:37         ` Gregory Heytings
2023-05-17  6:15           ` Daniel Mendler
2023-05-17  7:24             ` Daniel Mendler
2023-05-17  5:45         ` Jim Porter
2023-05-17  6:31           ` Daniel Mendler
2023-05-17 14:55           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-17 21:20             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-18  2:01               ` Daniel Mendler
2023-05-18  5:39                 ` Eli Zaretskii
2023-05-18  6:44                   ` Jim Porter
2023-05-18  6:58                     ` Eli Zaretskii
2023-05-18  8:29                   ` Daniel Mendler
2023-05-18 13:37                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-18  7:11               ` Jim Porter [this message]
2023-05-18  8:37                 ` Daniel Mendler
2023-05-18 13:30                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-23  4:16                   ` Jim Porter
2023-05-16 14:04   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-16  7:50 ` 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

  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=e447e45e-f3b1-586e-40b8-640ec1da007e@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=61283@debbugs.gnu.org \
    --cc=arstoffel@gmail.com \
    --cc=eliz@gnu.org \
    --cc=liuhui1610@gmail.com \
    --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 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).