all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#8897: `completion--insert-strings' clobbers user-added text properties
@ 2011-06-19 18:22 Štěpán Němec
  2011-06-19 18:34 ` Glenn Morris
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Štěpán Němec @ 2011-06-19 18:22 UTC (permalink / raw)
  To: 8897

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





^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-09-14 12:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-19 18:22 bug#8897: `completion--insert-strings' clobbers user-added text properties Štěpán Němec
2011-06-19 18:34 ` Glenn Morris
2011-06-20  3:08 ` Stefan Monnier
2011-06-20  8:07   ` Štěpán Němec
2011-06-20 14:01     ` Stefan Monnier
2011-06-20 14:22       ` Štěpán Němec
2011-06-20 16:36         ` Stefan Monnier
2020-09-14 12:25 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.