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: Amos Bird
Subject: Re: How can I remove effects of text properties in 'before-string
Date: Mon, 23 Oct 2017 02:08:40 +0800
User-agent: mu4e 0.9.19; emacs 25.3.1

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

which doesn't. Why?

regards,

Eli Zaretskii <eliz@gnu.org> writes:

From: Amos Bird <amosbird@gmail.com>
Cc: help-gnu-emacs@gnu.org
Date: Mon, 23 Oct 2017 01:07:04 +0800

Hi, could you show the elisp code that resolves this? I don't
quite understand how to give a distinct face.

Here, this simple variation of your original recipe will display the
string in the margin using the 'default' face:

  (set-window-margins (get-buffer-window) 20 0)
(setq ovstring (propertize "Hi, there!" 'face 'default)) <<<<<<<<<<<<<<<
  (overlay-put (make-overlay (point) (point)) 'before-string
               (propertize "."
                           'display
                           `((margin left-margin) ,ovstring)))
  (hl-line-mode)

The line marked with "<<<<<" is the main part of the solution.


--
Amos Bird
amosbird@gmail.com


reply via email to

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