From: "Drew Adams" <drew.adams@oracle.com>
To: "Johan \"Bockgård\"" <bojohan+news@dd.chalmers.se>,
help-gnu-emacs@gnu.org
Subject: RE: how to save a face in Lisp?
Date: Wed, 3 Oct 2007 07:55:16 -0700 [thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICCEFCEAAA.drew.adams@oracle.com> (raw)
In-Reply-To: <yoijlkaky324.fsf@remote4.student.chalmers.se>
> > For example, suppose this is the definition of face `foo':
> >
> > (defface foo
> > '((((background dark)) (:foreground "DarkGreen"))
> > (t (:foreground "Red")))
> > "...")
> >
> > And suppose this has been evaluated, temporarily "customizing" the face
> > outside of Customize:
> >
> > (set-face-attribute 'foo nil :foreground "Yellow")
> >
> > And suppose that the background mode is not `dark'. Then the
> > spec that needs to be written if this face is saved is this:
> >
> > '((((background dark)) (:foreground "DarkGreen"))
> > (t (:foreground "Yellow")))
>
> (set-face-attribute FACE nil ...) overrides all other settings of FACE,
> so I don't think the `(background dark)' part should be saved.
Regardless of the fact that `set-face-attribute' does that for the current session, I want the effect to be exactly what it would be "if the face had been modified by the user in Customize and saved by the user in Customize."
But perhaps even in the latter case only the equivalent of the `set-face-attribute' effect is saved, not the whole (updated) spec. I was thinking that what was in the custom file was a complete defface spec that covers all background modes that were defined in the original defface spec, but it looks like it is just the part of that spec that the user actually customized.
However, it does include the entire alist entry (DISPLAY ATTS), not just ATTS. Here, for example, is a spec from my `custom-file':
'(link ((((class color) (min-colors 88) (background light))
(:foreground "blue1"))))
`face-attr-construct' gives me only ATTS. In this case, it would give me only (:foreground "blue1").
Depending on what the ATTS are, it would be possible to look up the corresponding DISPLAY in `face-user-default-spec'. Or I could try to construct DISPLAY from the current background mode and terminal type (color support etc.), but there is no way, without consulting the spec from `face-user-default-spec', to know whether DISPLAY should be `t' or, say, ((class color) (min-colors 88) (background light)).
I'm surprised that customizing in a currently light-background session would lose any dark-background information for the customized face. That doesn't seem right. You might want to use the same custom-file in different settings, with different background modes.
next prev parent reply other threads:[~2007-10-03 14:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1658.1191397285.18990.help-gnu-emacs@gnu.org>
2007-10-03 9:12 ` how to save a face in Lisp? Johan Bockgård
2007-10-03 14:55 ` Drew Adams [this message]
[not found] <mailman.1599.1191333917.18990.help-gnu-emacs@gnu.org>
2007-10-03 4:24 ` Steven L.
2007-10-03 7:41 ` Drew Adams
[not found] <mailman.1515.1191195346.18990.help-gnu-emacs@gnu.org>
2007-10-02 4:17 ` Steven L.
2007-10-02 14:04 ` Drew Adams
2007-09-30 23:35 Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DNEMKBNJBGPAOPIJOOICCEFCEAAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
--cc=bojohan+news@dd.chalmers.se \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.