Clean up package installation code
This commit is contained in:
parent
cc29e0f2bb
commit
1ad14ccf91
2 changed files with 20 additions and 8 deletions
|
@ -351,7 +351,13 @@ If you'd like to add some auto installation of packages in your
|
||||||
personal config use the following code:
|
personal config use the following code:
|
||||||
|
|
||||||
```lisp
|
```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
|
#### Disabling whitespace-mode
|
||||||
|
|
|
@ -54,6 +54,18 @@
|
||||||
"Check if all packages in `prelude-packages' are installed."
|
"Check if all packages in `prelude-packages' are installed."
|
||||||
(every #'package-installed-p prelude-packages))
|
(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 ()
|
(defun prelude-install-packages ()
|
||||||
"Install all packages listed in `prelude-packages'."
|
"Install all packages listed in `prelude-packages'."
|
||||||
(unless (prelude-packages-installed-p)
|
(unless (prelude-packages-installed-p)
|
||||||
|
@ -62,8 +74,7 @@
|
||||||
(package-refresh-contents)
|
(package-refresh-contents)
|
||||||
(message "%s" " done.")
|
(message "%s" " done.")
|
||||||
;; install the missing packages
|
;; install the missing packages
|
||||||
(mapc #'package-install
|
(prelude-require-packages prelude-packages)))
|
||||||
(remove-if #'package-installed-p prelude-packages))))
|
|
||||||
|
|
||||||
(prelude-install-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 extension package mode))))
|
||||||
prelude-auto-install-alist)
|
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)
|
(provide 'prelude-packages)
|
||||||
;; Local Variables:
|
;; Local Variables:
|
||||||
;; byte-compile-warnings: (not cl-functions)
|
;; byte-compile-warnings: (not cl-functions)
|
||||||
|
|
Loading…
Reference in a new issue