Skip to content

Commit af2bfc2

Browse files
Zzullbbatsov
authored andcommitted
Find a suitable directory to store the project's history more robustly
1 parent 44a91a4 commit af2bfc2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cider-repl.el

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,12 @@ It does not yet set the input history."
16101610
(read (current-buffer))))
16111611
'()))
16121612

1613+
(defun cider-repl--find-dir-for-history ()
1614+
"Find the first suitable directory to store the project's history."
1615+
(seq-find
1616+
(lambda (dir) (and (not (null dir)) (not (tramp-tramp-file-p dir))))
1617+
(list nrepl-project-dir (clojure-project-dir) default-directory)))
1618+
16131619
(defun cider-repl-history-load (&optional filename)
16141620
"Load history from FILENAME into current session.
16151621
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."
16211627
(filename (setq cider-repl-history-file filename))
16221628
((equal 'per-project cider-repl-history-file)
16231629
(make-local-variable 'cider-repl-input-history)
1624-
(when-let ((dir (clojure-project-dir)))
1630+
(when-let ((dir (cider-repl--find-dir-for-history)))
16251631
(setq-local
16261632
cider-repl-history-file (expand-file-name ".cider-history" dir)))))
16271633
(when cider-repl-history-file

0 commit comments

Comments
 (0)