Ensure electric-operator, nov, and sly installation in sections

This commit is contained in:
Gerard Vermeulen 2022-04-30 18:59:01 +02:00
parent 99c82b0fc1
commit e6be2d9502

View File

@ -212,7 +212,6 @@ The [[info:emacs#Init File][init file (info)]] does not load the ~custom-file~ a
consult ; consult completing-read
deadgrep ; use ripgrep from Emacs
eglot ; Emacs polyGLOT LSP client
electric-operator ; automatic spacing around operators
embark ; act on any buffer selection
htmlize ; convert buffer contents to HTML
iedit ; simultaneous multi-entity editing
@ -220,7 +219,6 @@ The [[info:emacs#Init File][init file (info)]] does not load the ~custom-file~ a
magit ; Git Text-based User Interface
marginalia ; minibuffer margin notes
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
@ -228,7 +226,6 @@ The [[info:emacs#Init File][init file (info)]] does not load the ~custom-file~ a
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
@ -1209,14 +1206,16 @@ the command line [[https://en.wikipedia.org/wiki/DjVu][DjVu]] decoder =ddjvu= fr
:CUSTOM_ID: sec:reading-epub-files
:END:
Listing [[lst:enable-nov-mode]] enables =nov-mode=.
The package [[https://depp.brause.cc/nov.el/][nov.el]] provides a major mode for reading EPUB files in Emacs.
Listing [[lst:configure-nov]] configures [[https://depp.brause.cc/nov.el/][nov.el]].
#+caption[Enable =nov-mode=]:
#+caption: Enable =nov-mode=.
#+name: lst:enable-nov-mode
#+caption[Configure =nov=]:
#+caption: Configure =nov=.
#+name: lst:configure-nov
#+begin_src emacs-lisp
(when (fboundp 'nov-mode)
(add-to-list 'auto-mode-alist `(,(rx ".epub" eos) . nov-mode)))
(when (ensure-package-installation 'nov)
(when (fboundp 'nov-mode)
(add-to-list 'auto-mode-alist `(,(rx ".epub" eos) . nov-mode))))
#+end_src
** Reading PDF files
@ -2525,34 +2524,35 @@ Listing [[lst:sbcl-core-for-sly]] tangles to a script to dump such a [[http://ww
#+caption: Configure =sly=.
#+name: lst:configure-sly
#+begin_src emacs-lisp
(with-eval-after-load 'sly
(custom-set-variables
;; Customize `sly-default-lisp' instead of `inferior-lisp-program',
;; because `sly' uses `inferior-lisp-program' only as a backwards
;; compatibility fallback option.
'(sly-default-lisp 'sbcl)
`(sly-lisp-implementations
'((sbcl (,(executable-find "sbcl")
"--core"
,(no-littering-expand-var-file-name "sbcl.core-for-sly"))))))
(when (ensure-package-installation 'sly)
(with-eval-after-load 'sly
(custom-set-variables
;; Customize `sly-default-lisp' instead of `inferior-lisp-program',
;; because `sly' uses `inferior-lisp-program' only as a backwards
;; compatibility fallback option.
'(sly-default-lisp 'sbcl)
`(sly-lisp-implementations
'((sbcl (,(executable-find "sbcl")
"--core"
,(no-littering-expand-var-file-name "sbcl.core-for-sly"))))))
(add-hook 'sly-mode-hook
(defun on-sly-mode-hook ()
(unless (sly-connected-p)
(save-excursion (sly)))))
(add-hook 'sly-mode-hook
(defun on-sly-mode-hook ()
(unless (sly-connected-p)
(save-excursion (sly)))))
(cond
((eq system-type 'darwin)
(setq common-lisp-hyperspec-root
"file:///usr/local/share/doc/hyperspec/HyperSpec/")
(setq common-lisp-hyperspec-symbol-table
(concat common-lisp-hyperspec-root "Data/Map_Sym.txt")))
((eq system-type 'gnu/linux)
(setq common-lisp-hyperspec-root
"file:///usr/share/doc/hyperspec-7.0/HyperSpec/"))
(t (message "Default Common Lisp HyperSpec access")))
(cond
((eq system-type 'darwin)
(setq common-lisp-hyperspec-root
"file:///usr/local/share/doc/hyperspec/HyperSpec/")
(setq common-lisp-hyperspec-symbol-table
(concat common-lisp-hyperspec-root "Data/Map_Sym.txt")))
((eq system-type 'gnu/linux)
(setq common-lisp-hyperspec-root
"file:///usr/share/doc/hyperspec-7.0/HyperSpec/"))
(t (message "Default Common Lisp HyperSpec access")))
(define-key sly-prefix-map (kbd "M-h") #'sly-documentation-lookup))
(define-key sly-prefix-map (kbd "M-h") #'sly-documentation-lookup)))
#+end_src
#+caption[Script to dump a SBCL core for the Sly Common Lisp IDE]:
@ -3278,17 +3278,18 @@ contrary to for instance [[https://github.com/Fanael/rainbow-delimiters#readme][
:CUSTOM_ID: sec:electric-operators
:END:
Listing [[lst:configure-electric-operator-mode]] configures =electric-operator-mode=
Listing [[lst:configure-electric-operator]] configures =electric-operator-mode=
to add spaces around operators for compatibility with for instance the [[https://black.readthedocs.io/en/stable/][Black
code formatter for Python]].
#+caption[Configure =electric-operator-mode=]:
#+caption: Configure =electric-operator-mode=.
#+name: lst:configure-electric-operator-mode
#+caption[Configure =electric-operator=]:
#+caption: Configure =electric-operator=.
#+name: lst:configure-electric-operator
#+begin_src emacs-lisp
(when (fboundp 'electric-operator-mode)
(add-hook 'c-mode-common #'electric-operator-mode)
(add-hook 'python-mode-hook #'electric-operator-mode))
(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)))
#+end_src
** [[https://joaotavora.github.io/yasnippet/][Smart snippets]]