Optimize save-place caching
By reducing its limit from 200 to 100 (its default is 400) and by *not* prettifying its cache file (pp is much more expensive than prin1).
This commit is contained in:
parent
4200e2e6d9
commit
67617254bc
1 changed files with 12 additions and 2 deletions
|
@ -198,12 +198,22 @@ successfully sets indent_style/indent_size.")
|
||||||
:after-call after-find-file dired-initial-position-hook
|
:after-call after-find-file dired-initial-position-hook
|
||||||
:config
|
:config
|
||||||
(setq save-place-file (concat doom-cache-dir "saveplace")
|
(setq save-place-file (concat doom-cache-dir "saveplace")
|
||||||
save-place-forget-unreadable-files t
|
save-place-limit 100)
|
||||||
save-place-limit 200)
|
|
||||||
(defadvice! doom--recenter-on-load-saveplace-a (&rest _)
|
(defadvice! doom--recenter-on-load-saveplace-a (&rest _)
|
||||||
"Recenter on cursor when loading a saved place."
|
"Recenter on cursor when loading a saved place."
|
||||||
:after-while #'save-place-find-file-hook
|
:after-while #'save-place-find-file-hook
|
||||||
(if buffer-file-name (ignore-errors (recenter))))
|
(if buffer-file-name (ignore-errors (recenter))))
|
||||||
|
|
||||||
|
(defadvice! doom--dont-prettify-saveplace-cache-a (orig-fn)
|
||||||
|
"`save-place-alist-to-file' uses `pp' to prettify the contents of its cache.
|
||||||
|
`pp' can be expensive for longer lists, and there's no reason to prettify cache
|
||||||
|
files, so we replace calls to `pp' with the much faster `prin1'."
|
||||||
|
:around #'save-place-alist-to-file
|
||||||
|
(cl-letf (((symbol-function #'pp)
|
||||||
|
(symbol-function #'prin1)))
|
||||||
|
(funcall orig-fn)))
|
||||||
|
|
||||||
(save-place-mode +1))
|
(save-place-mode +1))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue