all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Chong Yidong <cyd@gnu.org>
Cc: 11059@debbugs.gnu.org
Subject: bug#11059: 24.0.94; Please add `face-spec-set' to the elisp manual
Date: Wed, 11 Apr 2012 19:05:28 +0200	[thread overview]
Message-ID: <86bomyyzaf.fsf@web.de> (raw)
In-Reply-To: <87k41mer74.fsf@gnu.org> (Chong Yidong's message of "Wed, 11 Apr 2012 14:08:15 +0800")

Hello Chong,

> Promoting the use of face-spec-set in third party code is probably not a
> good idea.  That function is pretty internal; its role is actually to
> apply the face spec, and it assumes that the caller has done some of the
> relevant bookkeeping in symbol properties like `face-defface-spec' and
> `saved-face', so that the Custom interface doesn't get confused.

Mmh, ok - then maybe we find a better solution.

> Could you give an example of why your code wants to redefine face
> specs?  In most cases, I suspect face remapping is the better
> solution.

In my case, face remapping is not an alternative.  What I want is, I
think, a quite common user wish: redefine faces in my .emacs.  For
example:

  (face-spec-set
   'stripes-face
   '((((background dark)) (:background "grey7"))
     (t                   (:background "#f0f0f0"))))
  
  (let ((sat-increment -65)
        (val-increment -35))
    (face-spec-set
     'rainbow-delimiters-depth-1-face
     `((((background dark)) (:foreground ,(icicle-increment-color-saturation "orange red" sat-increment)))
       (t (:foreground ,(icicle-increment-color-value "orange red" val-increment)))))
    (face-spec-set
     'rainbow-delimiters-depth-2-face
     `((((background dark)) (:foreground ,(icicle-increment-color-saturation "blue" sat-increment)))
       (t (:foreground ,(icicle-increment-color-value "blue" val-increment)))))
    ...)

I can't do this with face remapping, because it accepts only
attribute/value pairs as specification, but I want to completely
redefine it for different background modes etc.

> > And `custom-set-faces' is deprecated - at least, the custom file
> > warns to use it:
> >
> > ;; custom-set-faces was added by Custom.
> > ;; If you edit it by hand, you could mess it up, so be careful.
> > ;; Your init file should contain only one such instance.
> > ;; If there is more than one, they won't work right.
>
> This does not say that it is deprecated, only that it is meant to store
> the result of the user's use of the Custom interface.

I don't want to use Custom for this (I don't use it at all), since I
want to be able to calculate the face description in my .emacs.  Like in
the second example, where I want to be able to change the color without
the need to apply the washing of the color again (which is done with
`icicle-increment-color-saturation' and `icicle-increment-color-value').

I know that I _can_ use `custom-set-faces' explicitly in .emacs for this
purpose - that works.  But is this really the right function for users
to use in their .emacs to redefine faces?  If yes, the manual section
"Faces" should at least mention it.


Regards,

Michael.





  reply	other threads:[~2012-04-11 17:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-21 23:35 bug#11059: 24.0.94; Please add `face-spec-set' to the elisp manual Michael Heerdegen
2012-04-11  6:08 ` Chong Yidong
2012-04-11 17:05   ` Michael Heerdegen [this message]
2012-04-12  7:00     ` Chong Yidong
2012-04-12 13:10       ` Stefan Monnier
2012-04-12 14:17         ` Drew Adams
2012-04-12 15:13         ` Chong Yidong
2012-04-12 16:04           ` Stefan Monnier
2012-04-12 15:14       ` Chong Yidong

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=86bomyyzaf.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=11059@debbugs.gnu.org \
    --cc=cyd@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.