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

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

Re: How can I remove effects of text properties in 'before-string


From: Stefan Monnier
Subject: Re: How can I remove effects of text properties in 'before-string
Date: Mon, 23 Oct 2017 08:57:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> Hi, thanks for the code. It works! However, I tried to explicited set face
> to '((t (:foreground "magenta" :weight bold :inherit default))

That's not a face.  You're confusing the face-spec passed to `defface`
with an actual face.

You can use

(setq ovstring
      (propertize "Hi, there!" 'face
                               '((:foreground "magenta" :weight bold) default)))

tho I'd recommend you use one of

    (defface foo-bar
      '((t (:foreground "magenta" :weight bold :inherit default))))
    [...]
      (setq ovstring (propertize "Hi, there!" 'face 'foo-bar))

or

    (defface foo-bar
      '((t (:foreground "magenta" :weight bold))))
    [...]
      (setq ovstring (propertize "Hi, there!" 'face '(foo-bar default)))


-- Stefan




reply via email to

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