Fix `speedbar-directory-buttons' when using Tramp

* lisp/speedbar.el (speedbar-directory-buttons): Make speedbar
work with directories accessed via Tramp (bug#44622).

Copyright-paperwork-exempt: yes
This commit is contained in:
Daniel Lenski 2020-11-14 17:07:49 +01:00 committed by Lars Ingebrigtsen
parent 61dca6e92a
commit 5afad3918b

View file

@ -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))