GNU bug report logs - #8897
`completion--insert-strings' clobbers user-added text properties

Previous Next

Package: emacs;

Reported by: Štěpán Němec <stepnem <at> gmail.com>

Date: Sun, 19 Jun 2011 18:28:02 UTC

Severity: normal

Tags: fixed

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Štěpán Němec <stepnem <at> gmail.com>
To: 8897 <at> debbugs.gnu.org
Subject: bug#8897: `completion--insert-strings' clobbers user-added text properties
Date: Sun, 19 Jun 2011 20:22:54 +0200
Tags: patch

It is possible to bind `completion-annotate-function' to add custom
annotations, which is great. Unfortunately, the `face' and `mouse-face'
text properties added by such a function are then unconditionally
overwritten by `completion--insert-strings'.

In my particular case I define annotations as buttons (which display
even more detail about a completion value upon activation), so a visual
indication of clickability is very important for me.

I wonder if something like the patch below, which fixes the problem for
me, could be applied?

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 284cbdc..11534e6 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1003,9 +1003,12 @@ (defun completion--insert-strings (strings)
                                    'mouse-face 'highlight)
               (put-text-property (point) (progn (insert (car str)) (point))
                                  'mouse-face 'highlight)
-              (add-text-properties (point) (progn (insert (cadr str)) (point))
-                                   '(mouse-face nil
-						face completions-annotations)))
+              (let ((annotation (cadr str)))
+                (if (text-properties-at 1 annotation)
+                    (insert annotation)
+                  (add-text-properties (point) (progn (insert annotation) (point))
+                                       '(mouse-face nil
+                                                    face completions-annotations)))))
 	    (cond
 	     ((eq completions-format 'vertical)
 	      ;; Vertical format




This bug report was last modified 4 years and 271 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.