refactor(cli): doom make: accept functions in make targets

A little less magical (and more performant) than interpolation.
This commit is contained in:
Henrik Lissner
2025-09-15 16:43:52 -04:00
parent 15a0e90808
commit 5cfaf59402
2 changed files with 16 additions and 11 deletions

21
.doom
View File

@@ -27,7 +27,8 @@
(make (make
("LICENSE" ("LICENSE"
"The MIT License (MIT)\n" "The MIT License (MIT)\n"
,(format-time-string "Copyright (c) 2014-%Y Henrik Lissner.\n") ,(lambda (_)
(insert (format-time-string "Copyright (c) 2014-%Y Henrik Lissner.\n\n")))
"Permission is hereby granted, free of charge, to any person obtaining "Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the
\"Software\"), to deal in the Software without restriction, including \"Software\"), to deal in the Software without restriction, including
@@ -49,14 +50,16 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.")
"# Auto-generated by 'doom make .github/CODEOWNERS', do not edit it by hand.\n" "# Auto-generated by 'doom make .github/CODEOWNERS', do not edit it by hand.\n"
"* @doomemacs/maintainers\n" ; default until another takes precedence "* @doomemacs/maintainers\n" ; default until another takes precedence
"# Module maintainers" "# Module maintainers"
,@(cl-sort ,(lambda (rc)
(cl-loop for path in (doom-module-load-path (list doom-modules-dir)) (mapc (lambda (line) (insert line "\n"))
if (string-match "/modules/\\([^/]+\\)/\\([^/]+\\)$" path) (cl-sort
collect (format "%-35s @doomemacs/%s-%s" (cl-loop for path in (doom-module-load-path (list doom-modules-dir))
(substring (match-string 0 path) 1) if (string-match "/modules/\\([^/]+\\)/\\([^/]+\\)$" path)
(match-string 1 path) collect (format "%-35s @doomemacs/%s-%s"
(match-string 2 path))) (substring (match-string 0 path) 1)
#'string-lessp))) (match-string 1 path)
(match-string 2 path)))
#'string-lessp)))))
(publish (publish
(targets "docs/index.org" "docs" "modules/*/README.org") (targets "docs/index.org" "docs" "modules/*/README.org")

View File

@@ -34,8 +34,10 @@
(if (null rule) (if (null rule)
(print! (warn "No known make rule for: %s" name)) (print! (warn "No known make rule for: %s" name))
(dolist (entry rule) (dolist (entry rule)
(when (stringp entry) (cond ((stringp entry)
(insert entry "\n"))) (insert entry "\n"))
((functionp entry)
(funcall entry rc))))
(if (null outfile) (if (null outfile)
(print! "%s" (buffer-string)) (print! "%s" (buffer-string))
(print! (start "Wrote %s") name) (print! (start "Wrote %s") name)