unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: fatiparty--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: Fatiparty <fatiparty@tutanota.com>
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Computing value from list lengths
Date: Fri, 21 Jan 2022 14:56:40 +0100 (CET)	[thread overview]
Message-ID: <MtwvBfP--7-2@tutanota.com> (raw)
In-Reply-To: <MtwZuNw--3-2@tutanota.com-Mtw_GyL----2>

Jan 22, 2022, 00:19 by help-gnu-emacs@gnu.org:

> I have the following code and want to determine maxdepth
> automatically from the length of the dark-theme-colours and
> light-theme-colours (and changing the ahrd coded (dotimes (i 8)).
>
> What would be the strategy?
>
>
> (defcustom maxdepth 8
>   "Number of faces defined for colouring brace marks.
> Determines depth at which to cycle through faces again."
>   :type 'integer
>   :group 'test)
> (eval-when-compile
>   (defmacro colour-typeface ()
>
>     ( let ( (faces '())
>             (dark-theme-colours
>              [ "#ff62d4" "#3fdfd0" "#fba849" "#9f80ff"
>            "#4fe42f" "#fe6060" "#4fafff" "#f0dd60" ])
>         (light-theme-colours
>              [ "#a8007f" "#005f88" "#904200" "#7f10d0"
>            "#006800" "#b60000" "#1f1fce" "#605b00" ]) )
>
>       (dotimes (i 8)
>         (push
>          `( defface ,(intern (format "depth-%d-face" (1+ i)))
>             '( (default (:inherit richerenkov-base-face))
>                ( ((class color) (background dark))
>                  :foreground ,(aref dark-theme-colours  i) )
>                ( ((class color) (background light))
>                  :foreground ,(aref light-theme-colours i) ))
>             ,(format "Nested delimiter face, depth %d." (1+ i) )
>             :group 'colour-faces )
>          faces))
>
>       `(progn ,@faces) ) ))
>
> (colour-typeface)
>
Have started using (length dark-theme-colours), and changing "(dotimes (i 8)" to   
 "(dotimes (i n)".  How does one set the value to n, for o defcustom  such as maxdepth?




  parent reply	other threads:[~2022-01-21 13:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 12:19 Computing value from list lengths fatiparty--- via Users list for the GNU Emacs text editor
2022-01-21 12:27 ` Emanuel Berg via Users list for the GNU Emacs text editor
     [not found] ` <MtwZuNw--3-2@tutanota.com-Mtw_GyL----2>
2022-01-21 13:56   ` fatiparty--- via Users list for the GNU Emacs text editor [this message]
2022-01-21 15:36     ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-21 16:26       ` fatiparty--- via Users list for the GNU Emacs text editor
2022-01-21 20:50         ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-23  3:29           ` fatiparty--- via Users list for the GNU Emacs text editor

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=MtwvBfP--7-2@tutanota.com \
    --to=help-gnu-emacs@gnu.org \
    --cc=fatiparty@tutanota.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.
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).