branch: elpa/cider
commit af2bfc28ef34ec70745f9a4bacd7c485dc3eaf9d
Author: Baptiste Strazzulla <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Find a suitable directory to store the project's history more robustly
---
cider-repl.el | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/cider-repl.el b/cider-repl.el
index c8155beebd..6c89426fbe 100644
--- a/cider-repl.el
+++ b/cider-repl.el
@@ -1610,6 +1610,12 @@ It does not yet set the input history."
(read (current-buffer))))
'()))
+(defun cider-repl--find-dir-for-history ()
+ "Find the first suitable directory to store the project's history."
+ (seq-find
+ (lambda (dir) (and (not (null dir)) (not (tramp-tramp-file-p dir))))
+ (list nrepl-project-dir (clojure-project-dir) default-directory)))
+
(defun cider-repl-history-load (&optional filename)
"Load history from FILENAME into current session.
FILENAME defaults to the value of `cider-repl-history-file' but user
@@ -1621,7 +1627,7 @@ The value of `cider-repl-input-history' is set by this
function."
(filename (setq cider-repl-history-file filename))
((equal 'per-project cider-repl-history-file)
(make-local-variable 'cider-repl-input-history)
- (when-let ((dir (clojure-project-dir)))
+ (when-let ((dir (cider-repl--find-dir-for-history)))
(setq-local
cider-repl-history-file (expand-file-name ".cider-history" dir)))))
(when cider-repl-history-file