diff --git a/module2/ressources/rr_org/init.el b/module2/ressources/rr_org/init.el index 62d3b1601facdfd913ebf18a457fc2f070e54d4f..eb85ea4c21062b600496b2ece241799149663695 100644 --- a/module2/ressources/rr_org/init.el +++ b/module2/ressources/rr_org/init.el @@ -57,16 +57,21 @@ '("melpa-stable" . "http://stable.melpa.org/packages/")) (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) -(package-refresh-contents) (setq package-archive-priorities '(("gnu" . 100) ("melpa-stable" . 10))) -(dolist (pkg '(ess - auctex - htmlize - exec-path-from-shell)) - (when (not (package-installed-p pkg)) - (package-install pkg))) +(let* ((required-packages + '(ess + auctex + htmlize + exec-path-from-shell)) + (missing-packages (remove-if #'package-installed-p required-packages))) + (when missing-packages + (message "Missing packages: %s" missing-packages) + (package-refresh-contents) + (dolist (pkg missing-packages) + (package-install pkg) + (message "Package %s has been installed" pkg)))) (unless (memq system-type '(windows-nt ms-dos)) (exec-path-from-shell-initialize) diff --git a/module2/ressources/rr_org/init.org b/module2/ressources/rr_org/init.org index ed908912351261b86bf1acca291e761feb851b7e..0df6ec78642646c9c8c25791b3cbb41f889966f6 100644 --- a/module2/ressources/rr_org/init.org +++ b/module2/ressources/rr_org/init.org @@ -80,18 +80,23 @@ document, simply =M-x org-babel-tangle=. '("melpa-stable" . "http://stable.melpa.org/packages/")) (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) -(package-refresh-contents) (setq package-archive-priorities '(("gnu" . 100) ("melpa-stable" . 10))) #+END_SRC -* Install missing packages -#+begin_src emacs-lisp :tangle init.el -(dolist (pkg '(ess - auctex - htmlize - exec-path-from-shell)) - (when (not (package-installed-p pkg)) - (package-install pkg))) +* Install packages +#+begin_src emacs-lisp :tangle init.el +(let* ((required-packages + '(ess + auctex + htmlize + exec-path-from-shell)) + (missing-packages (remove-if #'package-installed-p required-packages))) + (when missing-packages + (message "Missing packages: %s" missing-packages) + (package-refresh-contents) + (dolist (pkg missing-packages) + (package-install pkg) + (message "Package %s has been installed" pkg)))) #+end_src * Import environment variables #+begin_src emacs-lisp :tangle init.el