refactor(ligatures): defer ligature.el & combine variables

This combines `+ligatures-prog-mode-list` and `+ligatures-all-mode-list`
into `+ligatures-alist` (and deprecates the former).
This commit is contained in:
Henrik Lissner 2024-08-19 16:43:22 -04:00
parent dff6c36ab5
commit ef142fc913
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
2 changed files with 44 additions and 39 deletions

View file

@ -67,15 +67,15 @@ Font ligatures can be unset for emacs-lisp-mode with:
Note that this will keep all ligatures in `+ligatures-prog-mode-list' active, as
`emacs-lisp-mode' is derived from `prog-mode'."
(declare (indent defun))
;; NOTE: Doom enforces `ligature-composition-table' to have a single mode per key in the alist.
;; This is less efficient than what ligature.el can do (i.e. use a list of modes, or `t' as a key),
;; but holding this invariant allows resetting with `(set-font-ligatures! 'mode nil)` to work reliably.
;; NOTE: Doom enforces `ligature-composition-table' to have a single mode per
;; key in the alist. This is less efficient than what ligature.el can do
;; (i.e. use a list of modes, or `t' as a key), but holding this invariant
;; allows resetting with `(set-font-ligatures! 'mode nil)` to work reliably.
(if (or (null ligatures) (equal ligatures '(nil)))
(dolist (mode (ensure-list modes))
(delq! mode ligature-composition-table 'assq))
(after! ligature
(dolist (mode (ensure-list modes))
(setq ligature-ignored-major-modes (delq mode ligature-ignored-major-modes))
(ligature-set-ligatures mode ligatures)))))
(let ((package? (featurep 'ligature)))
(dolist (mode (ensure-list modes))
(if package?
(ligature-set-ligatures mode ligatures)
(setf (alist-get mode +ligatures-alist) ligatures))))))