unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
Subject: RE: bind faces?
Date: Sat, 13 May 2006 12:40:17 -0700	[thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICKEAFDGAA.drew.adams@oracle.com> (raw)
In-Reply-To: <877j4pbxxe.fsf@mit.edu>

    > Is there some way to get the effect of "binding" a face to a
    > list of face properties or the properties of another face?
    > That is, do something akin to this:
    >
    >  (let ((some-face another-face-or-a-list-of-face-properties))
    >    (do-something))
    >
    > Wouldn't it be useful to be able to do that? We have `let'
    > for variables and `flet' (via cl.el) for functions, but
    > nothing for faces, IIUC. (Obviously, a user could work with
    > face variables, but those are not always available and
    > their use is generally discouraged.)

    See face-default-spec, face-spec-set, and the other functions in
    faces.el.

Yes, thanks. They can help with saving a face's attributes (spec), setting
the attributes to those of another face (or a constructed spec), and then
restoring the face's original attributes.

But, IIUC, you would still need to do unwind-protect, save the current spec,
set to another spec, and restore current spec. It's not clear to me how they
would provide the convenience of a `let'. One could write one's own macro to
do that (via unwind-protect), but why not have Emacs provide that?

I'm also not clear on how to use those functions to make a face
"unnoticeable", but that's because I'm not sure which face spec to use to do
that. Would it be just this, or is there some general way to nullify all
pertinent face properties?

 ((t (:foreground nil) (:background nil)))

I've been using this, which does the job (but it doesn't take into account
other face properties, such as underline):

 (set-face-foreground 'the-face nil)
 (set-face-background 'the-face nil)

  reply	other threads:[~2006-05-13 19:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-13 17:54 bind faces? Drew Adams
2006-05-13 18:07 ` Chong Yidong
2006-05-13 19:40   ` Drew Adams [this message]
2006-05-14  2:39     ` Richard Stallman
2006-05-14  0:52 ` Miles Bader
2006-05-14  1:02   ` Drew Adams
2006-05-14  2:16     ` Miles Bader
2006-05-14  3:13       ` Drew Adams
2006-05-14  4:10         ` David Kastrup
2006-05-14  2:33     ` Miles Bader
2006-05-14 13:17 ` Stefan Monnier
2006-05-14 14:32   ` Drew Adams
2006-05-14 14:46     ` Miles Bader
2006-05-14 16:13       ` Drew Adams
2006-05-14 17:49         ` Stefan Monnier
2006-05-14 18:43           ` 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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DNEMKBNJBGPAOPIJOOICKEAFDGAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).