diff --git a/README.md b/README.md index 508192e..06a8831 100644 --- a/README.md +++ b/README.md @@ -351,7 +351,13 @@ If you'd like to add some auto installation of packages in your personal config use the following code: ```lisp -(prelude-ensure-module-deps '(some-package some-other-package)) +(prelude-require-packages '(some-package some-other-package)) +``` + +If you require just a single package you can also use: + +```lisp +(prelude-require-package 'some-package) ``` #### Disabling whitespace-mode diff --git a/core/prelude-packages.el b/core/prelude-packages.el index 736a508..2a2ce98 100644 --- a/core/prelude-packages.el +++ b/core/prelude-packages.el @@ -54,6 +54,18 @@ "Check if all packages in `prelude-packages' are installed." (every #'package-installed-p prelude-packages)) +(defun prelude-require-package (package) + "Install PACKAGE unless already installed." + (unless (package-installed-p package) + (package-install package))) + +(defun prelude-require-packages (packages) + "Ensure PACKAGES are installed. +Missing packages are installed automatically." + (mapc #'prelude-require-package packages)) + +(defalias 'prelude-ensure-module-deps 'prelude-require-packages) + (defun prelude-install-packages () "Install all packages listed in `prelude-packages'." (unless (prelude-packages-installed-p) @@ -62,8 +74,7 @@ (package-refresh-contents) (message "%s" " done.") ;; install the missing packages - (mapc #'package-install - (remove-if #'package-installed-p prelude-packages)))) + (prelude-require-packages prelude-packages))) (prelude-install-packages) @@ -123,11 +134,6 @@ PACKAGE is installed only if not already present. The file is opened in MODE." (prelude-auto-install extension package mode)))) prelude-auto-install-alist) -(defun prelude-ensure-module-deps (packages) - "Ensure PACKAGES are installed. -Missing packages are installed automatically." - (mapc #'package-install (remove-if #'package-installed-p packages))) - (provide 'prelude-packages) ;; Local Variables: ;; byte-compile-warnings: (not cl-functions)