diff --git a/modules/ui/ligatures/autoload/ligatures.el b/modules/ui/ligatures/autoload/ligatures.el index f9f4b761c..6140d7704 100644 --- a/modules/ui/ligatures/autoload/ligatures.el +++ b/modules/ui/ligatures/autoload/ligatures.el @@ -9,16 +9,16 @@ "Associates string patterns with icons in certain major-modes. MODES is a major mode symbol or a list of them. - PLIST is a property list whose keys must match keys in `+ligatures-classes', -and whose values are strings representing the text to be replaced with that -symbol. If the car of PLIST is nil, then unset any pretty symbols previously -defined for MODES. + PLIST is a property list whose keys must match keys in +`+ligatures-extra-symbols', and whose values are strings representing the text +to be replaced with that symbol. If the car of PLIST is nil, then unset any +pretty symbols previously defined for MODES. This function accepts one special property: :alist ALIST Appends ALIST to `prettify-symbols-alist' literally, without mapping text to - `+ligatures-classes'. + `+ligatures-extra-symbols'. For example, the rule for emacs-lisp-mode is very simple: @@ -26,7 +26,7 @@ For example, the rule for emacs-lisp-mode is very simple: :lambda \"lambda\") This will replace any instances of \"lambda\" in emacs-lisp-mode with the symbol -assicated with :lambda in `+ligatures-classes'. +assicated with :lambda in `+ligatures-extra-symbols'. Pretty symbols can be unset for emacs-lisp-mode with: @@ -40,7 +40,7 @@ Pretty symbols can be unset for emacs-lisp-mode with: (let ((key (pop plist))) (if (eq key :alist) (prependq! results (pop plist)) - (when-let (char (plist-get +ligatures-classes key)) + (when-let (char (plist-get +ligatures-extra-symbols key)) (push (cons (pop plist) char) results))))) (dolist (mode (doom-enlist modes)) (setf (alist-get mode +ligatures-extra-alist) diff --git a/modules/ui/ligatures/config.el b/modules/ui/ligatures/config.el index 015481716..958649d7c 100644 --- a/modules/ui/ligatures/config.el +++ b/modules/ui/ligatures/config.el @@ -1,6 +1,6 @@ ;;; ui/ligatures/config.el -*- lexical-binding: t; -*- -(defvar +ligatures-classes +(defvar +ligatures-extra-symbols '(;; org :name "»" :src_block "»" @@ -38,12 +38,15 @@ :tuple "⨂" :pipe "" ;; FIXME: find a non-private char :dot "•") - "Options plist for `set-ligatures!'. + "Maps identifiers to symbols, recognized by `set-ligatures'. This should not contain any symbols from the Unicode Private Area! There is no universal way of getting the correct symbol as that area varies from font to font.") +(defvar +ligatures-extra-alist '((t)) + "A map of major modes to symbol lists (for `prettify-symbols-alist').") + (defvar +ligatures-composition-alist '((?! . "\\(?:!\\(?:==\\|[!=]\\)\\)") ; (regexp-opt '("!!" "!=" "!==")) (?# . "\\(?:#\\(?:###?\\|_(\\|[#(:=?[_{]\\)\\)") ; (regexp-opt '("##" "###" "####" "#(" "#:" "#=" "#?" "#[" "#_" "#_(" "#{")) @@ -83,9 +86,6 @@ string starting with the character contained in car. This variable is used only if you built Emacs with Harfbuzz on a version >= 28") -(defvar +ligatures-extra-alist '((t)) - "An alist mapping major modes to `prettify-symbols-alist' values.") - (defvar +ligatures-in-modes '(not special-mode comint-mode eshell-mode term-mode vterm-mode) "List of major modes where ligatures should be enabled. @@ -97,9 +97,9 @@ This variable is used only if you built Emacs with Harfbuzz on a version >= 28") (defvar +ligatures-extras-in-modes t "List of major modes where extra ligatures should be enabled. -Extra ligatures are mode-specific substituions, defined in `+ligatures-classes' -and assigned with `set-ligatures!'. This variable controls where these are -enabled. +Extra ligatures are mode-specific substituions, defined in +`+ligatures-extra-symbols' and assigned with `set-ligatures!'. This variable +controls where these are enabled. If t, enable it everywhere (except `fundamental-mode'). If the first element is 'not, enable it in any mode besides what is listed. @@ -132,7 +132,7 @@ correct width of the symbols instead of the width measured by `char-width'." "Set up ligatures for the current buffer. Extra ligatures are mode-specific substituions, defined in -`+ligatures-classes', assigned with `set-ligatures!', and made possible +`+ligatures-extra-symbols', assigned with `set-ligatures!', and made possible 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."