From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: irenezerafa Newsgroups: gmane.emacs.bugs Subject: bug#51715: defface forms not having dynamic value Date: Tue, 09 Nov 2021 15:36:43 +0000 Message-ID: References: <4r0LmHf2yOM8ZtFlkSfgFoHOVu-qI0dwHhAlsf2WxQbn_V5qvtb4t_c7teGE7DqtW8tlI0DRo9pMo0lVCbz33QZni6U0oaIHog5YxKecn80=@protonmail.com> <83ee7p5ujr.fsf@gnu.org> <83y25x4bne.fsf@gnu.org> Reply-To: irenezerafa Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11299"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51715@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 09 16:37:11 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 1mkTBP-0002lB-FC for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Nov 2021 16:37:11 +0100 Original-Received: from localhost ([::1]:48778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkTBO-0000Kr-1d for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Nov 2021 10:37:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkTBG-0000Ki-DD for bug-gnu-emacs@gnu.org; Tue, 09 Nov 2021 10:37:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52091) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mkTBG-0000Nu-4f for bug-gnu-emacs@gnu.org; Tue, 09 Nov 2021 10:37:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mkTBF-0003sp-Tm for bug-gnu-emacs@gnu.org; Tue, 09 Nov 2021 10:37:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: irenezerafa Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Nov 2021 15:37:01 +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.163647221714916 (code B ref 51715); Tue, 09 Nov 2021 15:37:01 +0000 Original-Received: (at 51715) by debbugs.gnu.org; 9 Nov 2021 15:36:57 +0000 Original-Received: from localhost ([127.0.0.1]:35404 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mkTBA-0003sV-VY for submit@debbugs.gnu.org; Tue, 09 Nov 2021 10:36:57 -0500 Original-Received: from mail-40138.protonmail.ch ([185.70.40.138]:62431) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mkTB8-0003sH-Fi for 51715@debbugs.gnu.org; Tue, 09 Nov 2021 10:36:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1636472207; bh=brbbR4dQHdLxWay+TIu02IL2E20RN3mDXKB9Md+zMnM=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=Ho95zQS1A822fq18//Al1+zSFSTORHPBaSXSFuLLgbzkmLzkLWxOHMah6llUh5nYz nmeEsOFGBeuh0DR+GhdMSa+/HSRBY4OHVzFOaXctMcrsv/ui5/nl1GSuCnOWHLep0l YNmygoPy3QdkcDKHDLsqMU1gcj1/THQjEnykgxT0= In-Reply-To: <83y25x4bne.fsf@gnu.org> 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:219465 Archived-At: =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 Original Me= ssage =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 On Tuesday, November 9th, 2021 at 3:00 PM, Eli Zaretskii wro= te: > > 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) (b= ackground light)) :foreground ,(aref light-colors i)) ) ,(format "Nested de= limiter 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) (b= ackground dark)) :foreground ,(nth i dark-colors)) ) ,(format "Nested delim= iter face, depth %d." (1+ i)) :group 'rainbow-delimiters-faces) faces))` (p= rogn ,@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? I would like to require modus-themes (and get the list of intense colours f= rem there as defined) if modus-themes is being used. Otherwise, get the rainbow-deli= miters package to set the face attributes directly (by hex values) using aref. One could have a flag before calling (require 'rainbow-delimiters), which t= he package could pick up. That could work at runtime. But not at compile time, a sit= uation that users are likely going to get (the compiled form) to install the package.