This commit is contained in:
Gerard Vermeulen 2022-05-21 14:23:38 +02:00
parent 694e5a4b2a
commit c9468db32a

View File

@ -222,15 +222,12 @@ The [[info:emacs#Init File][init file (info)]] does not load the ~custom-file~ a
eglot ; Emacs polyGLOT LSP client
embark ; act on any buffer selection
htmlize ; convert buffer contents to HTML
iedit ; simultaneous multi-entity editing
magit ; Git Text-based User Interface
marginalia ; minibuffer margin notes
no-littering ; keep `user-emacs-directory' clean
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
smartparens ; smart editing of character pairs
@ -313,14 +310,13 @@ the contents of packages and allows to update packages to the latest version.
;; Install and require `no-littering'.
(package-install 'no-littering)
(require 'no-littering)
;; Install and shadow `org'.
;; Shadow built-in `org' by installing `org'.
;; https://emacs.stackexchange.com/a/45939 answers
;; "How to install a package automatically that will shadow a built-in package?"
(defun shadow-built-in-package (pkg)
(when-let ((desc (or (when (package-desc-p pkg) pkg)
(cadr (assq pkg package-archive-contents)))))
;; "How to shadow automatically a built-in package by installing it?"
(defun shadow-builtin-by-install (pkg)
(when-let ((desc (cadr (assq pkg package-archive-contents))))
(package-install desc 'dont-select)))
(shadow-built-in-package 'org)
(shadow-builtin-by-install 'org)
;; Install `quelpa'.
(unless (package-installed-p 'quelpa)
(package-install 'quelpa))
@ -1340,9 +1336,9 @@ Listing [[lst:configure-nov]] configures [[https://depp.brause.cc/nov.el/][nov.e
#+caption: Configure =nov=.
#+name: lst:configure-nov
#+begin_src emacs-lisp
(when (ensure-package-installation 'nov)
(when (fboundp 'nov-mode)
(add-to-list 'auto-mode-alist `(,(rx ".epub" eos) . nov-mode))))
(when (and (ensure-package-installation 'nov)
(fboundp 'nov-mode))
(add-to-list 'auto-mode-alist `(,(rx ".epub" eos) . nov-mode)))
#+end_src
** Reading PDF files
@ -2664,9 +2660,9 @@ the [[https://github.com/gromnitsky/wordnut#readme][wordnut]] prerequisites.
#+caption: System check for =wordnut=.
#+name: lst:check-wordnut
#+begin_src emacs-lisp
(when (ensure-package-installation 'wordnut)
(unless (executable-find "wn")
(message "`wordnut' fails to find the `wn' executable")))
(when (and (ensure-package-installation 'wordnut)
(executable-find "wn"))
(message "`wordnut' fails to find the `wn' executable"))
#+end_src
*** [[https://github.com/bnbeckwith/writegood-mode#readme][Writegood mode]]
@ -2682,7 +2678,8 @@ Listing [[lst:configure-writegood-mode]] configures [[https://github.com/bnbeckw
#+caption: Configure =writegood-mode=.
#+name: lst:configure-writegood-mode
#+begin_src emacs-lisp
(when (ensure-package-installation 'writegood-mode)
(when (and (ensure-package-installation 'writegood-mode)
(fboundp 'writegood-mode))
(global-set-key (kbd "C-c g") #'writegood-mode))
#+end_src
@ -2709,10 +2706,9 @@ Listing [[lst:configure-format-all]]:
;; https://github.com/lassik/emacs-format-all-the-code#readme
;; https://ianyepan.github.io/posts/format-all/
;; https://jamesaimonetti.com/posts/formatting-tangled-output-in-org-mode/
(when (ensure-package-installation 'format-all)
(when (fboundp 'format-all-ensure-formatter)
(add-hook 'prog-mode-hook #'format-all-ensure-formatter))
(when (and (ensure-package-installation 'format-all)
(fboundp 'format-all-ensure-formatter))
(add-hook 'prog-mode-hook #'format-all-ensure-formatter)
(add-hook
'org-babel-post-tangle-hook
(defun format-all-org-babel-post-tangle ()
@ -3208,14 +3204,14 @@ Listing [[lst:configure-blacken]] configures [[https://github.com/pythonic-emacs
#+caption: Configure =blacken=.
#+name: lst:configure-blacken
#+begin_src emacs-lisp
(when (ensure-package-installation 'blacken)
(when (fboundp 'blacken-buffer)
(defun advice-derived-python-mode-p (fn &rest args)
(if (derived-mode-p 'python-mode)
(apply fn args)
(message "Refusal to run %S, since buffer is in %S." fn major-mode)))
(when (and (ensure-package-installation 'blacken)
(fboundp 'blacken-buffer))
(defun advice-derived-python-mode-p (fn &rest args)
(if (derived-mode-p 'python-mode)
(apply fn args)
(message "Refusal to run %S, since buffer is in %S." fn major-mode)))
(advice-add 'blacken-buffer :around #'advice-derived-python-mode-p)))
(advice-add 'blacken-buffer :around #'advice-derived-python-mode-p))
#+end_src
*** [[https://jedi.readthedocs.io/en/latest/][Jedi]]
@ -3394,8 +3390,8 @@ setup and requires no configuration.
#+caption: Enable =iedit=.
#+name: lst:enable-iedit
#+begin_src emacs-lisp
(with-eval-after-load 'emacs
(require 'iedit nil 'noerror))
(when (ensure-package-installation 'iedit)
(require 'iedit nil 'noedit))
#+end_src
** [[https://github.com/lewang/ws-butler#readme][Unobtrusive whitespace trimming]]
@ -3407,12 +3403,12 @@ setup and requires no configuration.
#+caption: Configure =ws-butler=.
#+name: lst:configure-ws-butler
#+begin_src emacs-lisp
(when (ensure-package-installation 'ws-butler)
(when (require 'ws-butler nil 'noerror)
(custom-set-variables
'(ws-butler-keep-whitespace-before-point nil))
(add-hook 'prog-mode-hook #'ws-butler-mode)
(add-hook 'text-mode-hook #'ws-butler-mode)))
(when (and (ensure-package-installation 'ws-butler)
(require 'ws-butler nil 'noerror))
(custom-set-variables
'(ws-butler-keep-whitespace-before-point nil))
(add-hook 'prog-mode-hook #'ws-butler-mode)
(add-hook 'text-mode-hook #'ws-butler-mode))
#+end_src
** [[https://countvajhula.com/2021/09/25/the-animated-guide-to-symex/][Structural editing]]
@ -3505,10 +3501,10 @@ code formatter for Python]].
#+caption: Configure =electric-operator=.
#+name: lst:configure-electric-operator
#+begin_src emacs-lisp
(when (ensure-package-installation 'electric-operator)
(when (fboundp 'electric-operator-mode)
(add-hook 'c-mode-common #'electric-operator-mode)
(add-hook 'python-mode-hook #'electric-operator-mode)))
(when (and (ensure-package-installation 'electric-operator)
(fboundp 'electric-operator-mode))
(add-hook 'c-mode-common #'electric-operator-mode)
(add-hook 'python-mode-hook #'electric-operator-mode))
#+end_src
** [[https://joaotavora.github.io/yasnippet/][Smart snippets]]
@ -3656,19 +3652,19 @@ and names in buffers for debugging.
#+caption: Enable =rainbow-mode=.
#+name: lst:enable-rainbow-mode
#+begin_src emacs-lisp
(when (ensure-package-installation 'rainbow-mode)
(when (fboundp 'rainbow-mode)
(custom-set-variables
'(rainbow-x-colors-major-mode-list
'(c++-mode
c-mode
emacs-lisp-mode
inferior-emacs-lisp-mode
java-mode
lisp-interaction-mode
org-mode
python-mode)))
(rainbow-mode +1)))
(when (and (ensure-package-installation 'rainbow-mode)
(fboundp 'rainbow-mode))
(custom-set-variables
'(rainbow-x-colors-major-mode-list
'(c++-mode
c-mode
emacs-lisp-mode
inferior-emacs-lisp-mode
java-mode
lisp-interaction-mode
org-mode
python-mode)))
(rainbow-mode +1))
#+end_src
** [[https://karthinks.com/software/batteries-included-with-emacs/][Flash the line around point for visual feedback]]
@ -3863,9 +3859,9 @@ enable =emms=.
#+caption: Configure =elfeed=.
#+name: lst:configure-elfeed
#+begin_src emacs-lisp
(when (ensure-package-installation 'elfeed)
(when (fboundp 'elfeed)
(global-set-key (kbd "C-x w") #'elfeed))
(when (and (ensure-package-installation 'elfeed)
(fboundp 'elfeed))
(global-set-key (kbd "C-x w") #'elfeed)
(with-eval-after-load 'elfeed
(custom-set-variables