unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Liu Hui <liuhui1610@gmail.com>
To: "mail@daniel-mendler.de" <mail@daniel-mendler.de>
Cc: 61283@debbugs.gnu.org
Subject: bug#61283: 29.0.60; pcomplete-completions-at-point loses text properties, breaking pcomplete-from-help annotations
Date: Tue, 16 May 2023 09:49:00 +0800	[thread overview]
Message-ID: <CAOQTW-O2F3x+0Yrs63B99_0B2W=Dw=SKjYt0Neo_AAQ0E+yWnw@mail.gmail.com> (raw)
In-Reply-To: <87cz6px8mw.fsf@daniel-mendler.de>

Hi,

> 1. Start emacs -Q
> 2. Evaluate the following two test commands in the scratch buffer:
>
> (defun good ()
>   (interactive)
>   (pp (all-completions "" (nth 2 (pcomplete-completions-at-point)))))
>
> (defun bad ()
>   (interactive)
>   (pp (all-completions "-" (nth 2 (pcomplete-completions-at-point)))))
>
> 3. Run shell or eshell
> 4. Enter `xargs --' in order to complete command line options via
> `pcomplete-from-help'.
> 5. M-x good -> Printed completion strings will have pcomplete-annotation
> and pcomplete-help text properties. These are used by the
> :annotation-function and the :company-docsig function.
> 6. M-x bad -> Returned completion strings are stripped of their text
> properties.
> 7. When triggering completion manually by pressing TAB, there are
> no annotations displayed in the *Completions* buffer.
>
> If I recall correctly, this functionality worked at some point and the
> text properties were not removed, such that annotations worked. The

I cannot find a working commit after a9941269683, which adds the two
text properties.

> culprit, which destroys the properties, seems to be
> `completion-table-with-quoting' in `pcomplete-completions-at-point', but
> I wasn't able to figure out which commit caused this (I did not do any
bisecting).

I agree that completion-table-with-quoting is responsible.
pcomplete-annotation and pcomplete-help text properties can be
successfully shown by the completion UI (corfu/company) by applying
the following patch:

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index a3dc1b0cfbf..b0c32b938a0 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -700,6 +700,7 @@ completion--twq-all
            ;;  (concat (substring ustring 0 boundary)
            ;;          completion))
            ;; t)
+                   (add-text-properties 0 1 (text-properties-at 0
completion) qcompletion)
                    qcompletion))
                completions)
        qboundary))))

It just re-adds text properties to completions produced by
`completion-table-with-quoting', but I'm not sure it is the proper
fix. What do you think?





  reply	other threads:[~2023-05-16  1:49 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 [this message]
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
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='CAOQTW-O2F3x+0Yrs63B99_0B2W=Dw=SKjYt0Neo_AAQ0E+yWnw@mail.gmail.com' \
    --to=liuhui1610@gmail.com \
    --cc=61283@debbugs.gnu.org \
    --cc=mail@daniel-mendler.de \
    /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).