* Define list of packages in ~/.emacs.d/init.el
@ 2017-11-28 14:48 Stephan Brauer
2017-11-28 17:13 ` Dan Čermák
2017-11-30 1:47 ` Alexis
0 siblings, 2 replies; 6+ messages in thread
From: Stephan Brauer @ 2017-11-28 14:48 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
disclaimer: I'm (obviously) new to emacs.
I've been searching for a way to define a list of packages that I wan't
to have installed and then have them installed or updated whenever emacs
is started. I think this way I can easily put my init.el into version
control and on every system I use for emacs just deploy that file and
emacs does the rest.
Does someone here know about a way to do that?
I'm using `GNU Emacs 24.5.1`.
Thanks!
Stephan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Define list of packages in ~/.emacs.d/init.el
2017-11-28 14:48 Define list of packages in ~/.emacs.d/init.el Stephan Brauer
@ 2017-11-28 17:13 ` Dan Čermák
2017-11-29 22:15 ` Stefan Monnier
2017-11-30 1:47 ` Alexis
1 sibling, 1 reply; 6+ messages in thread
From: Dan Čermák @ 2017-11-28 17:13 UTC (permalink / raw)
To: help-gnu-emacs
Hi Stephan,
I am doing exactly what you are describing using this snippet:
;;
;; Auto-install not yet installed packages
;;
(require 'cl)
(defvar required-packages
'(auctex
yasnippet)
"a list of packages to ensure are installed at launch.")
; 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))))
I have basically copy-pasted this from elisp snippets that I found
around the web, so please don't ask me hard questions ;-)
If you want to auto-install packages, add them to the required-packages
list and voila, you are done.
I have used it in this form in Emacs 24. As Emacs 25 automatically
stores a list of installed packages in the variable
package-selected-packages, you can also use that list instead of the
custom required-packages once you upgrade to Emacs > 24.
Cheers,
Dan
Stephan Brauer <stephan@ls42.de> writes:
> Hi,
>
> disclaimer: I'm (obviously) new to emacs.
>
> I've been searching for a way to define a list of packages that I wan't
> to have installed and then have them installed or updated whenever emacs
> is started. I think this way I can easily put my init.el into version
> control and on every system I use for emacs just deploy that file and
> emacs does the rest.
>
> Does someone here know about a way to do that?
>
> I'm using `GNU Emacs 24.5.1`.
>
> Thanks!
>
> Stephan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Define list of packages in ~/.emacs.d/init.el
2017-11-28 17:13 ` Dan Čermák
@ 2017-11-29 22:15 ` Stefan Monnier
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2017-11-29 22:15 UTC (permalink / raw)
To: help-gnu-emacs
> (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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Define list of packages in ~/.emacs.d/init.el
2017-11-28 14:48 Define list of packages in ~/.emacs.d/init.el Stephan Brauer
2017-11-28 17:13 ` Dan Čermák
@ 2017-11-30 1:47 ` Alexis
2017-11-30 2:20 ` Emanuel Berg
2017-11-30 8:27 ` Stephan Brauer
1 sibling, 2 replies; 6+ messages in thread
From: Alexis @ 2017-11-30 1:47 UTC (permalink / raw)
To: Stephan Brauer; +Cc: help-gnu-emacs
Stephan Brauer <stephan@ls42.de> writes:
> I've been searching for a way to define a list of packages that
> I
> wan't to have installed and then have them installed or updated
> whenever emacs is started. I think this way I can easily put my
> init.el into version control and on every system I use for emacs
> just
> deploy that file and emacs does the rest.
>
> Does someone here know about a way to do that?
i don't use it myself, but i know many people use John Wiegley's
`use-package`:
https://github.com/jwiegley/use-package
Alexis.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Define list of packages in ~/.emacs.d/init.el
2017-11-30 1:47 ` Alexis
@ 2017-11-30 2:20 ` Emanuel Berg
2017-11-30 8:27 ` Stephan Brauer
1 sibling, 0 replies; 6+ messages in thread
From: Emanuel Berg @ 2017-11-30 2:20 UTC (permalink / raw)
To: help-gnu-emacs
Alexis wrote:
> i don't use it myself, but i know many people
> use John Wiegley's `use-package`
C'mon now lad, it is better to come clean.
If you admit it, we won't beat you up!
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Define list of packages in ~/.emacs.d/init.el
2017-11-30 1:47 ` Alexis
2017-11-30 2:20 ` Emanuel Berg
@ 2017-11-30 8:27 ` Stephan Brauer
1 sibling, 0 replies; 6+ messages in thread
From: Stephan Brauer @ 2017-11-30 8:27 UTC (permalink / raw)
To: Alexis; +Cc: help-gnu-emacs
Hi Alexis,
yes, that's what I'm using now, someone else recommended it to me. It's
exactly what I want. Thank you.
Stephan
On Thu, Nov 30, 2017 at 12:47:30PM +1100, Alexis wrote:
>
> Stephan Brauer <stephan@ls42.de> writes:
>
> > I've been searching for a way to define a list of packages that I
> > wan't to have installed and then have them installed or updated
> > whenever emacs is started. I think this way I can easily put my
> > init.el into version control and on every system I use for emacs just
> > deploy that file and emacs does the rest.
> >
> > Does someone here know about a way to do that?
>
> i don't use it myself, but i know many people use John Wiegley's
> `use-package`:
>
> https://github.com/jwiegley/use-package
>
>
> Alexis.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-30 8:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-28 14:48 Define list of packages in ~/.emacs.d/init.el Stephan Brauer
2017-11-28 17:13 ` Dan Čermák
2017-11-29 22:15 ` Stefan Monnier
2017-11-30 1:47 ` Alexis
2017-11-30 2:20 ` Emanuel Berg
2017-11-30 8:27 ` Stephan Brauer
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.