GNU bug report logs - #44622
[PATCH v2] speedbar bugfix: only replace '~/' when it appears at the beginning of the path

Previous Next

Package: emacs;

Reported by: Daniel Lenski <dlenski <at> gmail.com>

Date: Fri, 13 Nov 2020 18:55:01 UTC

Severity: normal

Tags: moreinfo

Merged with 44608

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Daniel Lenski <dlenski <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: Andreas Schwab <schwab <at> linux-m68k.org>, Daniel Lenski <dlenski <at> gmail.com>
Subject: [PATCH v2] speedbar bugfix: only replace '~/' when it appears at the
 beginning of the path
Date: Fri, 13 Nov 2020 10:51:38 -0800
This makes Speedbar work correctly with remote directories accessed through TRAMP. This bug has apparently been known for a long time: https://cedet-devel.narkive.com/eIs7LoWB/speedbar-and-tramp#post2

Signed-off-by: Daniel Lenski <dlenski <at> gmail.com>
---
 lisp/speedbar.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 991c8a33d4..3619b23d9e 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -1874,9 +1874,9 @@ matches the user directory ~, then it is replaced with a ~.
 INDEX is not used, but is required by the caller."
   (let* ((tilde (expand-file-name "~/"))
 	 (dd (expand-file-name directory))
-	 (junk (string-match (regexp-quote tilde) dd))
+	 (junk (string-prefix-p "~/" dd))
 	 (displayme (if junk
-			(concat "~/" (substring dd (match-end 0)))
+			(concat "~/" (substring dd 2 nil))
 		      dd))
 	 (p (point)))
     (if (string-match "^~[/\\]?\\'" displayme) (setq displayme tilde))
-- 
2.17.1





This bug report was last modified 3 years and 269 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.