I asked How can I script emacs to install packages from list? and got this answer.
(setq package-selected-packages
'(async
epl
evil
goto-chg
helm
helm-ag
helm-core
helm-descbinds
helm-projectile
pkg-info
popup
projectile
undo-tree))
(package-install-selected-packages)
When I inspect the value of the variable package-activated-list
in my installation the output is (evil goto-chg undo-tree goto-chg helm-ag helm helm-core async popup async helm-descbinds helm helm-core async popup async helm-projectile
projectile pkg-info epl helm helm-core async popup async popup projectile pkg-info epl undo-tree)
How could I insert the literal output of package-activated-list
into the buffer, after the quote. ie generate the script
(setq package-selected-packages
'
;;<<list of `package-activated-list` goes here >>
)
(package-install-selected-packages)
It would be better with duplicates removed and sorted, but those are secondary issues.
(setq package-selected-packages '(async … undo-tree))
, right? Do you want to generate just this snippet or a function? If a function, what arguments should it take? And most importantly, what input does the generator take?setq(...
with a placeholder for whatever variable is involved, which ispackage-activated-list
and a function to deduplicate and sort its output.(setq package-selected-packages package-activated-list)
won't work for duplicatingpackage-activated-list
from one instance of emacs to the init file for setting up emacs on a different machine (as explained in the linked-to question).