mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2026-09-10 07:46:51 -04:00
Call browser functions via `browse-url'
This is in order to apply `browse-url-transform-alist'. * lisp/net/browse-url.el (browse-url-with-browser-kind) (browse-url-button-open, browse-url-button-open-url): * lisp/net/shr.el (shr-browse-url): * lisp/net/eww.el (eww-browse-with-external-browser): * lisp/gnus/gnus-sum.el (gnus-summary-browse-url): * lisp/emacs-lisp/package.el (package-browse-url): Let-bind `browse-url-browser-function' and call `browse-url'.
This commit is contained in:
parent
95775d9338
commit
94051b2c9a
|
|
@ -4694,8 +4694,10 @@ DESC must be a `package-desc' object."
|
|||
(let ((url (cdr (assoc :url (package-desc-extras desc)))))
|
||||
(unless url
|
||||
(user-error "No website for %s" (package-desc-name desc)))
|
||||
(if secondary
|
||||
(funcall browse-url-secondary-browser-function url)
|
||||
(let ((browse-url-browser-function
|
||||
(if secondary
|
||||
browse-url-secondary-browser-function
|
||||
browse-url-browser-function)))
|
||||
(browse-url url))))
|
||||
|
||||
(declare-function ietf-drums-parse-address "ietf-drums"
|
||||
|
|
|
|||
|
|
@ -9410,7 +9410,7 @@ See `gnus-collect-urls'."
|
|||
(concat "#" target)))))
|
||||
(concat host (string-truncate-left rest (- max (length host)))))))
|
||||
|
||||
(defun gnus-summary-browse-url (&optional external)
|
||||
(defun gnus-summary-browse-url (&optional secondary)
|
||||
"Scan the current article body for links, and offer to browse them.
|
||||
|
||||
Links are opened using `browse-url' unless a prefix argument is
|
||||
|
|
@ -9431,9 +9431,11 @@ default."
|
|||
(gnus-shorten-url (car urls) 40))
|
||||
urls nil t nil nil (car urls))))))
|
||||
(if target
|
||||
(if external
|
||||
(funcall browse-url-secondary-browser-function target)
|
||||
(browse-url target))
|
||||
(let ((browse-url-browser-function
|
||||
(if secondary
|
||||
browse-url-secondary-browser-function
|
||||
browse-url-browser-function)))
|
||||
(browse-url target))
|
||||
(message "No URLs found."))))
|
||||
|
||||
(defun gnus-summary-isearch-article (&optional regexp-p)
|
||||
|
|
|
|||
|
|
@ -1000,7 +1000,10 @@ opposite of the browser kind of `browse-url-browser-function'."
|
|||
browse-url-secondary-browser-function
|
||||
#'browse-url-default-browser
|
||||
#'eww))))
|
||||
(funcall function url arg)))
|
||||
(let ((browse-url-browser-function function)
|
||||
(browse-url-handlers nil)
|
||||
(browse-url-default-handlers nil))
|
||||
(browse-url url))))
|
||||
|
||||
;;;###autoload
|
||||
(defun browse-url-at-mouse (event)
|
||||
|
|
@ -1788,17 +1791,19 @@ clickable and will use `browse-url' to open the URLs in question."
|
|||
browse-url-data ,(match-string 0)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun browse-url-button-open (&optional external mouse-event)
|
||||
(defun browse-url-button-open (&optional secondary mouse-event)
|
||||
"Follow the link under point using `browse-url'.
|
||||
If EXTERNAL (the prefix if used interactively), open with the
|
||||
external browser instead of the default one."
|
||||
If SECONDARY (the prefix if used interactively), open with the
|
||||
secondary browser instead of the default one."
|
||||
(interactive (list current-prefix-arg last-nonmenu-event))
|
||||
(mouse-set-point mouse-event)
|
||||
(let ((url (get-text-property (point) 'browse-url-data)))
|
||||
(unless url
|
||||
(error "No URL under point"))
|
||||
(if external
|
||||
(funcall browse-url-secondary-browser-function url)
|
||||
(let ((browse-url-browser-function
|
||||
(if secondary
|
||||
browse-url-secondary-browser-function
|
||||
browse-url-browser-function)))
|
||||
(browse-url url))))
|
||||
|
||||
;;;###autoload
|
||||
|
|
@ -1806,8 +1811,10 @@ external browser instead of the default one."
|
|||
"Open URL using `browse-url'.
|
||||
If `current-prefix-arg' is non-nil, use
|
||||
`browse-url-secondary-browser-function' instead."
|
||||
(if current-prefix-arg
|
||||
(funcall browse-url-secondary-browser-function url)
|
||||
(let ((browse-url-browser-function
|
||||
(if current-prefix-arg
|
||||
browse-url-secondary-browser-function
|
||||
browse-url-browser-function)))
|
||||
(browse-url url)))
|
||||
|
||||
(defun browse-url-button-copy ()
|
||||
|
|
|
|||
|
|
@ -2257,7 +2257,8 @@ external browser."
|
|||
(setq url (or url (plist-get eww-data :url)))
|
||||
(if (eq 'external (browse-url--browser-kind
|
||||
browse-url-secondary-browser-function url))
|
||||
(funcall browse-url-secondary-browser-function url)
|
||||
(let ((browse-url-browser-function browse-url-secondary-browser-function))
|
||||
(browse-url url))
|
||||
(browse-url-with-browser-kind 'external url)))
|
||||
|
||||
(defun eww-remove-tracking (url)
|
||||
|
|
|
|||
|
|
@ -1097,9 +1097,9 @@ When `shr-fill-text' is nil, only indent."
|
|||
(mouse-set-point ev)
|
||||
(shr-browse-url nil nil t))
|
||||
|
||||
(defun shr-browse-url (&optional external mouse-event new-window)
|
||||
(defun shr-browse-url (&optional secondary mouse-event new-window)
|
||||
"Browse the URL at point using `browse-url'.
|
||||
If EXTERNAL is non-nil (interactively, the prefix argument), browse
|
||||
If SECONDARY is non-nil (interactively, the prefix argument), browse
|
||||
the URL using `browse-url-secondary-browser-function'.
|
||||
If this function is invoked by a mouse click, it will browse the URL
|
||||
at the position of the click. Optional argument MOUSE-EVENT describes
|
||||
|
|
@ -1110,8 +1110,9 @@ the mouse click event."
|
|||
(cond
|
||||
((not url)
|
||||
(message "No link under point"))
|
||||
(external
|
||||
(funcall browse-url-secondary-browser-function url)
|
||||
(secondary
|
||||
(let ((browse-url-browser-function browse-url-secondary-browser-function))
|
||||
(browse-url url))
|
||||
(shr--blink-link))
|
||||
(t
|
||||
(browse-url url (xor new-window browse-url-new-window-flag))))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue