From: USAMI Kenta Date: Sat, 3 Feb 2024 18:20:24 +0000 (+0900) Subject: Fix 'browse-url-url-at-point' so that scheme does not duplicate X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=df01b4208ac2793b8680e499793be0da5db03c21;p=emacs.git Fix 'browse-url-url-at-point' so that scheme does not duplicate * lisp/net/browse-url.el (browse-url-url-at-point): Prepend the default scheme only if no scheme present. (Bug#68913) (cherry picked from commit ebf4ef2022a5f0a69cdd881eb41104e7b59d698e) --- diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 359453ca433..bc2a7db9a8b 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -688,8 +688,10 @@ websites are increasingly rare, but they do still exist." (defun browse-url-url-at-point () (or (thing-at-point 'url t) ;; assume that the user is pointing at something like gnu.org/gnu - (let ((f (thing-at-point 'filename t))) - (and f (concat browse-url-default-scheme "://" f))))) + (when-let ((f (thing-at-point 'filename t))) + (if (string-match-p browse-url-button-regexp f) + f + (concat browse-url-default-scheme "://" f))))) ;; Having this as a separate function called by the browser-specific ;; functions allows them to be stand-alone commands, making it easier