From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#51715: defface forms not having dynamic value Date: Tue, 09 Nov 2021 17:00:21 +0200 Message-ID: <83y25x4bne.fsf@gnu.org> References: <4r0LmHf2yOM8ZtFlkSfgFoHOVu-qI0dwHhAlsf2WxQbn_V5qvtb4t_c7teGE7DqtW8tlI0DRo9pMo0lVCbz33QZni6U0oaIHog5YxKecn80=@protonmail.com> <83ee7p5ujr.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29650"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51715@debbugs.gnu.org To: irenezerafa Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 09 16:01:44 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mkSd5-0007PY-6l for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Nov 2021 16:01:43 +0100 Original-Received: from localhost ([::1]:59302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkSd2-0003DL-Od for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Nov 2021 10:01:41 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkScQ-0003BG-CY for bug-gnu-emacs@gnu.org; Tue, 09 Nov 2021 10:01:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52024) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mkScQ-0007Ru-4Y for bug-gnu-emacs@gnu.org; Tue, 09 Nov 2021 10:01:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mkScQ-0002ug-3Y for bug-gnu-emacs@gnu.org; Tue, 09 Nov 2021 10:01:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Nov 2021 15:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51715 X-GNU-PR-Package: emacs Original-Received: via spool by 51715-submit@debbugs.gnu.org id=B51715.163647004111127 (code B ref 51715); Tue, 09 Nov 2021 15:01:02 +0000 Original-Received: (at 51715) by debbugs.gnu.org; 9 Nov 2021 15:00:41 +0000 Original-Received: from localhost ([127.0.0.1]:35327 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mkSc4-0002tL-0B for submit@debbugs.gnu.org; Tue, 09 Nov 2021 10:00:41 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49492) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mkSbz-0002sy-4o for 51715@debbugs.gnu.org; Tue, 09 Nov 2021 10:00:39 -0500 Original-Received: from [2001:470:142:3::e] (port=43364 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkSbt-0007Kw-RY; Tue, 09 Nov 2021 10:00:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Efbr++xIDRjX4Y2ZRlExOliIBMy12vOChOZvyPAtszU=; b=fdqjlGmn20Qm 17+fQpvesu9u7o8tjVCE76STR+cn2JPCGrSLxmnPparzn2Pf5lrhIig9xuaZBzo6Hd06IB1KkFwdd iJ0Z+bK7VRElEAwf8Yl6J575Pm06VxKupbEUvkC1z1vbAr6Amo86mD0XFcumLjeAdCyDw2DN3HLJj 7bnCzhrb0qJZYWp0/R/yprkXmq4srPkDCHiVcK0tt8oXYl8wlGszVkfa3Fimj11UzYJ+9u/s6KdVI i5/gwEvtDsXW1cSBwfijcR9CNDRdqTDuUYdimG8Vcqj7sCFZKe38hAHHJJIZGoC2tPsRWgffXJ5ZX m4Y94mJD8GUxkfC/dfIRHg==; Original-Received: from [87.69.77.57] (port=3505 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkSbt-0001xO-BC; Tue, 09 Nov 2021 10:00:29 -0500 In-Reply-To: (message from irenezerafa on Tue, 09 Nov 2021 14:17:03 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:219464 Archived-At: > Date: Tue, 09 Nov 2021 14:17:03 +0000 > From: irenezerafa > 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?