Implement more flexibility in the choice of packages to install

This commit is contained in:
Gerard Vermeulen 2022-04-27 19:28:53 +02:00
parent 5a2a56d13c
commit 4cec3cf570

View File

@ -205,49 +205,44 @@ The [[info:emacs#Init File][init file (info)]] does not load the ~custom-file~ a
#+begin_src emacs-lisp
(custom-set-variables
'(package-selected-packages
'(;; anaconda-mode ; strangles python-mode
applescript-mode ; mode to edit AppleScript code
async ; asynchroneous processing
auctex ; Aalborg University Center TeX
blacken ; Black Python code formatter client
citar ; bibliography handling
citeproc ; bibliography handling
code-cells ; lightweight notebooks in Emacs
company ; complete anything
;; company-anaconda ; complete anything in anaconda-mode
consult ; consult completing-read
deadgrep ; use ripgrep from Emacs
eglot ; Emacs polyGLOT LSP client
electric-operator ; automatic spacing around operators
elfeed ; web feed reader
embark ; act on any buffer selection
emms ; Emacs Multi-Media System
htmlize ; convert buffer contents to HTML
iedit ; simultaneous multi-entity editing
keycast ; show current command with binding
magit ; Git Text-based User Interface
marginalia ; minibuffer margin notes
markdown-mode ; markdown text mode
;; math-preview ; display LaTeX math with MathJax
no-littering ; keep `user-emacs-directory' clean
nov ; EPUB reader
orderless ; Emacs completion style
org ; plain text thought organizer
org-menu ; transient menu for org-mode
pdf-tools ; interactive docview replacement
python ; mode to edit Python code
quelpa ; install Emacs packages from source
rainbow-mode ; set background color to color string
saveplace-pdf-view ; save pdf-view and doc-view places
sly ; Sylvester the Cat's Common Lisp IDE
smartparens ; smart editing of character pairs
vertico ; VERTical Interactive Completion
wgrep ; open a writable grep buffer
wordnut ; WordNet lexical database
writegood-mode ; bullshit and weasel-word detector
ws-butler ; remove trailing whitespace
xr ; undo rx to grok regular expressions
yasnippet))) ; code or text template expansion
'(applescript-mode ; mode to edit AppleScript code
async ; asynchroneous processing
auctex ; Aalborg University Center TeX
blacken ; Black Python code formatter client
citar ; bibliography handling
citeproc ; bibliography handling
code-cells ; lightweight notebooks in Emacs
company ; complete anything
consult ; consult completing-read
deadgrep ; use ripgrep from Emacs
eglot ; Emacs polyGLOT LSP client
electric-operator ; automatic spacing around operators
elfeed ; web feed reader
embark ; act on any buffer selection
emms ; Emacs Multi-Media System
htmlize ; convert buffer contents to HTML
iedit ; simultaneous multi-entity editing
keycast ; show current command with binding
magit ; Git Text-based User Interface
marginalia ; minibuffer margin notes
markdown-mode ; markdown text mode
no-littering ; keep `user-emacs-directory' clean
nov ; EPUB reader
orderless ; Emacs completion style
org ; plain text thought organizer
org-menu ; transient menu for org-mode
pdf-tools ; interactive docview replacement
python ; mode to edit Python code
quelpa ; install Emacs packages from source
saveplace-pdf-view ; save pdf-view and doc-view places
sly ; Sylvester the Cat's Common Lisp IDE
smartparens ; smart editing of character pairs
vertico ; VERTical Interactive Completion
wgrep ; open a writable grep buffer
wordnut ; WordNet lexical database
writegood-mode ; bullshit and weasel-word detector
xr ; undo rx to grok regular expressions
yasnippet))) ; code or text template expansion
#+end_src
#+caption[Customize the third set of Emacs variables]:
@ -526,6 +521,9 @@ state if the package [[https://github.com/emacscollective/no-littering][no-litte
installation status of all packages in
src_emacs-lisp{package-selected-packages} and to install the missing packages
after the user has agreed to its prompt.
4. It defines a function to ensure the installation of packages in other source
blocks. This allows skipping installation in sections with a =:noexport:=
tag by disallowing tangling.
In case of normal Emacs usage, src_emacs-lisp{(package-list-packages)} refreshes
the contents of packages and allows to update packages to the latest version.
@ -542,11 +540,20 @@ the contents of packages and allows to update packages to the latest version.
(package-install 'quelpa))
(unless (package-installed-p 'org-menu)
;; Neither GNU ELPA, nor MELPA have the latest version.
;; Neither GNU ELPA, nor MELPA provide this package.
(quelpa '(org-menu :repo "sheijk/org-menu" :fetcher github)))
(unless noninteractive
(package-install-selected-packages))
(defun ensure-packages-installed (&rest packages)
"Install installation of all packages in PACKAGES."
(unless noninteractive
(dolist (package packages)
(unless (package-installed-p package)
(package-install package))
(when (bound-and-true-p package-selected-packages)
(cl-pushnew package package-selected-packages)))))
#+end_src
* [[info:emacs#Help][Help (info)]]
@ -1346,6 +1353,10 @@ LaTeX =BiBTeX= dialect for backwards compatibility. Listing
#+caption: Configure =math-preview=.
#+name: lst:configure-math-preview
#+begin_src emacs-lisp
(ensure-packages-installed
'math-preview ; display LaTeX math with MathJax
)
(with-eval-after-load 'math-preview
(let ((command (executable-find "~/node_modules/.bin/math-preview")))
(if command
@ -2932,6 +2943,11 @@ for how to handle ~company-backends~ as a local variable in listing
#+caption: Configure =anaconda= with =company= for Python.
#+name: lst:configure-anaconda+company-for-python
#+begin_src emacs-lisp
(ensure-packages-installed
'anaconda-mode ; strangles python-mode
'company-anaconda ; complete anything in anaconda-mode
)
(with-eval-after-load 'python
(with-eval-after-load 'company
(when (and (fboundp 'anaconda-mode)
@ -3069,6 +3085,10 @@ library. It is a requirement of several packages in this Emacs setup ([[https:/
#+caption: Configure =ws-butler=.
#+name: lst:configure-ws-butler
#+begin_src emacs-lisp
(ensure-packages-installed
'ws-butler ; remove trailing whitespace
)
(when (require 'ws-butler nil 'noerror)
(custom-set-variables
'(ws-butler-keep-whitespace-before-point nil))
@ -3316,6 +3336,10 @@ and names in buffers for debugging.
#+caption: Enable =rainbow-mode=.
#+name: lst:enable-rainbow-mode
#+begin_src emacs-lisp
(ensure-packages-installed
'rainbow-mode ; set background color to color string
)
(when (fboundp 'rainbow-mode)
(custom-set-variables
'(rainbow-x-colors-major-mode-list