emacs-devel
[Top][All Lists]
Advanced

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

Re: buffer-face-set changes the fringe, is it a bug?


From: Gregory Heytings
Subject: Re: buffer-face-set changes the fringe, is it a bug?
Date: Mon, 6 Jul 2020 14:22:16 +0200 (CEST)
User-agent: Alpine 2.21 (NEB 202 2017-01-01)



In fact the manual is not as clear as you think, it states (see 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Fringe-Bitmaps.html ):

(fringe bitmap [face])

The optional face names a face whose foreground color is used to display the bitmap; this face is automatically merged with the fringe face.

For me this means that the fringe face is used to display the bitmaps in the fringe, except the :foreground property which can optionally be imported from another face.

Thanks, I clarified the meaning of FACE in that case.


Sorry to come back to this, but on a second thought the documentation is still not correct:

The optional @var{face} names a face whose foreground and background colors are to be used to display the bitmap; this face is automatically merged with the @code{fringe} face. If @var{face} is omitted, that means to use the @code{default} face.

If this were true, then the following two snippets should give the same result:

(set-face-attribute 'fringe nil :background "red" :foreground "blue")
(let ((o (make-overlay 0 1)) (s "_"))
  (put-text-property 0 1 'display '(left-fringe question-mark) s)
  (overlay-put o 'after-string s))

(set-face-attribute 'fringe nil :background "red" :foreground "blue")
(let ((o (make-overlay 0 1)) (s "_"))
  (put-text-property 0 1 'display '(left-fringe question-mark default) s)
  (overlay-put o 'after-string s))

They do not, the first one displays the question mark in blue on a red background, the second one in black on a white background.

To summarize, with:

(set-face-attribute 'fringe nil :background "red" :foreground "blue")
(let ((o (make-overlay 0 1)) (s "_"))
  (put-text-property 0 1 'display '(left-fringe question-mark [1]) s)
  (overlay-put o 'after-string s)) [2]
(buffer-face-set '(:background "yellow" :foreground "red")) [3]

value in [1]: | effect after [2]:   | effect after [3]:
(nothing)     | blue ? on red bg    | red ? on yellow bg
fringe        | blue ? on red bg    | blue ? on red bg
default       | black ? on white bg | red ? on yellow bg

So it seems that it's only when a face remapping takes place that an omitted face in [1] means using the default face. Before the face remapping takes place, the fringe face is used instead.

Gregory



reply via email to

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