Get rid of unexported GNU Hyperbole section

This commit is contained in:
Gerard Vermeulen 2024-03-05 14:55:40 +01:00
parent be9076cbdc
commit 3b31228747

View File

@ -292,7 +292,6 @@ of [[info:emacs#Saving Customizations][saving customizations (info)]].
(f . "melpa-stable")
(forge . "melpa-stable")
(git-commit . "nongnu")
(hyperbole . "gnu-devel")
(keycast . "nongnu")
(magit . "nongnu")
(magit-section . "nongnu")
@ -6989,82 +6988,6 @@ Listing [[lst:configure-browse-url]] configures =browse-url=.
(advice-add 'eww-display-pdf :around #'eww-display-pdf-as-binary))
#+end_src
*** [[https://www.gnu.org/software/hyperbole/][GNU Hyperbole]] :noexport:
:PROPERTIES:
:CUSTOM_ID: sec:ensure-hyperbole-installation
:header-args:emacs-lisp: :tangle no :eval never-export
:END:
Listing [[lst:ensure-hyperbole-installation][ensure Hyperbole installation]] works around two [[https://www.gnu.org/software/hyperbole/][GNU Hyperbole]] quirks:
1. The [[https://elpa.gnu.org/elpa/hyperbole.html][GNU ELPA Hyperbole]] and [[https://elpa.gnu.org/devel/hyperbole.html][GNU ELPA Hyperbole developer]] packages ship their
own =hyperbole-autoloads= and =kotl-autoloads= files which are incompatible
with Emacs Lisp packages from "package archives". Consequently, Emacs can
neither autoload nor load the =hyperbole-autoloads= and =kotl-autoloads=
files. Therefore, the predicate loading the =kotl-autoloads= file in the
first =unless= form of listing [[lst:ensure-hyperbole-installation][ensure Hyperbole installation]] will fail and
the body of this form will overwrite the =hyperbole-autoloads= file to fix
=load-path= *and* load the =hyperbole-autoloads= and =kotl-autoloads= files.
A next time, Emacs will be able to autoload the new =hyperbole-autoloads=
file but not the =kotl-autoloads= file. However, Emacs will now be able to
load the =kotl-autoloads= file which the predicate in the first =unless= form
of listing [[lst:ensure-hyperbole-installation][ensure Hyperbole installation]] does.
2. [[https://www.gnu.org/software/hyperbole/][GNU Hyperbole]] and [[info:vertico#Top][Vertico (info)]] do not play well together, since the
=vertico-mode= preselection of the first candidate out of the full candidate
completion list interferes with =hyperbole-mode= expectations where it must
handle a full candidate list. Therefore, the function call
src_emacs-lisp[:results silent]{(either-hyperbole-or-vertico-mode)} handles
this conflict by toggling between =hyperbole-mode= and =vertico-mode=.
#+caption[Ensure Hyperbole installation]:
#+caption: Ensure Hyperbole installation and address two Hyperbole quirks.
#+name: lst:ensure-hyperbole-installation
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'hyperbole)
(unless (load "kotl-autoloads.el" 'noerror nil nil 'must-suffix)
;; See `package-generate-autoloads' for `loaddefs-generate' usage.
(unless (bound-and-true-p package-archive-contents)
(package-read-all-archive-contents))
(let* ((pkg-desc (cadr (assq 'hyperbole package-archive-contents)))
(pkg-dir (expand-file-name
(package-desc-full-name pkg-desc) package-user-dir))
(hpbl-alf (expand-file-name "hyperbole-autoloads.el" pkg-dir))
(kotl-alf (expand-file-name
(file-name-concat "kotl" "kotl-autoloads.el") pkg-dir))
(extra-data
(concat
(prin1-to-string
'(add-to-list
'load-path
(or (and load-file-name (file-name-directory load-file-name))
(car load-path))))
"\n"
(prin1-to-string
'(add-to-list
'load-path
(expand-file-name
"kotl"
(or (and load-file-name (file-name-directory load-file-name))
(car load-path)))))))
(autoload-timestamps nil)
(version-control 'never))
(loaddefs-generate pkg-dir hpbl-alf nil extra-data nil 'generate-full)
(dolist (alf (list hpbl-alf kotl-alf))
(let ((buf (find-buffer-visiting hpbl-alf)))
(when buf (kill-buffer buf)))
(load alf nil nil nil 'must-suffix))))
(defun either-hyperbole-or-vertico-mode ()
"Toggle between either `hyperbole-mode' or `vertico-mode'."
(interactive)
(when (and (boundp hyperbole-mode) (boundp vertico-mode))
(if hyperbole-mode
(progn
(hyperbole-mode -1)
(vertico-mode +1))
(hyperbole-mode +1)
(vertico-mode -1)))))
#+end_src
*** [[https://en.wikipedia.org/wiki/Media_type#Mailcap][Mailcap]]
:PROPERTIES:
:CUSTOM_ID: sec:mailcap