help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Define list of packages in ~/.emacs.d/init.el


From: Stefan Monnier
Subject: Re: Define list of packages in ~/.emacs.d/init.el
Date: Wed, 29 Nov 2017 17:15:09 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> (defvar required-packages
>   '(auctex
>     yasnippet)
>   "a list of packages to ensure are installed at launch.")

Recent Emacsen use the variable `package-selected-packages` for that.

> ; method to check if all packages are installed
> (defun packages-installed-p ()
>   (loop for p in required-packages
>         when (not (package-installed-p p)) do (return nil)
>         finally (return t)))

> ; if not all packages are installed, check one by one and install the missing 
> ones.
> (unless (packages-installed-p)
>   ; check for new packages (package versions)
>   (message "%s" "Emacs is now refreshing its package database...")
>   (package-refresh-contents)
>   (message "%s" " done.")
>   ; install the missing packages
>   (dolist (p required-packages)
>     (when (not (package-installed-p p))
>       (package-install p))))

AFAIK current Emacsen do not provide this functionality.  I'm opposed to
having such a thing fully automatic (because Emacs shouldn't initiate
a connection to the internet without some explicit user request), but
since many users seem to actively want such a misfeature, I think Emacs
should probably offer this functionality (disabled by default, and with
a suitable warning on the label).

So, I suggest you `M-x report-emacs-bug` and request this
optional functionality.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]