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
|
See `+ligatures-extras-in-modes' to control what major modes this function can
|
||||||
and cannot run in."
|
and cannot run in."
|
||||||
(when after-init-time
|
(when after-init-time
|
||||||
(when (+ligatures--enable-p +ligatures-in-modes)
|
(let ((in-mode-p
|
||||||
(if (boundp '+ligature--composition-table)
|
(+ligatures--enable-p +ligatures-in-modes))
|
||||||
(setq-local composition-function-table +ligature--composition-table)
|
(in-mode-extras-p
|
||||||
(run-hooks '+ligatures--init-font-hook)
|
(and (featurep! +extra)
|
||||||
(setq +ligatures--init-font-hook nil)))
|
(+ligatures--enable-p +ligatures-extras-in-modes))))
|
||||||
(when (and (featurep! +extra)
|
(when in-mode-p
|
||||||
(+ligatures--enable-p +ligatures-extras-in-modes))
|
(if (boundp '+ligature--composition-table)
|
||||||
(prependq! prettify-symbols-alist (alist-get major-mode +ligatures-extra-alist)))
|
(setq-local composition-function-table +ligature--composition-table)
|
||||||
(when prettify-symbols-alist
|
(run-hooks '+ligatures--init-font-hook)
|
||||||
(if prettify-symbols-mode (prettify-symbols-mode -1))
|
(setq +ligatures--init-font-hook nil)))
|
||||||
(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