How to automatically install Emacs packages by specifying a list of package names?

后端 未结 11 2493
隐瞒了意图╮
隐瞒了意图╮ 2020-12-22 15:22

I am using package to manage my Emacs extensions. In order to synchronize my Emacs settings on different computers, I\'d like a way to specify a list of package

11条回答
  •  时光说笑
    2020-12-22 15:58

    Emacs 25.1+ will automatically keep track of user-installed packages in the customizable package-selected-packages variable. package-install will update the customize variable, and you can install all selected packages with the package-install-selected-packages function.

    Another convenient advantage of this approach is that you can use package-autoremove to automatically remove packages that are not included in package-selected-packages (though it will preserve dependencies).

    (package-initialize)
    (unless package-archive-contents
      (package-refresh-contents))
    (package-install-selected-packages)
    

    Source: http://endlessparentheses.com/new-in-package-el-in-emacs-25-1-user-selected-packages.html

提交回复
热议问题