Skip to content

Commit 122a40f

Browse files
committed
Force ns caching for ns lookup related to dynamic indentation
That's another take at clojure-emacs/clojure-mode#478. The original solution enabled ns caching globally in `clojure-mode`, but this created problems for people who'd change a namespace without noticing they have to invalidate the cached value. As that's the only real hotspot for `clojure-find-ns` (used internally in `cider-current-ns`) we can simply let-bind the caching in this scope and leave evaluations out of this.
1 parent 63b4fca commit 122a40f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cider-mode.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,8 @@ re-visited."
525525

526526
(defun cider--get-symbol-indent (symbol-name)
527527
"Return the indent metadata for SYMBOL-NAME in the current namespace."
528-
(let* ((ns (cider-current-ns)))
528+
(let* ((ns (let ((clojure-cache-ns t)) ; we force ns caching here for performance reasons
529+
(cider-current-ns))))
529530
(if-let* ((meta (cider-resolve-var ns symbol-name))
530531
(indent (or (nrepl-dict-get meta "style/indent")
531532
(nrepl-dict-get meta "indent"))))

0 commit comments

Comments
 (0)