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:
parent
0917187f20
commit
e4539bb56c
1 changed files with 18 additions and 11 deletions
|
@ -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)
|
||||
(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 (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))))
|
||||
(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)))))
|
||||
|
||||
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue