Skip to content

Commit

Permalink
[Fix clojure-emacs#589] Don't preference home directory resources to …
Browse files Browse the repository at this point in the history
…tramp by default.

Rename `cider-use-local-resources` to `cider-prefer-local-resources` and
set default value to nil.

Rename `cider-emacs-or-clojure-side-adjustment` to `cider-file-path` for
clarity (and brevity!).
  • Loading branch information
jeffvalk committed Jun 1, 2014
1 parent 7a63d2b commit 437b7e3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cider-interaction.el
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
(defconst cider-doc-buffer "*cider-doc*")
(defconst cider-result-buffer "*cider-result*")

(defcustom cider-use-local-resources t
"Use local resources under HOME if possible."
(defcustom cider-prefer-local-resources nil
"Prefer local resources under HOME if available."
:type 'boolean
:group 'cider)

Expand Down Expand Up @@ -504,13 +504,13 @@ Removes any leading slash if on Windows."
(t
resource))))

(defun cider-emacs-or-clojure-side-adjustment (resource)
"Fix the RESOURCE path depending on `cider-use-local-resources`."
(defun cider-file-path (resource)
"Return the client or server RESOURCE path using `cider-prefer-local-resources'."
(let ((resource (cider-home-prefix-adjustment resource))

This comment has been minimized.

Copy link
@jeffvalk

jeffvalk Jun 1, 2014

Author Owner

Also, either this let was intended to be a let*, or this code style is pretty obtuse. Does anyone actually use this "home-prefix-adjustment"?

This comment has been minimized.

Copy link
@bbatsov

bbatsov Jun 1, 2014

You're right. As no one has complained about this ever I think you can safely remove it.

(clojure-side-res (concat (cider-tramp-prefix) resource))
(emacs-side-res resource))
(cond ((equal resource "") resource)
((and cider-use-local-resources
((and cider-prefer-local-resources
(file-exists-p emacs-side-res))
emacs-side-res)
((file-exists-p clojure-side-res)
Expand All @@ -523,7 +523,7 @@ Removes any leading slash if on Windows."
Adjusts for HOME location using `cider-home-prefix-adjustment'.
Uses `find-file'."
(let ((large-file-warning-threshold nil))
(find-file (cider-emacs-or-clojure-side-adjustment filename))))
(find-file (cider-file-path filename))))

(defun cider-find-resource (resource)
"Find and display RESOURCE."
Expand All @@ -532,7 +532,7 @@ Uses `find-file'."
((string-match "^\\(jar\\|zip\\):file:\\(.+\\)!/\\(.+\\)" resource)
(let* ((jar (match-string 2 resource))
(path (match-string 3 resource))
(file (cider-emacs-or-clojure-side-adjustment jar))
(file (cider-file-path jar))
(name (format "%s:%s" jar path)))
(switch-to-buffer
(or (get-file-buffer name)
Expand Down

0 comments on commit 437b7e3

Please sign in to comment.