[Top][All Lists]

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

Re: Consistent face for keys in *Help* and `substitute-command-keys'

From: Eli Zaretskii
Subject: Re: Consistent face for keys in *Help* and `substitute-command-keys'
Date: Thu, 04 Mar 2021 16:00:04 +0200

> From: Stefan Kangas <stefan@marxist.se>
> Date: Thu, 4 Mar 2021 00:24:14 -0600
> Cc: larsi@gnus.org, emacs-devel@gnu.org
> > So I guess we will need to change the design of this to avoid overriding
> > the whole face of a tooltip, or maybe add some special code to
> > help_echo_substitute_command_keys.
> Could we just use `add-face-text-property' here, perhaps?
> It seems to do what we want:
>     (let ((foo "x") bar)
>       (add-face-text-property 0 (length foo) 'bold nil foo)
>       (setq bar (concat "y" foo "y"))
>       (add-face-text-property 0 (length bar) 'italic nil bar)
>       bar)
>     => #("yxy" 0 1 (face italic) 1 2 (face (italic bold)) 2 3 (face italic))

That's because you add a property which was unspecified by the
original face.  But in the tooltip case, the function tooltip-show
propertizes the entire text it receives with the 'tooltip' face, so
any face attributes in the text that are also specified by the
'tooltip' face will be overwritten.  So, for example, if the tooltip
text had a :background attribute, that attribute would be overwritten
by the background color of the 'tooltip' face.  Isn't that what you

reply via email to

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