Fix set-pretty-symbols! not merging properties w/ old rules
This removes the :merge property, as merging is now its default behavior.
This commit is contained in:
parent
d1beb47e90
commit
e0b8b4f190
2 changed files with 14 additions and 18 deletions
|
@ -66,7 +66,7 @@ BODY."
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-plist-merge (from-plist to-plist)
|
(defun doom-plist-merge (from-plist to-plist)
|
||||||
"Destructively merge FROM-PLIST onto TO-PLIST"
|
"Non-destructively merge FROM-PLIST onto TO-PLIST"
|
||||||
(let ((plist (copy-sequence from-plist)))
|
(let ((plist (copy-sequence from-plist)))
|
||||||
(while plist
|
(while plist
|
||||||
(plist-put! to-plist (pop plist) (pop plist)))
|
(plist-put! to-plist (pop plist) (pop plist)))
|
||||||
|
|
|
@ -15,14 +15,11 @@ 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
|
symbol. If the car of PLIST is nil, then unset any pretty symbols previously
|
||||||
defined for MODES.
|
defined for MODES.
|
||||||
|
|
||||||
The following properties are special:
|
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
|
||||||
`+pretty-code-symbols'.
|
`+pretty-code-symbols'.
|
||||||
:merge BOOL
|
|
||||||
If non-nil, merge with previously defined `prettify-symbols-alist',
|
|
||||||
otherwise overwrite it.
|
|
||||||
|
|
||||||
For example, the rule for emacs-lisp-mode is very simple:
|
For example, the rule for emacs-lisp-mode is very simple:
|
||||||
|
|
||||||
|
@ -38,18 +35,17 @@ Pretty symbols can be unset for emacs-lisp-mode with:
|
||||||
(declare (indent defun))
|
(declare (indent defun))
|
||||||
(if (null (car-safe plist))
|
(if (null (car-safe plist))
|
||||||
(dolist (mode (doom-enlist modes))
|
(dolist (mode (doom-enlist modes))
|
||||||
(delq (assq mode +pretty-code-symbols-alist)
|
(assq-delete-all mode +pretty-code-symbols-alist))
|
||||||
+pretty-code-symbols-alist))
|
(let (results)
|
||||||
(let (results merge key)
|
|
||||||
(while plist
|
(while plist
|
||||||
(pcase (setq key (pop plist))
|
(let ((key (pop plist)))
|
||||||
(:merge (setq merge (pop plist)))
|
(if (eq key :alist)
|
||||||
(:alist (setq results (append (pop plist) results)))
|
(prependq! results (pop plist))
|
||||||
(_
|
|
||||||
(when-let (char (plist-get +pretty-code-symbols key))
|
(when-let (char (plist-get +pretty-code-symbols key))
|
||||||
(push (cons (pop plist) char) results)))))
|
(push (cons (pop plist) char) results)))))
|
||||||
(dolist (mode (doom-enlist modes))
|
(dolist (mode (doom-enlist modes))
|
||||||
(unless merge
|
(setf (alist-get mode +pretty-code-symbols-alist)
|
||||||
(delq (assq mode +pretty-code-symbols-alist)
|
(if-let (old-results (alist-get mode +pretty-code-symbols-alist))
|
||||||
+pretty-code-symbols-alist))
|
(dolist (cell results old-results)
|
||||||
(push (cons mode results) +pretty-code-symbols-alist)))))
|
(setf (alist-get (car cell) old-results) (cdr cell)))
|
||||||
|
results))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue