]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix 'browse-url-url-at-point' so that scheme does not duplicate
authorUSAMI Kenta <tadsan@zonu.me>
Sat, 3 Feb 2024 18:20:24 +0000 (03:20 +0900)
committerEshel Yaron <me@eshelyaron.com>
Fri, 9 Feb 2024 10:44:24 +0000 (11:44 +0100)
* 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)

lisp/net/browse-url.el

index 359453ca43345d366e0e5402eb31b1f3a4a002fe..bc2a7db9a8bb8c8a5bc47452dda7d3c8e5e55216 100644 (file)
@@ -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