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.