[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8897: `completion--insert-strings' clobbers user-added text properti
From: |
Štěpán Němec |
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
- bug#8897: `completion--insert-strings' clobbers user-added text properties,
Štěpán Němec <=