summaryrefslogtreecommitdiff
path: root/cider-interaction.el
diff options
context:
space:
mode:
authorPeter Jaros <peter.a.jaros@gmail.com>2015-09-15 12:43:41 -0400
committerPeter Jaros <peter.a.jaros@gmail.com>2015-09-15 12:43:41 -0400
commit9628aea4ad052c0c6c6144e13d0efb1293680cb7 (patch)
tree3628e816a7059427165b020d95c9ccff10c2d600 /cider-interaction.el
parentcc1011c3fb8aa9ec02e3d3d3deeb197f927efae0 (diff)
Show the project directory as default when picking
`read-directory-name` takes a default directory name as its 3rd argument, `default-dirname`, but this is merely the value which is returned if the user doesn't change the value when prompted. It's not the value which is initially *displayed*. That value is the 5th argument, `initial`. Without specifying an `initial`, the apparent initial value is the 2nd argument `dir`, and when `dir` is nil (as it is here), it defaults to the buffer's `default-directory`. Thus, before this change, the default value of this prompt would *appear* to be the buffer's `default-directory`, but accepting the initial value would in fact return `(clojure-project-dir)`, the given `default-dirname`. Providing `(clojure-project-dir)` as the `initial` as well matches the initial apparent value in the prompt to the actual value that will be returned if the user accepts what is displayed. Why this is not inherent to the way `read-directory-name`/`read-file-name` works is beyond me.
Diffstat (limited to 'cider-interaction.el')
-rw-r--r--cider-interaction.el2
1 files changed, 1 insertions, 1 deletions
diff --git a/cider-interaction.el b/cider-interaction.el
index 89cbede5..823e2bf5 100644
--- a/cider-interaction.el
+++ b/cider-interaction.el
@@ -532,7 +532,7 @@ such a link cannot be established automatically."
(interactive)
(cider-ensure-connected)
(let ((conn-buf (or connection (completing-read "Connection: " (cider-connections))))
- (project-dir (or project (read-directory-name "Project directory: " nil (clojure-project-dir)))))
+ (project-dir (or project (read-directory-name "Project directory: " nil (clojure-project-dir) nil (clojure-project-dir)))))
(when conn-buf
(with-current-buffer conn-buf
(setq nrepl-project-dir project-dir)))))