Refactor out map.el usage

After some profiling, it turns out map-put and map-delete are 5-7x
slower (more on Emacs 25) than delq, setf/alist-get and add-to-list for
small lists (under 250 items), which is exactly how I've been using
them.

The only caveat is alist-get's signature is different on Emacs 25, thus
a polyfill is necessary in core-lib.
This commit is contained in:
Henrik Lissner 2018-06-23 16:48:58 +02:00
parent f602a1f607
commit f6dc6ac74e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
29 changed files with 177 additions and 146 deletions

View file

@ -231,12 +231,12 @@ variable for an explanation of the defaults (in comments). See
(cons (format "(%s " (or (read-string "(") "")) ")"))
;; Add escaped-sequence support to embrace
(map-put (default-value 'embrace--pairs-list)
?\\ (make-embrace-pair-struct
:key ?\\
:read-function #'+evil--embrace-escaped
:left-regexp "\\[[{(]"
:right-regexp "\\[]})]")))
(setf (alist-get ?\\ (default-value 'embrace--pairs-list))
(make-embrace-pair-struct
:key ?\\
:read-function #'+evil--embrace-escaped
:left-regexp "\\[[{(]"
:right-regexp "\\[]})]")))
(def-package! evil-escape
@ -332,8 +332,7 @@ the new algorithm is confusing, like in python or ruby."
;; Add custom commands to whitelisted commands
(dolist (fn '(doom/backward-to-bol-or-indent doom/forward-to-last-non-comment-or-eol
doom/backward-kill-to-bol-and-indent))
(map-put evil-mc-custom-known-commands
fn '((:default . evil-mc-execute-default-call))))
(add-to-list 'evil-mc-custom-known-commands `(,fn (:default . evil-mc-execute-default-call))))
;; Activate evil-mc cursors upon switching to insert mode
(defun +evil-mc|resume-cursors () (setq evil-mc-frozen nil))