bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8897: `completion--insert-strings' clobbers user-added text properti


From: Stefan Monnier
Subject: bug#8897: `completion--insert-strings' clobbers user-added text properties
Date: Mon, 20 Jun 2011 10:01:22 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>>> 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.
>> Currently, the completion-list-mode uses the `mouse-face' text-property
>> to determine what is a completion item and what i something else (blank
>> space, annotation, you name it).  So as it stands, any mouse-face you'd
>> add to an annotation would confuse completion-list-mode into thinking it
>> is a completion item.
>> Maybe you could try to use the `category' text-property instead.

> Well I do use the `category' property, but the button functions seem to
> set up the button face automatically, which is then clobbered by
> `completion--insert-strings' (which is the problem). Here's how I set up
> an annotation, `n' being the number of a pull request as a string (i.e.,
> the completion value itself):

> #+begin_src elisp
> (let ((req (assoc-default n minibuffer-completion-table)))
>   (concat " "
>           (propertize (plist-get req :title)
>                       'fontified t
>                       'button '(t)
>                       'category 'default-button
>                       'help-echo "RET or mouse-2 for details"
>                       'pr-data req
>                       'action (lambda (b) (magithub-pull-request-details
>                                            (button-get b 'pr-data))))))
> #+end_src

I must be missing something: where is a `face' or `mouse-face' property
added?  The above code should not be affected by your patch, AFAICT.
And I don't understand your comment about "but the button functions seem
to set up the button face automatically" since I don't see where you
call a button function before insertion.

> With my patch I haven't noticed any problems you mention -- clicking
> or RET on the completion itself selects it, clicking or RET on the
> annotation displays further details, the button face is preserved.

I guess click&RET work OK because they're locally overridden, but if you
run M-x choose-completion while on the button or if you hit `left' or
`right' to skip from one completion to the next, you might see some
problem (although not with the code quoted above which should not
suffer from any of the problems discussed in this thread, AFAICT).


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]