unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Computing value from list lengths
@ 2022-01-21 12:19 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>
  0 siblings, 2 replies; 7+ messages in thread
From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-21 12:19 UTC (permalink / raw)
  To: Help Gnu Emacs

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)





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Computing value from list lengths
  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>
  1 sibling, 0 replies; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-01-21 12:27 UTC (permalink / raw)
  To: help-gnu-emacs

fatiparty--- via Users list for the GNU Emacs text editor wrote:

> 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?

Learn the basics, then progress to crazy stuff ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Computing value from list lengths
       [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
  2022-01-21 15:36     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 7+ messages in thread
From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-21 13:56 UTC (permalink / raw)
  To: Fatiparty; +Cc: Help Gnu Emacs

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?




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Computing value from list lengths
  2022-01-21 13:56   ` fatiparty--- via Users list for the GNU Emacs text editor
@ 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
  0 siblings, 1 reply; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-01-21 15:36 UTC (permalink / raw)
  To: help-gnu-emacs

fatiparty--- via Users list for the GNU Emacs text editor wrote:

> 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?

Please get and read this book, "THE ABC OF PROGRAMMING", by
A F Ivanovich, Moskow 1962, before you proceed to macros and
the like ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Computing value from list lengths
  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
  0 siblings, 1 reply; 7+ messages in thread
From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-21 16:26 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: Help Gnu Emacs


Jan 22, 2022, 03:36 by help-gnu-emacs@gnu.org:

> fatiparty--- via Users list for the GNU Emacs text editor wrote:
>
>> 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?
>>
>
> Please get and read this book, "THE ABC OF PROGRAMMING", by
> A F Ivanovich, Moskow 1962, before you proceed to macros and
> the like ...
>

The thing I found has been "The ABC of Communism" !


> -- 
> underground experts united
> https://dataswamp.org/~incal
>




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Computing value from list lengths
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-01-21 20:50 UTC (permalink / raw)
  To: help-gnu-emacs

fatiparty--- via Users list for the GNU Emacs text editor wrote:

>>> 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?
>>
>> Please get and read this book, "THE ABC OF PROGRAMMING", by
>> A F Ivanovich, Moskow 1962, before you proceed to macros
>> and the like ...
>
> The thing I found has been "The ABC of Communism" !

Yeah, by Nikolai Bukharin. Shot in 1938. They were taking
programming too too seriously.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Computing value from list lengths
  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
  0 siblings, 0 replies; 7+ messages in thread
From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-23  3:29 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: Help Gnu Emacs

Jan 22, 2022, 08:50 by help-gnu-emacs@gnu.org:

> fatiparty--- via Users list for the GNU Emacs text editor wrote:
>
>>>> 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?
>>>>
>>>
>>> Please get and read this book, "THE ABC OF PROGRAMMING", by
>>> A F Ivanovich, Moskow 1962, before you proceed to macros
>>> and the like ...
>>>
>>
>> The thing I found has been "The ABC of Communism" !
>>
>
> Yeah, by Nikolai Bukharin. Shot in 1938. They were taking
> programming too too seriously.
>

You want to shoot me?


> -- 
> underground experts united
> https://dataswamp.org/~incal
>




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-23  3:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).