ui/ligatures: +ligatures-classes -> +ligatures-extra-symbols
And update docstrings.
This commit is contained in:
parent
a1fc5886cc
commit
3cc032da9e
2 changed files with 16 additions and 16 deletions
|
@ -9,16 +9,16 @@
|
||||||
"Associates string patterns with icons in certain major-modes.
|
"Associates string patterns with icons in certain major-modes.
|
||||||
|
|
||||||
MODES is a major mode symbol or a list of them.
|
MODES is a major mode symbol or a list of them.
|
||||||
PLIST is a property list whose keys must match keys in `+ligatures-classes',
|
PLIST is a property list whose keys must match keys in
|
||||||
and whose values are strings representing the text to be replaced with that
|
`+ligatures-extra-symbols', and whose values are strings representing the text
|
||||||
symbol. If the car of PLIST is nil, then unset any pretty symbols previously
|
to be replaced with that symbol. If the car of PLIST is nil, then unset any
|
||||||
defined for MODES.
|
pretty symbols previously defined for MODES.
|
||||||
|
|
||||||
This function accepts one special property:
|
This function accepts one special property:
|
||||||
|
|
||||||
:alist ALIST
|
:alist ALIST
|
||||||
Appends ALIST to `prettify-symbols-alist' literally, without mapping text to
|
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:
|
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\")
|
:lambda \"lambda\")
|
||||||
|
|
||||||
This will replace any instances of \"lambda\" in emacs-lisp-mode with the symbol
|
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:
|
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)))
|
(let ((key (pop plist)))
|
||||||
(if (eq key :alist)
|
(if (eq key :alist)
|
||||||
(prependq! results (pop plist))
|
(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)))))
|
(push (cons (pop plist) char) results)))))
|
||||||
(dolist (mode (doom-enlist modes))
|
(dolist (mode (doom-enlist modes))
|
||||||
(setf (alist-get mode +ligatures-extra-alist)
|
(setf (alist-get mode +ligatures-extra-alist)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;;; ui/ligatures/config.el -*- lexical-binding: t; -*-
|
;;; ui/ligatures/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(defvar +ligatures-classes
|
(defvar +ligatures-extra-symbols
|
||||||
'(;; org
|
'(;; org
|
||||||
:name "»"
|
:name "»"
|
||||||
:src_block "»"
|
:src_block "»"
|
||||||
|
@ -38,12 +38,15 @@
|
||||||
:tuple "⨂"
|
:tuple "⨂"
|
||||||
:pipe "" ;; FIXME: find a non-private char
|
:pipe "" ;; FIXME: find a non-private char
|
||||||
:dot "•")
|
: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
|
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
|
universal way of getting the correct symbol as that area varies from font to
|
||||||
font.")
|
font.")
|
||||||
|
|
||||||
|
(defvar +ligatures-extra-alist '((t))
|
||||||
|
"A map of major modes to symbol lists (for `prettify-symbols-alist').")
|
||||||
|
|
||||||
(defvar +ligatures-composition-alist
|
(defvar +ligatures-composition-alist
|
||||||
'((?! . "\\(?:!\\(?:==\\|[!=]\\)\\)") ; (regexp-opt '("!!" "!=" "!=="))
|
'((?! . "\\(?:!\\(?:==\\|[!=]\\)\\)") ; (regexp-opt '("!!" "!=" "!=="))
|
||||||
(?# . "\\(?:#\\(?:###?\\|_(\\|[#(:=?[_{]\\)\\)") ; (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")
|
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
|
(defvar +ligatures-in-modes
|
||||||
'(not special-mode comint-mode eshell-mode term-mode vterm-mode)
|
'(not special-mode comint-mode eshell-mode term-mode vterm-mode)
|
||||||
"List of major modes where ligatures should be enabled.
|
"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
|
(defvar +ligatures-extras-in-modes t
|
||||||
"List of major modes where extra ligatures should be enabled.
|
"List of major modes where extra ligatures should be enabled.
|
||||||
|
|
||||||
Extra ligatures are mode-specific substituions, defined in `+ligatures-classes'
|
Extra ligatures are mode-specific substituions, defined in
|
||||||
and assigned with `set-ligatures!'. This variable controls where these are
|
`+ligatures-extra-symbols' and assigned with `set-ligatures!'. This variable
|
||||||
enabled.
|
controls where these are enabled.
|
||||||
|
|
||||||
If t, enable it everywhere (except `fundamental-mode').
|
If t, enable it everywhere (except `fundamental-mode').
|
||||||
If the first element is 'not, enable it in any mode besides what is listed.
|
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.
|
"Set up ligatures for the current buffer.
|
||||||
|
|
||||||
Extra ligatures are mode-specific substituions, defined in
|
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.
|
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."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue