confpkg: support custom package prefix

This commit is contained in:
TEC 2022-09-22 00:54:58 +08:00
parent 885dd55690
commit 0d6d13a6b1
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 7 additions and 6 deletions

View File

@ -481,12 +481,13 @@ modify the parent heading, and register the config group with the variables we
created earlier.
#+name: confpkg
#+begin_src elisp :var name="" needs="" after="" :results silent raw :noweb no-export
#+begin_src elisp :var name="" needs="" after="" prefix="config-" :results silent raw :noweb no-export
;; Babel block for use with #+call
;; Arguments:
;; + name, the name of the config sub-package
;; + needs, (when non-empty) required system executable(s)
;; + after, required features
;; - name, the name of the config sub-package
;; - needs, (when non-empty) required system executable(s)
;; - after, required features
;; - prefix, the package prefix ("config-" by default)
(when (or (string-empty-p needs)
(cl-every #'executable-find (delq nil (split-string needs ","))))
(let* ((name (if (string-empty-p name)
@ -503,8 +504,8 @@ created earlier.
(intern after)) ; Single feature.
(t after)))
(confpkg-name
(concat "config-" (replace-regexp-in-string
"[^a-z-]" "-" (downcase name))))
(concat prefix (replace-regexp-in-string
"[^a-z-]" "-" (downcase name))))
(confpkg-file (expand-file-name (concat confpkg-name ".el")
"subconf")))
(unless (file-exists-p confpkg-file)