unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#44608: [PATCH] speedbar bugfix: only replace '~/' when it appears at the beginning of the path
@ 2020-11-13  0:46 Daniel Lenski
  2020-11-13 10:08 ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Lenski @ 2020-11-13  0:46 UTC (permalink / raw)
  To: 44608; +Cc: Daniel Lenski

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@gmail.com>
---
 lisp/speedbar.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 991c8a3..3542936 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -1874,7 +1874,7 @@ 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-match (concat "^" (regexp-quote tilde)) dd))
 	 (displayme (if junk
 			(concat "~/" (substring dd (match-end 0)))
 		      dd))
-- 
2.17.1






^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#44608: [PATCH] speedbar bugfix: only replace '~/' when it appears at the beginning of the path
  2020-11-13  0:46 bug#44608: [PATCH] speedbar bugfix: only replace '~/' when it appears at the beginning of the path Daniel Lenski
@ 2020-11-13 10:08 ` Andreas Schwab
  2020-11-13 18:51   ` bug#44622: [PATCH v2] " Daniel Lenski
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2020-11-13 10:08 UTC (permalink / raw)
  To: Daniel Lenski; +Cc: 44608

On Nov 12 2020, Daniel Lenski wrote:

> 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@gmail.com>
> ---
>  lisp/speedbar.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/speedbar.el b/lisp/speedbar.el
> index 991c8a3..3542936 100644
> --- a/lisp/speedbar.el
> +++ b/lisp/speedbar.el
> @@ -1874,7 +1874,7 @@ 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-match (concat "^" (regexp-quote tilde)) dd))

That should use string-prefix-p.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#44622: [PATCH v2] speedbar bugfix: only replace '~/' when it appears at the beginning of the path
  2020-11-13 10:08 ` Andreas Schwab
@ 2020-11-13 18:51   ` Daniel Lenski
  2020-11-14 16:08     ` Lars Ingebrigtsen
  2020-11-14 16:31     ` bug#44622: [PATCH v2] " Andreas Schwab
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Lenski @ 2020-11-13 18:51 UTC (permalink / raw)
  To: 44622; +Cc: Andreas Schwab, Daniel Lenski

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






^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#44622: [PATCH v2] speedbar bugfix: only replace '~/' when it appears at the beginning of the path
  2020-11-13 18:51   ` bug#44622: [PATCH v2] " Daniel Lenski
@ 2020-11-14 16:08     ` Lars Ingebrigtsen
  2021-07-31 12:56       ` bug#44608: [PATCH] " Lars Ingebrigtsen
  2020-11-14 16:31     ` bug#44622: [PATCH v2] " Andreas Schwab
  1 sibling, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2020-11-14 16:08 UTC (permalink / raw)
  To: Daniel Lenski; +Cc: Andreas Schwab, 44622

Daniel Lenski <dlenski@gmail.com> writes:

> 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

Thanks; applied to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#44622: [PATCH v2] speedbar bugfix: only replace '~/' when it appears at the beginning of the path
  2020-11-13 18:51   ` bug#44622: [PATCH v2] " Daniel Lenski
  2020-11-14 16:08     ` Lars Ingebrigtsen
@ 2020-11-14 16:31     ` Andreas Schwab
  1 sibling, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2020-11-14 16:31 UTC (permalink / raw)
  To: Daniel Lenski; +Cc: 44622

On Nov 13 2020, Daniel Lenski wrote:

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

That should match tilde, not "~/" (which will never match).

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#44608: [PATCH] speedbar bugfix: only replace '~/' when it appears at the beginning of the path
  2020-11-14 16:08     ` Lars Ingebrigtsen
@ 2021-07-31 12:56       ` Lars Ingebrigtsen
  2021-08-29 20:17         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-31 12:56 UTC (permalink / raw)
  To: Daniel Lenski; +Cc: 44608, Andreas Schwab, 44622

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Daniel Lenski <dlenski@gmail.com> writes:
>
>> 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
>
> Thanks; applied to Emacs 28.

And now I've reverted it, because it doesn't really look like it could
possibly be correct.

The URL is dead -- do you have a test case that demonstrates the
original problem?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#44608: [PATCH] speedbar bugfix: only replace '~/' when it appears at the beginning of the path
  2021-07-31 12:56       ` bug#44608: [PATCH] " Lars Ingebrigtsen
@ 2021-08-29 20:17         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-29 20:17 UTC (permalink / raw)
  To: Daniel Lenski; +Cc: 44608, Andreas Schwab, 44622

Lars Ingebrigtsen <larsi@gnus.org> writes:

> And now I've reverted it, because it doesn't really look like it could
> possibly be correct.
>
> The URL is dead -- do you have a test case that demonstrates the
> original problem?

More information was requested, but no response was given within a
month, so I'm closing this bug report.  If the problem still exists,
please respond to this email and we'll reopen the bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-29 20:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13  0:46 bug#44608: [PATCH] speedbar bugfix: only replace '~/' when it appears at the beginning of the path Daniel Lenski
2020-11-13 10:08 ` Andreas Schwab
2020-11-13 18:51   ` bug#44622: [PATCH v2] " Daniel Lenski
2020-11-14 16:08     ` Lars Ingebrigtsen
2021-07-31 12:56       ` bug#44608: [PATCH] " Lars Ingebrigtsen
2021-08-29 20:17         ` Lars Ingebrigtsen
2020-11-14 16:31     ` bug#44622: [PATCH v2] " Andreas Schwab

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).