unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#74730: [PATCH] 30.0.92; eww-browse-with-external-browser and eww-follow-link should use browse-url-with-browser-kind
@ 2024-12-07 22:02 Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-12-08  5:57 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-07 22:02 UTC (permalink / raw)
  To: 74730

[-- Attachment #1: Type: text/plain, Size: 1021 bytes --]

Tags: patch

The command `eww-browse-with-external-browser' uses
`browse-url-secondary-browser-function'. This makes the command
ineffective in the common setup where
`browse-url-secondary-browser-function' is set to `eww-browse-url' and
`browse-url-browser-function' is set to an external browser.

Fortunately we can use `browse-url-with-browser-kind' instead, which
guarantees that an external browser is launched.

Furthermore `eww-follow-link' should use `browse-url-with-browser-kind'
if the EXTERNAL prefix argument is non-nil.

I've looked at all other uses of `browse-url-browser-function' and
`browse-url-secondary-browser-function' in the Emacs code base and I
have not found other problems. Most commands use a prefix argument to
switch to the secondary browser, relying on the primary browser by
default. The problem is limited to `eww-browse-with-external-browser'
and `eww-follow-link'.

In GNU Emacs 30.0.92 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.18.2, Xaw scroll bars) of 2024-11-20


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-eww-Use-browse-url-browser-kind-for-external-browsin.patch --]
[-- Type: text/patch, Size: 2280 bytes --]

From 361b9d970631b3547bd859fb8686597e651447ce Mon Sep 17 00:00:00 2001
From: Daniel Mendler <mail@daniel-mendler.de>
Date: Sat, 7 Dec 2024 22:56:15 +0100
Subject: [PATCH] eww: Use browse-url-browser-kind for external browsing

Guarantee that an external browser is used by Eww even if
`browse-url-secondary-browser-function' is set to `eww-browse-url'.

* lisp/net/eww.el (eww-browse-with-external-browser): Use
`browse-url-with-browser-kind'.
(eww-follow-link): Use `browse-url-with-browser-kind' if the
EXTERNAL prefix argument is non-nil.
---
 lisp/net/eww.el | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 4d4d4d6beac..bace519c7c4 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -2141,12 +2141,11 @@ eww-submit
 	(mm-url-encode-www-form-urlencoded values))))))
 
 (defun eww-browse-with-external-browser (&optional url)
-  "Browse the current URL with an external browser.
-The browser to used is specified by the
-`browse-url-secondary-browser-function' variable."
+  "Browse the current URL with an external browser."
   (interactive nil eww-mode)
-  (funcall browse-url-secondary-browser-function
-           (or url (plist-get eww-data :url))))
+  (browse-url-with-browser-kind
+   'external
+   (or url (plist-get eww-data :url))))
 
 (defun eww-remove-tracking (url)
   "Remove the commong utm_ tracking cookies from URLs."
@@ -2161,9 +2160,7 @@ eww--transform-url
 
 (defun eww-follow-link (&optional external mouse-event)
   "Browse the URL under point.
-If EXTERNAL is single prefix, browse the URL using
-`browse-url-secondary-browser-function'.
-
+If EXTERNAL is single prefix, browse the URL using an external browser.
 If EXTERNAL is double prefix, browse in new buffer."
   (interactive
    (list current-prefix-arg last-nonmenu-event)
@@ -2180,7 +2177,7 @@ eww-follow-link
       ;; and `browse-url-mailto-function'.
       (browse-url url))
      ((and (consp external) (<= (car external) 4))
-      (funcall browse-url-secondary-browser-function url)
+      (browse-url-with-browser-kind 'external url)
       (shr--blink-link))
      ;; This is a #target url in the same page as the current one.
      ((and (setq target (url-target (url-generic-parse-url url)))
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-12-12 10:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-07 22:02 bug#74730: [PATCH] 30.0.92; eww-browse-with-external-browser and eww-follow-link should use browse-url-with-browser-kind Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08  5:57 ` Eli Zaretskii
2024-12-08  6:13   ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08  7:03     ` Eli Zaretskii
2024-12-08  7:27   ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08 12:02     ` Eli Zaretskii
2024-12-08 13:00       ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08 13:32         ` Eli Zaretskii
2024-12-08 17:39           ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-12 10:42             ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).