From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dan =?utf-8?B?xIxlcm3DoWs=?= Newsgroups: gmane.emacs.help Subject: Re: Define list of packages in ~/.emacs.d/init.el Date: Tue, 28 Nov 2017 18:13:38 +0100 Message-ID: <87k1ya9vi5.fsf@cgc-instruments.com> References: <20171128144816.nikq2gj2dljgdnpc@atuin.ls42.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1511889259 3259 195.159.176.226 (28 Nov 2017 17:14:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 28 Nov 2017 17:14:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 28 18:14:15 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eJjSX-0000OE-2X for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Nov 2017 18:14:13 +0100 Original-Received: from localhost ([::1]:39173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eJjSe-0000KL-Bm for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Nov 2017 12:14:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eJjSC-0000K4-Ma for help-gnu-emacs@gnu.org; Tue, 28 Nov 2017 12:13:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eJjS9-00055Y-GP for help-gnu-emacs@gnu.org; Tue, 28 Nov 2017 12:13:52 -0500 Original-Received: from cgc-instruments.com ([83.169.1.125]:51651) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eJjS9-00055E-Ai for help-gnu-emacs@gnu.org; Tue, 28 Nov 2017 12:13:49 -0500 Original-Received: from Eclipse.local (p578FE4F8.dip0.t-ipconnect.de [87.143.228.248]) by cgc-instruments.com (Postfix) with ESMTPSA id D7D34A11EB for ; Tue, 28 Nov 2017 18:13:42 +0100 (CET) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=cgc-instruments.com; b=ihc51zp2vDesXojuo8i0vqsLrzRO+QOrZWdbZ6LR59oAaOPDQxiLVXUwn69+RMFvlbbaZKOFn10OtPdeF8ZRxNu2nT/OETf0jpubOxH+tnwZwriB1k+cn92TqYZ5AgGI43khIe9wMoyMTAD2AcXxE6JRwwR24TTuqYdAxFEuRFo=; h=From:To:Subject:In-Reply-To:References:Date:Message-ID:MIME-Version:Content-Type; In-Reply-To: <20171128144816.nikq2gj2dljgdnpc@atuin.ls42.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 83.169.1.125 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:115127 Archived-At: 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 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