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: Štěpán Němec
Subject: bug#8897: `completion--insert-strings' clobbers user-added text properties
Date: Mon, 20 Jun 2011 16:22:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> #+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.

Sorry for my confusing description. What I meant is that there is
apparently some magic involved that makes a string manufactured with a
`propertize' form like the one above appear as if it had the button face
(underlined), even though it's not explicitely among its text properties
(maybe the `category' does it? I don't know).

In any case, without my patch the face is overridden to become the usual
annotation italic, so it _does_ suffer from the problem I describe.

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

Indeed. I don't use the cursor keys, but you're right in that they seem
to include the button-like annotations among their jump targets; as for
`choose-completion', that seems to be bound to RET in the *Completions*
buffer, but as I said and in line with your guess, pressing RET on an
annotation actually invokes the button action as desired, so this
problem doesn't seem to occur.

  Štěpán





reply via email to

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