From 5ee161953a899d4026a698d2ee027e32a28e190f Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Wed, 8 May 2024 19:45:01 +0200 Subject: Delete use-package! and add :guix-package keyword instead. --- .emacs.d/init.el | 60 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 25 deletions(-) (limited to '.emacs.d/init.el') 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 @@ (setq use-package-always-ensure (not jd/guix-p)) -(defmacro use-package! (package-name - guix-package-name - &rest body) - (declare (indent defun)) - `(progn - ,(when guix-package-name - `(jd/add-package-to-manifest ,guix-package-name)) - (use-package ,package-name ,@body))) - -(defun jd/manifest-generate-to-file (file-name) - "Generate GNU/Guix Emacs manifest to output file provided in: FILE-NAME." - (interactive - (list (read-from-minibuffer "Output file: " ))) - (with-temp-file file-name - (insert - (with-temp-buffer - (insert (format ";; This file is auto-generated by Emacs function: jd/manifest-generate-to-file\n%s" - `(specifications->manifest - '(,@(mapcar #'(lambda (guix-package-name) - (concat "\"" - guix-package-name - "\"\n")) - jd/manifest-list))))) - (pp-buffer) - (buffer-string))))) +(defun jd/generate-manifest () + "Generate GNU/Guix Emacs manifest to temp-buffer." + (interactive) + (with-output-to-temp-buffer "*guix-emacs-packages-manifest.scm*" + (princ (concat ";; This file is auto-generated by Emacs " + "function: jd/manifest-generate-to-file \n")) + (princ `(specifications->manifest + '(,@(mapcar #'(lambda (guix-package-name) + (concat "\"" + guix-package-name + "\"\n")) + jd/manifest-list)))))) + +(defun use-package-normalize/:guix-package (name keyword args) + (use-package-as-one (symbol-name keyword) args + #'(lambda (_label arg) + (cond + ((consp arg) arg) + ((stringp arg) (list arg)) + ((use-package-non-nil-symbolp arg) (symbol-name arg)) + (t + (use-package-error + ":pin wants an archive name (a string)")))))) + +(defun use-package-handler/:guix-package + (name _keyword args rest state) + (let ((body (use-package-process-keywords name rest state))) + (use-package-concat + (when (consp args) + (mapcar #'(lambda (arg) + `(jd/add-package-to-manifest ,arg)) + args)) + body))) + +(add-to-list 'use-package-keywords ':guix-package) (jd/add-package-to-manifest "emacs") (jd/add-package-to-manifest "emacs-guix") -- cgit v1.2.3