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: Sun, 5 Jul 2020 14:43:46 +0200 (CEST)
User-agent: Alpine 2.21 (NEB 202 2017-01-01)



Is the following behavior expected, or is it a bug?

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

This puts a question mark in the left fringe. At least on Emacs 26.3 (started with emacs -Q), after:

(buffer-face-set '(:background "yellow"))

the background of the buffer *and* the question mark in the fringe become yellow. I would have expected that the background of the question mark would still be red.

Gregory

You are assuming that 'display' property that draws on the fringe automatically uses the 'fringe' face? But that's not how this property works: it uses the 'default' face (and thus is subject to face remapping).


OK, so one should use:

(put-text-property 0 1 'display '(left-fringe question-mark fringe) s)


To use another face, you need to specify it in the 'left-fringe' form, see the ELisp manual for the details.


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. What actually happens it that the default face is used, and that its properties can ben overriden with the :foreground and :background properties of another face. So I do think this is a bug, either in the manual or in the code.

Gregory



reply via email to

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