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

From: Andreas Schwab <[email-masked]>
Date: Sat, 14 Nov 2020 17:31:40 +0100

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, [email-masked]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."