~protesilaos/ef-themes

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH] Replace 'ef-themes--height' with a dotimes

Details
Message ID
<20220819180516.28847-1-philipk@posteo.net>
DKIM signature
missing
Download raw message
Patch: +5 -17
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..788e23d 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)
  (defface
    (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
Reply to thread Export thread (mbox)