Skip to content

Commit

Permalink
Find a suitable directory to store the project's history more robustly
Browse files Browse the repository at this point in the history
  • Loading branch information
Baptiste Strazzulla committed Nov 21, 2024
1 parent 5b5d412 commit ea60298
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cider-repl.el
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,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
Expand All @@ -1625,7 +1631,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
Expand Down

0 comments on commit ea60298

Please sign in to comment.