summaryrefslogtreecommitdiff
path: root/cider-mode.el
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.com>2018-07-26 09:11:35 +0300
committerBozhidar Batsov <bozhidar@batsov.com>2018-07-26 09:11:35 +0300
commit122a40fd6ed9bb14387eac62aeed65cfd32b5a0b (patch)
tree75062ec01af0b3cb0a6dbc161c07076c4ff8cb59 /cider-mode.el
parent63b4fcac4da76ec8f2b44539e6c8c7095e1b3227 (diff)
Force ns caching for ns lookup related to dynamic indentation
That's another take at https://github.com/clojure-emacs/clojure-mode/issues/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.
Diffstat (limited to 'cider-mode.el')
-rw-r--r--cider-mode.el3
1 files changed, 2 insertions, 1 deletions
diff --git a/cider-mode.el b/cider-mode.el
index 72362380..17ed2ff9 100644
--- a/cider-mode.el
+++ b/cider-mode.el
@@ -525,7 +525,8 @@ re-visited."
(defun cider--get-symbol-indent (symbol-name)
"Return the indent metadata for SYMBOL-NAME in the current namespace."
- (let* ((ns (cider-current-ns)))
+ (let* ((ns (let ((clojure-cache-ns t)) ; we force ns caching here for performance reasons
+ (cider-current-ns))))
(if-let* ((meta (cider-resolve-var ns symbol-name))
(indent (or (nrepl-dict-get meta "style/indent")
(nrepl-dict-get meta "indent"))))