emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/cider 012e3fe71f 14/15: Make TRAMP functionality work when


From: ELPA Syncer
Subject: [nongnu] elpa/cider 012e3fe71f 14/15: Make TRAMP functionality work when using non-standard ports
Date: Fri, 18 Aug 2023 06:59:23 -0400 (EDT)

branch: elpa/cider
commit 012e3fe71fef324856db74d26a29b239c3eceb88
Author: vemv <vemv@users.noreply.github.com>
Commit: vemv <vemv@users.noreply.github.com>

    Make TRAMP functionality work when using non-standard ports
---
 CHANGELOG.md               | 1 +
 cider-common.el            | 8 +++++---
 test/cider-common-tests.el | 8 +++++++-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 530f7ca036..efd32c4c1a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,6 +27,7 @@
 - Recompute namespace info on each fighweel-main recompilation.
 - Fix the `xref-find-definitions` CIDER backend to return correct filenames.
 - Fix the `cider-xref-fn-deps` buttons to direct to the right file.
+- Make TRAMP functionality work when using non-standard ports.
 
 ### Changes
 
diff --git a/cider-common.el b/cider-common.el
index 90a7382a5d..4225a5434b 100644
--- a/cider-common.el
+++ b/cider-common.el
@@ -226,8 +226,8 @@ create a valid path."
         (match-string 1 filename)
       filename)))
 
-(defun cider-make-tramp-prefix (method user host)
-  "Constructs a Tramp file prefix from METHOD, USER, HOST.
+(defun cider-make-tramp-prefix (method user host &optional port)
+  "Constructs a Tramp file prefix from METHOD, USER, HOST, PORT.
 It originated from Tramp's `tramp-make-tramp-file-name'.  The original be
 forced to make full file name with `with-parsed-tramp-file-name', not providing
 prefix only option."
@@ -240,6 +240,8 @@ prefix only option."
             (if (string-match tramp-ipv6-regexp host)
                 (concat tramp-prefix-ipv6-format host 
tramp-postfix-ipv6-format)
               host))
+          (when port
+            (concat "#" port))
           tramp-postfix-host-format))
 
 (defun cider-tramp-prefix (&optional buffer)
@@ -253,7 +255,7 @@ if BUFFER is local."
     (when (tramp-tramp-file-p name)
       (with-parsed-tramp-file-name name v
         (with-no-warnings
-          (cider-make-tramp-prefix v-method v-user v-host))))))
+          (cider-make-tramp-prefix v-method v-user v-host v-port))))))
 
 (defun cider--client-tramp-filename (name &optional buffer)
   "Return the tramp filename for path NAME relative to BUFFER.
diff --git a/test/cider-common-tests.el b/test/cider-common-tests.el
index b918811b72..92df2bbe71 100644
--- a/test/cider-common-tests.el
+++ b/test/cider-common-tests.el
@@ -68,9 +68,15 @@
 
 (describe "cider-make-tramp-prefix"
   (it "returns tramp-prefix only"
-      ;;; The third parameter is a host. It must contains a port number.
+      ;;; The third parameter is a host.
       (expect (cider-make-tramp-prefix "ssh" "cider-devs" "192.168.50.9#22")
               :to-equal "/ssh:cider-devs@192.168.50.9#22:")
+      (expect (cider-make-tramp-prefix "ssh" "cider-devs" "192.168.50.9")
+              :to-equal "/ssh:cider-devs@192.168.50.9#22:")
+      (expect (cider-make-tramp-prefix "ssh" "cider-devs" "192.168.50.9" 
"12345")
+              :to-equal "/ssh:cider-devs@192.168.50.9#12345:")
+      (expect (cider-make-tramp-prefix "ssh" "cider-devs" "192.168.50.9#12345")
+              :to-equal "/ssh:cider-devs@192.168.50.9#12345:")
       ;;; These two cases are for using ssh config alias.
       (expect (cider-make-tramp-prefix "ssh" nil "test.cider.com")
               :to-equal "/ssh:test.cider.com:")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]