~protesilaos/ef-themes

Replace 'ef-themes--height' with a dotimes v2 APPLIED

Philip Kaludercic: 1
 Replace 'ef-themes--height' with a dotimes

 1 files changed, 5 insertions(+), 17 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~protesilaos/ef-themes/patches/34791/mbox | git am -3
Learn more about email & git

[PATCH v2] Replace 'ef-themes--height' with a dotimes Export this patch

As the macro is not used anywhere else, we can replace the explicit
repetition with a macro that invokes the result of
'ef-themes--height's macro-expansion.
---
 ef-themes.el | 22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/ef-themes.el b/ef-themes.el
index dcaa7d6..c9df241 100644
--- a/ef-themes.el
+++ b/ef-themes.el
@@ -443,23 +443,11 @@ Helper function for `ef-themes-preview-colors'."
  :tag "Ef Themes Faces")

;; This produces `ef-themes-height-0' and the like.
(defmacro ef-themes--height (n)
  "Write `defface' for height level N."
  `(defface ,(intern (format "ef-themes-heading-%s" n)) nil
     ,(format "Used for level %s heading." n)
     :group 'ef-themes-faces))

;; FIXME 2022-08-18: Why won't `dotimes' work with the macro?  (dotimes
;; (n 8) ...) does not interpret the n as a number.
(ef-themes--height 0)
(ef-themes--height 1)
(ef-themes--height 2)
(ef-themes--height 3)
(ef-themes--height 4)
(ef-themes--height 5)
(ef-themes--height 6)
(ef-themes--height 7)
(ef-themes--height 8)
(dotimes (n 8)
  (custom-declare-face
    (intern (format "ef-themes-heading-%d" n))
    nil (format "Used for level %d heading." n)
    :group 'ef-themes-faces))

(defconst ef-themes-faces
  '(
-- 
2.37.2
Applied.  Thank you!