GNU bug report logs -
#8897
`completion--insert-strings' clobbers user-added text properties
Previous Next
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
Message #20 received at 8897 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> 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
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.