mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
ui/ligatures: fix over-eager activation
Users (or packages) may add entries directly to prettify-symbols-alist. The module would mistaken that as a green light to activate prettify-symbols-mode. Instead, only activate the mode if this module's ligatures (or extra symbols) are specifically asked for.
This commit is contained in:
@ -137,17 +137,24 @@ with `prettify-symbols-mode'. This variable controls where these are enabled.
|
||||
See `+ligatures-extras-in-modes' to control what major modes this function can
|
||||
and cannot run in."
|
||||
(when after-init-time
|
||||
(when (+ligatures--enable-p +ligatures-in-modes)
|
||||
(if (boundp '+ligature--composition-table)
|
||||
(setq-local composition-function-table +ligature--composition-table)
|
||||
(run-hooks '+ligatures--init-font-hook)
|
||||
(setq +ligatures--init-font-hook nil)))
|
||||
(when (and (featurep! +extra)
|
||||
(+ligatures--enable-p +ligatures-extras-in-modes))
|
||||
(prependq! prettify-symbols-alist (alist-get major-mode +ligatures-extra-alist)))
|
||||
(when prettify-symbols-alist
|
||||
(if prettify-symbols-mode (prettify-symbols-mode -1))
|
||||
(prettify-symbols-mode +1))))
|
||||
(let ((in-mode-p
|
||||
(+ligatures--enable-p +ligatures-in-modes))
|
||||
(in-mode-extras-p
|
||||
(and (featurep! +extra)
|
||||
(+ligatures--enable-p +ligatures-extras-in-modes))))
|
||||
(when in-mode-p
|
||||
(if (boundp '+ligature--composition-table)
|
||||
(setq-local composition-function-table +ligature--composition-table)
|
||||
(run-hooks '+ligatures--init-font-hook)
|
||||
(setq +ligatures--init-font-hook nil)))
|
||||
(when in-mode-extras-p
|
||||
(prependq! prettify-symbols-alist
|
||||
(alist-get major-mode +ligatures-extra-alist)))
|
||||
(when (and (or in-mode-p in-mode-extras-p)
|
||||
prettify-symbols-alist)
|
||||
(when prettify-symbols-mode
|
||||
(prettify-symbols-mode -1))
|
||||
(prettify-symbols-mode +1)))))
|
||||
|
||||
|
||||
;;
|
||||
|
Reference in New Issue
Block a user