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

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

[elpa] externals/hyperbole e5130d49a1: Adjust to new tramp regexp in ema


From: ELPA Syncer
Subject: [elpa] externals/hyperbole e5130d49a1: Adjust to new tramp regexp in emacs 29 (#273)
Date: Tue, 13 Sep 2022 17:57:45 -0400 (EDT)

branch: externals/hyperbole
commit e5130d49a15f85d0fd1910262ecb50664755548b
Author: Mats Lidell <mats.lidell@lidells.se>
Commit: GitHub <noreply@github.com>

    Adjust to new tramp regexp in emacs 29 (#273)
    
    * Add test case for hpath:remote-at-p
    
    * Modify regexp based on tramp regexp value
---
 ChangeLog           |  8 ++++++++
 hpath.el            |  8 ++++++--
 test/hpath-tests.el | 10 +++++++++-
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b6e6eabbad..b708f1e5f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-09-12  Mats Lidell  <matsl@gnu.org>
+
+* hpath.el (hpath:tramp-file-name-regexp): Handle tramp regexp from
+    different Emacs versions.
+
+* test/hpath-tests.el (hpath:remote-at-p): Add test case for
+    hpath:remote-at-p.
+
 2022-08-29  Bob Weiner  <rsw@gnu.org>
 
 * hbut.el (ebut:key-src): Rename to 'ebut:to-key-src'.
diff --git a/hpath.el b/hpath.el
index b8c042c992..517d9d10fb 100644
--- a/hpath.el
+++ b/hpath.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     1-Nov-91 at 00:44:23
-;; Last-Mod:     24-Jul-22 at 01:02:25 by Bob Weiner
+;; Last-Mod:     12-Sep-22 at 23:57:39 by Mats Lidell
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -724,7 +724,11 @@ Removes bol anchor and removes match to empty string if 
present."
         (tramp-regexp (car (if (fboundp 'tramp-file-name-structure)
                                (tramp-file-name-structure)
                              tramp-file-name-structure))))
-    (substring-no-properties (replace-regexp-in-string "\\\\'" "" 
tramp-regexp) 1)))
+    (replace-regexp-in-string
+     "\\\\'" ""
+     (cond ((string-match-p "\\\\(\\?:^/\\\\)" tramp-regexp)
+            (replace-regexp-in-string  "\\\\(\\?:\\^/\\\\)" "\\(?:/\\)" 
tramp-regexp nil t))
+           (t (substring tramp-regexp 1))))))
 
 (defun hpath:remote-at-p ()
   "Return a remote pathname that point is within or nil.
diff --git a/test/hpath-tests.el b/test/hpath-tests.el
index cbb10bb54c..3e6d3de2ad 100644
--- a/test/hpath-tests.el
+++ b/test/hpath-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:    28-Feb-21 at 23:26:00
-;; Last-Mod:     24-Jul-22 at 10:31:32 by Bob Weiner
+;; Last-Mod:     12-Sep-22 at 22:11:14 by Mats Lidell
 ;;
 ;; Copyright (C) 2021-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -248,5 +248,13 @@
               (hy-test-helpers:action-key-should-call-hpath:find 
(expand-file-name py-file hyperb:dir)))))
       (setenv "PYTHONPATH" old-python-path))))
 
+(ert-deftest hpath:remote-at-p ()
+  "Verify hpath:remote-at-p match a tramp remote file name."
+  (let ((tramp-file "/ssh:user@host.org:/home/username/file"))
+    (with-temp-buffer
+      (insert (concat "\"" tramp-file "\""))
+      (goto-char 5)
+      (should (string= (hpath:remote-at-p) tramp-file)))))
+
 (provide 'hpath-tests)
 ;;; hpath-tests.el ends here



reply via email to

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