0

I want use a macro to generate a package list.

(defvar xx-packages '())

(genpack evil)
(genpack all-the-icons-ivy-rich
   :recipe (:host github :repo "seagle0128/all-the-icons-ivy-rich"))

this macro genpack will append argument to xx-packages,then xx-packages value is

xx-packages '((evil)
              (all-the-icons-ivy-rich
                   :recipe (:host github :repo "seagle0128/all-the-icons-ivy-rich"))

How can i write this macro genpack, thanks

1

Like this?

(defmacro genpack (&rest args)
  "Append ARGS to `xx-packages'."
  `(setq xx-packages (nconc xx-packages '(,args))))
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.