This commit is contained in:
Gerard Vermeulen 2022-05-21 17:27:31 +02:00
parent 60f9aae799
commit 866e6cf2bd

View File

@ -227,11 +227,9 @@ The [[info:emacs#Init File][init file (info)]] does not load the ~custom-file~ a
orderless ; Emacs completion style
org-menu ; transient menu for org-mode
quelpa ; install Emacs packages from source
smartparens ; smart editing of character pairs
vertico ; VERTical Interactive Completion
wgrep ; open a writable grep buffer
xr ; undo rx to grok regular expressions
yasnippet))) ; code or text template expansion
xr))) ; undo rx to grok regular expressions
#+end_src
#+caption[Customize the third set of Emacs variables]:
@ -345,18 +343,17 @@ the contents of packages and allows to update packages to the latest version.
Section [[#sec:text-faces-or-styles][text faces or styles]] tells that this setup does not use theming.
However, in order to improve visibility, it relies on:
1. Tweaking faces in memory after loading as in listing
[[lst:tweak-faces-faces-after]].
1. Tweaking the background color of the already loaded =region= face as in
listing [[lst:tweak-region-face-background-color]].
2. Toggling between a dark and light background by means of
src_emacs-lisp{(invert-default-face)} in listing [[lst:invert-default-face]].
3. Shadowing the definition of faces before loading as in listing
[[lst:tweak-org-faces-before]] and [[lst:tweak-sh-script-faces-before]]. The last
item in the page on [[https://orgmode.org/worg/org-contrib/babel/examples/fontify-src-code-blocks.html#org5c4406f][fontifying Org mode source code blocks]] describes this
method.
[[lst:tweak-org-block-face]] and [[lst:tweak-sh-heredoc-face]]. The last item in the
page on [[https://orgmode.org/worg/org-contrib/babel/examples/fontify-src-code-blocks.html#org5c4406f][fontifying Org mode source code blocks]] describes this method.
#+caption[Improve the visibility of faces in =faces.el=]:
#+caption: Improve the visibility of faces in =faces.el=.
#+name: lst:tweak-faces-faces-after
#+caption[Tweak the background color of the =region= face in =faces.el=]:
#+caption: Tweak the background color of the =region= face in =faces.el=.
#+name: lst:tweak-region-face-background-color
#+begin_src emacs-lisp
(with-eval-after-load 'emacs
(defun tweak-region-face-background-color ()
@ -382,9 +379,9 @@ However, in order to improve visibility, it relies on:
(tweak-region-face-background-color)))
#+end_src
#+caption[Improve the visibility of faces in =org-faces.el=]:
#+caption: Improve the visibility of faces in =org-faces.el=.
#+name: lst:tweak-org-faces-before
#+caption[Improve the visibility of the =org-block= face in =org-faces.el=]:
#+caption: Improve the visibility of the =org-block= face in =org-faces.el=.
#+name: lst:tweak-org-block-face
#+begin_src emacs-lisp
(with-eval-after-load 'emacs
;; Shadow the definition in org-faces.el:
@ -410,9 +407,9 @@ However, in order to improve visibility, it relies on:
`org-quote' faces, which inherit from `org-block'."))
#+end_src
#+caption[Improve the visibility of faces in =sh-script.el=]:
#+caption: Improve the visibility of faces in =sh-script.el=.
#+name: lst:tweak-sh-script-faces-before
#+caption[Improve the visibility of the =sh-heredoc= face in =sh-script.el=]:
#+caption: Improve the visibility of the =sh-heredoc= face in =sh-script.el=.
#+name: lst:tweak-sh-heredoc-face
#+begin_src emacs-lisp
(with-eval-after-load 'emacs
;; Shadow the definition in sh-script.el:
@ -3454,37 +3451,37 @@ contrary to for instance [[https://github.com/Fanael/rainbow-delimiters#readme][
#+caption: Configure =smartparens=.
#+name: lst:configure-smartparens
#+begin_src emacs-lisp
(with-eval-after-load 'emacs
;; Require `smartparens-config' instead of `smartparens' to disable
;; pairing of the quote character for lisp modes,
(when (require 'smartparens-config nil 'noerror)
(custom-set-variables
'(sp-base-key-bindings 'sp)
'(sp-override-key-bindings '(("C-(" . sp-backward-barf-sexp)
("C-)" . sp-forward-slurp-sexp))))
(when (and (ensure-package-installation 'smartparens)
;; Require `smartparens-config' instead of `smartparens' to
;; disable pairing of the quote character for lisp modes.
(require 'smartparens-config nil 'noerror))
(custom-set-variables
'(sp-base-key-bindings 'sp)
'(sp-override-key-bindings '(("C-(" . sp-backward-barf-sexp)
("C-)" . sp-forward-slurp-sexp))))
(dolist (hook '(prog-mode-hook text-mode-hook))
(add-hook hook #'smartparens-mode))
(dolist (hook '(prog-mode-hook text-mode-hook))
(add-hook hook #'smartparens-mode))
(dolist (hook '(emacs-lisp-mode-hook
ielm-mode-hook
lisp-mode-hook
python-mode-hook
sly-mrepl-mode-hook))
(add-hook hook #'smartparens-strict-mode))
(dolist (hook '(emacs-lisp-mode-hook
ielm-mode-hook
lisp-mode-hook
python-mode-hook
sly-mrepl-mode-hook))
(add-hook hook #'smartparens-strict-mode))
;; https://xenodium.com/emacs-smartparens-auto-indent/index.html
(defun indent-between-pair (&rest _ignored)
(newline)
(indent-according-to-mode)
(forward-line -1)
(indent-according-to-mode))
;; https://xenodium.com/emacs-smartparens-auto-indent/index.html
(defun indent-between-pair (&rest _ignored)
(newline)
(indent-according-to-mode)
(forward-line -1)
(indent-according-to-mode))
(dolist (left '("(" "[" "{"))
(sp-local-pair 'prog-mode left
nil :post-handlers '((indent-between-pair "RET"))))
(dolist (left '("(" "[" "{"))
(sp-local-pair 'prog-mode left
nil :post-handlers '((indent-between-pair "RET"))))
(show-smartparens-global-mode +1)))
(show-smartparens-global-mode +1))
#+end_src
** [[https://github.com/davidshepherd7/electric-operator#readme][Electric operators]]
@ -3515,7 +3512,8 @@ code formatter for Python]].
#+caption: Enable =yas-global-mode=.
#+name: lst:enable-yas-global-mode
#+begin_src emacs-lisp
(when (require 'yasnippet nil 'noerror)
(when (and (ensure-package-installation 'yasnippet)
(require 'yasnippet nil 'noerror))
(custom-set-variables
'(yas-alias-to-yas/prefix-p nil))
(yas-global-mode +1))