* bug#74820: [PATCH] browse-url-with-browser-kind: Improve browser function selection
@ 2024-12-12 11:41 Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-17 11:16 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-21 9:34 ` Eli Zaretskii
0 siblings, 2 replies; 5+ messages in thread
From: Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-12 11:41 UTC (permalink / raw)
To: 74820
[-- Attachment #1: Type: text/plain, Size: 508 bytes --]
Tags: patch
In order to find an appropriate browser function for the given
kind, first the browser handler lists are consulted. If no
handler is found, the `browse-url-browser-function',
`browse-url-secondary-browser-function`,
`browse-url-default-browser' and `eww' are tried in that order
until a browser function with a matching kind is found. This
way the user customization of `browse-url-browser-function' and
`browse-url-secondary-browser-function` is respected by
`browse-url-with-browser-kind'.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-browse-url-with-browser-kind-Improve-browser-functio.patch --]
[-- Type: text/patch, Size: 2498 bytes --]
From f2972d6074e314e43fbb9630e5b597ff2ae47b22 Mon Sep 17 00:00:00 2001
From: Daniel Mendler <mail@daniel-mendler.de>
Date: Thu, 12 Dec 2024 12:15:10 +0100
Subject: [PATCH] browse-url-with-browser-kind: Improve browser function
selection
In order to find an appropriate browser function for the given
kind, first the browser handler lists are consulted. If no
handler is found, the `browse-url-browser-function',
`browse-url-secondary-browser-function`,
`browse-url-default-browser' and `eww' are tried in that order
until a browser function with a matching kind is found. This
way the user customization of `browse-url-browser-function' and
`browse-url-secondary-browser-function` is respected by
`browse-url-with-browser-kind'.
* lisp/net/browse-url.el (browse-url-with-browser-kind): Try the
browser functions in the aforementioned order.
---
lisp/net/browse-url.el | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index 10165465921..e43f96c1fd5 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -976,7 +976,13 @@ browse-url-at-point
;;;###autoload
(defun browse-url-with-browser-kind (kind url &optional arg)
"Browse URL with a browser of the given browser KIND.
-KIND is either `internal' or `external'.
+
+KIND is either `internal' or `external'. In order to find an
+appropriate browser for the given KIND, first the `browse-url-handlers'
+and `browse-url-default-handlers' lists are consulted. If no handler is
+found, the functions `browse-url-browser-function',
+`browse-url-secondary-browser-function', `browse-url-default-browser'
+and `eww' are tried in that order.
When called interactively, the default browser kind is the
opposite of the browser kind of `browse-url-browser-function'."
@@ -996,9 +1002,14 @@ browse-url-with-browser-kind
(cons k url-arg)))
(let ((function (browse-url-select-handler url kind)))
(unless function
- (setq function (if (eq kind 'external)
- #'browse-url-default-browser
- #'eww)))
+ (setq function
+ (seq-find
+ (lambda (fun)
+ (eq kind (browse-url--browser-kind fun url)))
+ (list browse-url-browser-function
+ browse-url-secondary-browser-function
+ #'browse-url-default-browser
+ #'eww))))
(funcall function url arg)))
;;;###autoload
--
2.45.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#74820: [PATCH] browse-url-with-browser-kind: Improve browser function selection
2024-12-12 11:41 bug#74820: [PATCH] browse-url-with-browser-kind: Improve browser function selection Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-12-17 11:16 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-17 13:49 ` Eli Zaretskii
2024-12-21 9:34 ` Eli Zaretskii
1 sibling, 1 reply; 5+ messages in thread
From: Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-17 11:16 UTC (permalink / raw)
To: 74820; +Cc: Eli Zaretskii
Daniel Mendler <mail@daniel-mendler.de> writes:
> Tags: patch
>
> In order to find an appropriate browser function for the given
> kind, first the browser handler lists are consulted. If no
> handler is found, the `browse-url-browser-function',
> `browse-url-secondary-browser-function`,
> `browse-url-default-browser' and `eww' are tried in that order
> until a browser function with a matching kind is found. This
> way the user customization of `browse-url-browser-function' and
> `browse-url-secondary-browser-function` is respected by
> `browse-url-with-browser-kind'.
Eli, do you have comments on this patch? I think it improves the
behavior of `browse-url-with-browser-kind' in relation to our recent
changes to `browse-url-browser-function' and `browse-url-secondary-browser-function',
which users can set to either internal or external browsers. Thanks.
Daniel
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#74820: [PATCH] browse-url-with-browser-kind: Improve browser function selection
2024-12-17 11:16 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-12-17 13:49 ` Eli Zaretskii
2024-12-17 13:57 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-12-17 13:49 UTC (permalink / raw)
To: Daniel Mendler; +Cc: 74820
> From: Daniel Mendler <mail@daniel-mendler.de>
> Cc: Eli Zaretskii <eliz@gnu.org>
> Date: Tue, 17 Dec 2024 12:16:54 +0100
>
> Daniel Mendler <mail@daniel-mendler.de> writes:
>
> > Tags: patch
> >
> > In order to find an appropriate browser function for the given
> > kind, first the browser handler lists are consulted. If no
> > handler is found, the `browse-url-browser-function',
> > `browse-url-secondary-browser-function`,
> > `browse-url-default-browser' and `eww' are tried in that order
> > until a browser function with a matching kind is found. This
> > way the user customization of `browse-url-browser-function' and
> > `browse-url-secondary-browser-function` is respected by
> > `browse-url-with-browser-kind'.
>
> Eli, do you have comments on this patch? I think it improves the
> behavior of `browse-url-with-browser-kind' in relation to our recent
> changes to `browse-url-browser-function' and `browse-url-secondary-browser-function',
> which users can set to either internal or external browsers. Thanks.
I didn't yet have time to review the patch. Too little free time,
sorry. Will do soon.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#74820: [PATCH] browse-url-with-browser-kind: Improve browser function selection
2024-12-17 13:49 ` Eli Zaretskii
@ 2024-12-17 13:57 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-17 13:57 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 74820
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Daniel Mendler <mail@daniel-mendler.de>
>> Cc: Eli Zaretskii <eliz@gnu.org>
>> Date: Tue, 17 Dec 2024 12:16:54 +0100
>>
>> Daniel Mendler <mail@daniel-mendler.de> writes:
>>
>> > Tags: patch
>> >
>> > In order to find an appropriate browser function for the given
>> > kind, first the browser handler lists are consulted. If no
>> > handler is found, the `browse-url-browser-function',
>> > `browse-url-secondary-browser-function`,
>> > `browse-url-default-browser' and `eww' are tried in that order
>> > until a browser function with a matching kind is found. This
>> > way the user customization of `browse-url-browser-function' and
>> > `browse-url-secondary-browser-function` is respected by
>> > `browse-url-with-browser-kind'.
>>
>> Eli, do you have comments on this patch? I think it improves the
>> behavior of `browse-url-with-browser-kind' in relation to our recent
>> changes to `browse-url-browser-function' and `browse-url-secondary-browser-function',
>> which users can set to either internal or external browsers. Thanks.
>
> I didn't yet have time to review the patch. Too little free time,
> sorry. Will do soon.
Thanks. Take your time. There is no urgency regarding this patch.
Daniel
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#74820: [PATCH] browse-url-with-browser-kind: Improve browser function selection
2024-12-12 11:41 bug#74820: [PATCH] browse-url-with-browser-kind: Improve browser function selection Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-17 11:16 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-12-21 9:34 ` Eli Zaretskii
1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2024-12-21 9:34 UTC (permalink / raw)
To: Daniel Mendler; +Cc: 74820-done
> Date: Thu, 12 Dec 2024 12:41:50 +0100
> From: Daniel Mendler via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
> In order to find an appropriate browser function for the given
> kind, first the browser handler lists are consulted. If no
> handler is found, the `browse-url-browser-function',
> `browse-url-secondary-browser-function`,
> `browse-url-default-browser' and `eww' are tried in that order
> until a browser function with a matching kind is found. This
> way the user customization of `browse-url-browser-function' and
> `browse-url-secondary-browser-function` is respected by
> `browse-url-with-browser-kind'.
Thanks, I've now installed this on the master branch, and I'm
therefore closing this bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-12-21 9:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12 11:41 bug#74820: [PATCH] browse-url-with-browser-kind: Improve browser function selection Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-17 11:16 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-17 13:49 ` Eli Zaretskii
2024-12-17 13:57 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-21 9:34 ` 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).