unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: irenezerafa <irenezerafa@protonmail.com>
Cc: 51715@debbugs.gnu.org
Subject: bug#51715: defface forms not having dynamic value
Date: Tue, 09 Nov 2021 17:00:21 +0200	[thread overview]
Message-ID: <83y25x4bne.fsf@gnu.org> (raw)
In-Reply-To: <j7KTuqS3DmrU8b5-rLOTabjgg4x1htJLRAyKSHpCw1v1vSI_jBv20yqiw7O_qgzzUo7wK2hE0PmpVSW21zzapynvyFwySMqSlDct4JG_l9c=@protonmail.com> (message from irenezerafa on Tue, 09 Nov 2021 14:17:03 +0000)

> Date: Tue, 09 Nov 2021 14:17:03 +0000
> From: irenezerafa <irenezerafa@protonmail.com>
> Cc: 51715@debbugs.gnu.org
> >
> > Please tell more. Which face attributes did you want to make dynamic,
> > and how?
> 
> I take rainbow-delimiters as example.  Specifically, the
> 
> (eval-when-compile
>   (defmacro rainbow-delimiters--define-depth-faces ()
>     (let ( (faces '())
>            (dark-colors  [ "#ff62d4"  "#3fdfd0"  "#fba849"  "#9f80ff"
>             "#4fe42f"  "#fe6060"  "#4fafff"  "#f0dd60" "#ffffff" ])
> 	   (light-colors [ "#a8007f"  "#005f88"  "#904200"  "#7f10d0"
>             "#006800"  "#b60000"  "#1f1fce"  "#605b00" "#000000"]) )
>       (dotimes (i 9)
>         (push `( defface ,(intern (format "rainbow-delimiters-depth-%d-face" (1+ i)))
> 		 '( (default (:inherit rainbow-delimiters-base-face))
>                     ( ((class color) (background dark))
> 		      :foreground ,(aref dark-colors  i))
> 		    ( ((class color) (background light))
> 		      :foreground ,(aref light-colors i)) )
>                  ,(format "Nested delimiter face, depth %d." (1+ i))
>                  :group 'rainbow-delimiters-faces )
> 	      faces))
>       `(progn ,@faces)) ))
> 
> (rainbow-delimiters--define-depth-faces)
> 
> Now, suppose I want to use a colour scheme from modus-themes.
> 
> (require 'modus-themes)
> 
> (eval-when-compile
>   (defmacro rainbow-delimiters--define-depth-faces ()
>     (let ( (faces '())
>            (dark-colors (rainbow-delimiters-modus-vivendi-intense-colours
> 			 (list magenta-intense cyan-intense orange-intense
> 			       purple-intense green-intense red-intense
> 			       blue-intense yellow-intense fg-main)))
>            (light-colors (rainbow-delimiters-modus-operandi-intense-colours
>                           (list magenta-intense cyan-intense orange-intense
> 				purple-intense green-intense red-intense
> 				blue-intense yellow-intense fg-main))) )
>       (dotimes (i 9)
> 	(push `(defface ,(intern (format "rainbow-delimiters-depth-%d-face" (1+ i)))
> 		 '( (default (:inherit rainbow-delimiters-base-face))
>                     ( ((class color) (background light))
> 		      :foreground ,(nth i light-colors))
>                     ( ((class color) (background dark))
> 		      :foreground ,(nth i dark-colors)) )
> 		 ,(format "Nested delimiter face, depth %d." (1+ i))
> 		 :group 'rainbow-delimiters-faces)
>               faces))
>       `(progn ,@faces)) ))
> 
> This would not be workable in practice.  Because the dependency only
> matters when your macro is being evaluated and the faces are reified.
> Since you have a package, that will be the moment the package gets
> required. So you are making it a dependency for everyone.

I'm still not sure I get this.  You want to be able to control the
colors of a face indirectly, by changing some variable which the face
references?  If not, what do you mean by "the dependency"?

IOW, what is it that you want to be able to do that isn't possible by
calling set-face-attribute?





  reply	other threads:[~2021-11-09 15:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 11:41 bug#51715: defface forms not having dynamic value irenezerafa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-09 13:26 ` Eli Zaretskii
2021-11-09 14:17   ` irenezerafa
2021-11-09 15:00     ` Eli Zaretskii [this message]
2021-11-09 15:36       ` irenezerafa
2021-11-09 15:40       ` irenezerafa
2021-11-10  0:36     ` Lars Ingebrigtsen
2021-11-10 15:08       ` Stefan Kangas
2021-11-10 16:48         ` Eli Zaretskii
2021-11-14  2:28           ` Lars Ingebrigtsen

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=83y25x4bne.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=51715@debbugs.gnu.org \
    --cc=irenezerafa@protonmail.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).