summaryrefslogtreecommitdiff
path: root/cider.el
diff options
context:
space:
mode:
authorshlomiv <shlomivaknin@gmail.com>2018-07-27 08:29:12 -0700
committerBozhidar Batsov <bozhidar.batsov@gmail.com>2018-07-27 18:29:12 +0300
commit650b60bbf43493039fedf4d3307a1a0a56ab7f0d (patch)
treece83a47af947478f5c581c6fd7c0865e30908aaf /cider.el
parent7c66b4a82306fc1b25c89002d4222446b1b151f0 (diff)
Fix tramp usage for Emacs 26.1 and up (#2390)
Diffstat (limited to 'cider.el')
-rw-r--r--cider.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/cider.el b/cider.el
index 298b3608..1445184b 100644
--- a/cider.el
+++ b/cider.el
@@ -1199,6 +1199,13 @@ Return a list of the form (HOST PORT), where PORT can be nil."
;; remove the label
(if (= 3 (length host)) (cdr host) host)))
+(defun cider--tramp-file-name (vec)
+ "Tramp version starting 26.1 is using a 'cl-defstruct' rather than vanilla VEC."
+ (if (version< emacs-version "26.1") vec
+ (with-no-warnings
+ (make-tramp-file-name :method (elt vec 0)
+ :host (elt vec 2)))))
+
(defun cider--infer-ports (host ssh-hosts)
"Infer nREPL ports on HOST.
Return a list of elements of the form (directory port). SSH-HOSTS is a list
@@ -1215,8 +1222,8 @@ of remote SSH hosts."
(dir (when (file-remote-p default-directory)
(with-parsed-tramp-file-name default-directory cur
(when (string= cur-host host) default-directory)))))
- (tramp-maybe-open-connection vec)
- (with-current-buffer (tramp-get-connection-buffer vec)
+ (tramp-maybe-open-connection (cider--tramp-file-name vec))
+ (with-current-buffer (tramp-get-connection-buffer (cider--tramp-file-name vec))
(cider-locate-running-nrepl-ports dir))))))
(defun cider--completing-read-port (host ports)