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:
parent
f602a1f607
commit
f6dc6ac74e
29 changed files with 177 additions and 146 deletions
|
@ -28,7 +28,7 @@
|
|||
:config
|
||||
(helm-mode +1)
|
||||
;; helm is too heavy for find-file-at-point
|
||||
(map-put helm-completing-read-handlers-alist 'find-file-at-point nil))
|
||||
(add-to-list 'helm-completing-read-handlers-alist (cons #'find-file-at-point nil)))
|
||||
|
||||
|
||||
(def-package! helm
|
||||
|
|
|
@ -191,21 +191,21 @@ immediately runs it on the current candidate (ending the ivy session)."
|
|||
(internal-border-width . 10)))
|
||||
|
||||
;; ... let's do it manually
|
||||
(dolist (fn (list 'ivy-posframe-display-at-frame-bottom-left
|
||||
'ivy-posframe-display-at-frame-center
|
||||
'ivy-posframe-display-at-point
|
||||
'ivy-posframe-display-at-frame-bottom-window-center
|
||||
'ivy-posframe-display
|
||||
'ivy-posframe-display-at-window-bottom-left
|
||||
'ivy-posframe-display-at-window-center
|
||||
'+ivy-display-at-frame-center-near-bottom))
|
||||
(map-put ivy-display-functions-props fn '(:cleanup ivy-posframe-cleanup)))
|
||||
|
||||
(map-put ivy-display-functions-alist 't '+ivy-display-at-frame-center-near-bottom)
|
||||
(unless (assq 'ivy-posframe-display-at-frame-bottom-left ivy-display-functions-props)
|
||||
(dolist (fn (list 'ivy-posframe-display-at-frame-bottom-left
|
||||
'ivy-posframe-display-at-frame-center
|
||||
'ivy-posframe-display-at-point
|
||||
'ivy-posframe-display-at-frame-bottom-window-center
|
||||
'ivy-posframe-display
|
||||
'ivy-posframe-display-at-window-bottom-left
|
||||
'ivy-posframe-display-at-window-center
|
||||
'+ivy-display-at-frame-center-near-bottom))
|
||||
(push (cons fn '(:cleanup ivy-posframe-cleanup)) ivy-display-functions-props))
|
||||
(push '(t . +ivy-display-at-frame-center-near-bottom) ivy-display-functions-props))
|
||||
|
||||
;; posframe doesn't work well with async sources
|
||||
(dolist (fn '(swiper counsel-rg counsel-ag counsel-pt counsel-grep counsel-git-grep))
|
||||
(map-put ivy-display-functions-alist fn nil)))
|
||||
(setf (alist-get fn ivy-display-functions-alist) nil)))
|
||||
|
||||
|
||||
(def-package! flx
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue