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)
This commit is contained in:
USAMI Kenta
2024-02-04 03:20:24 +09:00
committed by Eli Zaretskii
parent bc099295dd
commit ebf4ef2022

View 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