diff options
author | jdlugosz963 <jdlugosz963@gmail.com> | 2024-05-08 19:45:01 +0200 |
---|---|---|
committer | jdlugosz963 <jdlugosz963@gmail.com> | 2024-05-08 19:45:01 +0200 |
commit | 5ee161953a899d4026a698d2ee027e32a28e190f (patch) | |
tree | c546f39ee662dd1b76c05869080321b75eb59a50 /.emacs.d/init.el | |
parent | 06e0a80f7b509fc2a565aff9ec8311caf4bf6aae (diff) | |
download | dotfiles-5ee161953a899d4026a698d2ee027e32a28e190f.tar.gz dotfiles-5ee161953a899d4026a698d2ee027e32a28e190f.zip |
Delete use-package! and add :guix-package keyword instead.
Diffstat (limited to '.emacs.d/init.el')
-rwxr-xr-x | .emacs.d/init.el | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index d9183a1..090592f 100755 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el | |||
@@ -86,31 +86,41 @@ | |||
86 | 86 | ||
87 | (setq use-package-always-ensure (not jd/guix-p)) | 87 | (setq use-package-always-ensure (not jd/guix-p)) |
88 | 88 | ||
89 | (defmacro use-package! (package-name | 89 | (defun jd/generate-manifest () |
90 | guix-package-name | 90 | "Generate GNU/Guix Emacs manifest to temp-buffer." |
91 | &rest body) | 91 | (interactive) |
92 | (declare (indent defun)) | 92 | (with-output-to-temp-buffer "*guix-emacs-packages-manifest.scm*" |
93 | `(progn | 93 | (princ (concat ";; This file is auto-generated by Emacs " |
94 | ,(when guix-package-name | 94 | "function: jd/manifest-generate-to-file \n")) |
95 | `(jd/add-package-to-manifest ,guix-package-name)) | 95 | (princ `(specifications->manifest |
96 | (use-package ,package-name ,@body))) | 96 | '(,@(mapcar #'(lambda (guix-package-name) |
97 | 97 | (concat "\"" | |
98 | (defun jd/manifest-generate-to-file (file-name) | 98 | guix-package-name |
99 | "Generate GNU/Guix Emacs manifest to output file provided in: FILE-NAME." | 99 | "\"\n")) |
100 | (interactive | 100 | jd/manifest-list)))))) |
101 | (list (read-from-minibuffer "Output file: " ))) | 101 | |
102 | (with-temp-file file-name | 102 | (defun use-package-normalize/:guix-package (name keyword args) |
103 | (insert | 103 | (use-package-as-one (symbol-name keyword) args |
104 | (with-temp-buffer | 104 | #'(lambda (_label arg) |
105 | (insert (format ";; This file is auto-generated by Emacs function: jd/manifest-generate-to-file\n%s" | 105 | (cond |
106 | `(specifications->manifest | 106 | ((consp arg) arg) |
107 | '(,@(mapcar #'(lambda (guix-package-name) | 107 | ((stringp arg) (list arg)) |
108 | (concat "\"" | 108 | ((use-package-non-nil-symbolp arg) (symbol-name arg)) |
109 | guix-package-name | 109 | (t |
110 | "\"\n")) | 110 | (use-package-error |
111 | jd/manifest-list))))) | 111 | ":pin wants an archive name (a string)")))))) |
112 | (pp-buffer) | 112 | |
113 | (buffer-string))))) | 113 | (defun use-package-handler/:guix-package |
114 | (name _keyword args rest state) | ||
115 | (let ((body (use-package-process-keywords name rest state))) | ||
116 | (use-package-concat | ||
117 | (when (consp args) | ||
118 | (mapcar #'(lambda (arg) | ||
119 | `(jd/add-package-to-manifest ,arg)) | ||
120 | args)) | ||
121 | body))) | ||
122 | |||
123 | (add-to-list 'use-package-keywords ':guix-package) | ||
114 | 124 | ||
115 | (jd/add-package-to-manifest "emacs") | 125 | (jd/add-package-to-manifest "emacs") |
116 | (jd/add-package-to-manifest "emacs-guix") | 126 | (jd/add-package-to-manifest "emacs-guix") |