From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74730: [PATCH] 30.0.92; eww-browse-with-external-browser and eww-follow-link should use browse-url-with-browser-kind Date: Sun, 08 Dec 2024 14:00:56 +0100 Message-ID: <8734iycos7.fsf@daniel-mendler.de> References: <87frmz40f2.fsf@daniel-mendler.de> <86ikruhg3q.fsf@gnu.org> <874j3ed487.fsf@daniel-mendler.de> <86r06ifkn7.fsf@gnu.org> Reply-To: Daniel Mendler Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34837"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 74730@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 08 14:04:30 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tKGxZ-0008s9-VY for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 08 Dec 2024 14:04:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKGxB-0007no-Gg; Sun, 08 Dec 2024 08:04:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tKGxA-0007nH-33 for bug-gnu-emacs@gnu.org; Sun, 08 Dec 2024 08:04:04 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKGx9-0002ui-4w for bug-gnu-emacs@gnu.org; Sun, 08 Dec 2024 08:04:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=6IJbY2kJ8Ah20vaPdUkzArm//umAx8qLgry6H2SuGjk=; b=cQ7nj+fPQ7Zqe5wKBriVgryNzhIBjkdLrPuku+TxuFxKHuYduQB3noI0MCUPYznTx8hzaYIbnwNQhcj74VlDzlwCXb6hnQd8mo3aAYYipa+lgYyZoYOWDgtEkYdxov4VYxI78UKpgQrWTFZTW7+np4T79ml+xOFxd+79TUbbkyujIiVHW+WcVPmbK2swlYOrWI10vItV3CKVWyZ8bu3+wyWIOHkAgAyDuKE6X5pO+radPg/Mgg0vnNVe+Os0JbfDsOnvvdAdJ3yxc6Zid3M+PIafDqggJX92NrY774Z8FCgS0QO8jh6+wGKNtVFw5gtHv0RX9fv/tNxvrfKiPJwnIw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tKGx8-0008I3-Gz for bug-gnu-emacs@gnu.org; Sun, 08 Dec 2024 08:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Dec 2024 13:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74730 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74730-submit@debbugs.gnu.org id=B74730.173366299731801 (code B ref 74730); Sun, 08 Dec 2024 13:04:02 +0000 Original-Received: (at 74730) by debbugs.gnu.org; 8 Dec 2024 13:03:17 +0000 Original-Received: from localhost ([127.0.0.1]:49989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKGwO-0008Gr-Sk for submit@debbugs.gnu.org; Sun, 08 Dec 2024 08:03:17 -0500 Original-Received: from server.qxqx.de ([49.12.34.165]:60055 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKGwL-0008GW-NS for 74730@debbugs.gnu.org; Sun, 08 Dec 2024 08:03:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6IJbY2kJ8Ah20vaPdUkzArm//umAx8qLgry6H2SuGjk=; b=hhCngEtBozcQWukFRDESKCGJHc 2VfUk/jIiGTP/gkViyQVUz8qcmtvdBBM+VyR5zSIrLd9k2yN2FlAQN3Y5Om9UQW9kYlUtJFFd1LsW rc7xoqS4FzLsul2+rJD+YMAXO5hyOzAawIvifP11NjhThYPoxkjsBuJVfqT9wyNV3wkw=; In-Reply-To: <86r06ifkn7.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 08 Dec 2024 14:02:04 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:296635 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> > If we can make it so that existing customizations of >> > browse-url-secondary-browser-function will keep working as they did, >> > then the backward incompatibility issue will disappear, and such a >> > change becomes possible. But in any case, the doc string of >> > browse-url-secondary-browser-function should be amended if we are >> > going to support its setting to eww. >> >> Okay, I can do that. >> >> > Also, are we sure all the relevant functions always have the >> > 'browse-url-browser-kind property? what about user-defined functions, >> > for example? >> >> User-defined functions may not have the property. But we can be >> conservative and preserve the existing behavior in the case where the >> property is unavailable, treating the missing property like the value >> `external'. Only if the property is found and `internal', the >> `browse-url-with-browser-kind' will be used to make sure that an >> external browser is used. As I mentioned, alternatively one can be even >> more conservative and only use `browse-url-with-browser-kind' if >> `browse-url-secondary-browser-function' is set to `eww-browse-url'. That >> might be a little bit too restrictive, but it would be completely >> backward compatible. > > Looking forward to seeing an updated patch which preserves the current > behavior wrt browse-url-secondary-browser-function's customization. > > Thanks. Updated patch attached. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-eww-Improve-eww-browse-with-external-browser.patch >From 9d782ed2123b34fd09268f6c83305d7d9d4acf7d Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Sat, 7 Dec 2024 22:56:15 +0100 Subject: [PATCH] eww: Improve eww-browse-with-external-browser Guarantee that an external browser is used by EWW if `browse-url-secondary-browser-function' is set to `eww-browse-url'. * lisp/net/eww.el (eww-browse-with-external-browser): Use `browse-url-secondary-browser-function' if it does not correspond to EWW, otherwise fall back to `browse-url'. (eww-follow-link): Use `eww-browse-with-external-browser' if the EXTERNAL prefix argument is non-nil. * lisp/net/browse-url.el (browse-url-secondary-browser-function): Update docstring. --- lisp/net/browse-url.el | 8 ++++---- lisp/net/eww.el | 14 ++++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index c10bc671a88..c9d8b2ee80d 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -198,10 +198,10 @@ browse-url-browser-function (defcustom browse-url-secondary-browser-function 'browse-url-default-browser "Function used to launch an alternative browser. -This is usually an external browser (that is, not eww or w3m), -used as the secondary browser choice, typically when a prefix -argument is given to a URL-opening command in those modes that -support this (for instance, eww/shr). + +This is browser is used as the secondary browser choice, typically +when a prefix argument is given to a URL-opening command in those +modes that support this (for instance `goto-addr-at-point', eww or shr). Also see `browse-url-browser-function'." :version "27.1" diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 4d4d4d6beac..b2d295a4dcf 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -2142,10 +2142,13 @@ eww-submit (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." +Calls `browse-url-secondary-browser-function' if it does not correspond +to EWW. Otherwise `browse-url' is used." (interactive nil eww-mode) - (funcall browse-url-secondary-browser-function + (funcall (if (memq browse-url-secondary-browser-function + '(eww eww-browse-url)) + #'browse-url + browse-url-secondary-browser-function) (or url (plist-get eww-data :url)))) (defun eww-remove-tracking (url) @@ -2162,8 +2165,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'. - +`eww-browse-with-external-browser'. If EXTERNAL is double prefix, browse in new buffer." (interactive (list current-prefix-arg last-nonmenu-event) @@ -2180,7 +2182,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) + (eww-browse-with-external-browser 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 --=-=-=--