~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
1

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

Details
Message ID
<20220819181923.30566-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..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
Details
Message ID
<87lerjbpgs.fsf@protesilaos.com>
In-Reply-To
<20220819181923.30566-1-philipk@posteo.net> (view parent)
DKIM signature
missing
Download raw message
> From: Philip Kaludercic <philipk@posteo.net>
> Date: Fri, 19 Aug 2022 18:19:23 +0000
>
> 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(-)

Applied.  Thank you!

-- 
Protesilaos Stavrou
https://protesilaos.com
Reply to thread Export thread (mbox)