all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Faces: How to clear an attribute while continuing to inherit other attributes?
@ 2019-10-10  2:42 Dave Goel
  2019-10-10  8:09 ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Dave Goel @ 2019-10-10  2:42 UTC (permalink / raw)
  To: emacs-devel, Dave Goel

[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]

How to unset an inherited face attribute while continuing to inherit other
attributes?

Face 'a inherits from 'b, which sets foreground to yellow. How do I keep 'a
inheriting from 'b, but set the foreground to (nothing), so that actually
rendering 'a goes to the default foreground (white) instead of yellow?

Emacs allows us to set a's foreground to nil (instead of 'unspecified), but
it magically becomes 'unspecified when queried. That's not what I was
aiming for. That is because 'unspecified means actually rendering face 'a
would yield yellow, the color inherited from 'b instead of the default
foreground.

Here's a test:

(progn
  (defface a nil "")
  (defface b nil "")
  (set-face-attribute  'b nil :foreground "yellow")
  (set-face-attribute 'a nil :inherit 'b)
  (set-face-attribute 'a nil :foreground nil)
  ;; let's chase how 'a would render:
  (face-attribute 'a :foreground nil t))

=> "yellow"

We expected either "white", the default foreground.


So, unfortunately, setting a's foreground to nil seems to be equivalent to
setting a's foreground to 'unspecified.

Once I set it to nil, I edebugged (face-attribute), and it calls  '
internal-get-lisp-face-attribute which yields 'unspecified instead of the
expected nil.

(Please cc replies if you can. I tested all this with emacs24.)

Thanks
Dave

[-- Attachment #2: Type: text/html, Size: 2404 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-10-11  8:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-10  2:42 Faces: How to clear an attribute while continuing to inherit other attributes? Dave Goel
2019-10-10  8:09 ` Eli Zaretskii
2019-10-10 15:56   ` Dave Goel
2019-10-10 15:59     ` Dave Goel
2019-10-10 17:37     ` Eli Zaretskii
2019-10-10 17:50       ` Dave Goel
2019-10-10 18:07         ` Eli Zaretskii
2019-10-10 18:26           ` Dave Goel
2019-10-10 18:39             ` Eli Zaretskii
     [not found]           ` <47578dbd-71ea-cb02-c337-96fb18af1915@lanl.gov>
     [not found]             ` <83k19cqvdi.fsf@gnu.org>
2019-10-11  0:56               ` Dave Goel
2019-10-11  1:13                 ` Dave Goel
2019-10-11  8:37                   ` Eli Zaretskii
2019-10-11  8:36                 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.