Subject: bug#61283: 29.0.60; pcomplete-completions-at-point loses text properties, breaking pcomplete-from-help annotations

From: Daniel Mendler <[email-masked]>
Date: Sun, 05 Feb 2023 01:23:35 +0100

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
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).

In GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw scroll bars) of 2023-01-26 built on projects
Repository revision: f8c95d1a7681e861fc22d2a040cda0ddfe23eff4
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)