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#75052: 31; browse-url-transform-alist is not used by secondary browser Date: Mon, 23 Dec 2024 19:41:30 +0100 Message-ID: <87cyhi6y3p.fsf@daniel-mendler.de> Reply-To: Daniel Mendler Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15783"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Kangas To: 75052@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 23 19:42:25 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 1tPnNp-0003zu-Ek for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 23 Dec 2024 19:42:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tPnNY-0005fG-He; Mon, 23 Dec 2024 13:42:08 -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 1tPnNT-0005ec-AY for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2024 13:42:03 -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 1tPnNS-0004ak-PE for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2024 13:42: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:From:To:Subject; bh=PoS6nMXSOAqKTU0Sh+NOzPCe7868PKw7lv+aHFwqfVQ=; b=NFQsytmFBuMCe3X9TPjsgQGcd2bb+IlEVB6TjxXZclon4Ze9ClzhQLNcSaayCpVb1J4lMZ0nNJVI9vzNV7N3QbhCMcJhN3Z0BHnk+frfHd1u+aNjnefJ0qwsQC6/8NU/zNC1QOLaPRGO9UEvDPSaqLGJ25fl27YJKAy2wHYgDdetje5OLt2zIIcwbb1Hq3CJePnaNLqcuXe8akDGMGlQYhBEIjnjwhF+bdcTLgPbBJtVU7Mt2q0rvm5hHMCfhE0uNekxIIgCue5icWnnwcAGzoIhm3NvSxsWJn/JWqGTKpDRog8Dn0nMNpqx2uuRiGBDeBvXCr0S7G4yke0o08UGyg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tPnNS-0003zU-JW; Mon, 23 Dec 2024 13:42:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: stefankangas@gmail.com, bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Dec 2024 18:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 75052 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Stefan Kangas Original-Received: via spool by submit@debbugs.gnu.org id=B.173497931915327 (code B ref -1); Mon, 23 Dec 2024 18:42:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Dec 2024 18:41:59 +0000 Original-Received: from localhost ([127.0.0.1]:56185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPnNP-0003z9-C2 for submit@debbugs.gnu.org; Mon, 23 Dec 2024 13:41:59 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:57254) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPnNL-0003yw-Bj for submit@debbugs.gnu.org; Mon, 23 Dec 2024 13:41:57 -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 1tPnNJ-0005dp-S4 for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2024 13:41:53 -0500 Original-Received: from server.qxqx.de ([2a01:4f8:c012:9177::1] helo=mail.qxqx.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tPnNH-0004TW-GE for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2024 13:41:53 -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: Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=PoS6nMXSOAqKTU0Sh+NOzPCe7868PKw7lv+aHFwqfVQ=; b=wMbRDVH2Enaa/JmhGOrA7go/p+ KYZRpteNAkiJnbAK/82+iKktUU6v1ePOS6fczEovdHpQ70ouOco+8gL7vVtQgIuj6/LQ01a49gUJl w3VoWtWw0MRPQHIHkJle3jpzvcg0nV50M6ZyYAkq/dlV1cJ3tY3khj6T2kcMpj+96ZaI=; Received-SPF: pass client-ip=2a01:4f8:c012:9177::1; envelope-from=mail@daniel-mendler.de; helo=mail.qxqx.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:297659 Archived-At: Hello Stefan, you recently added `browse-url-transform-alist' to `browse-url'. At a few places in Emacs browser functions are called directly. For direct browser function calls the transformation alist is not applied. Examples: - `browse-url-secondary-browser-function' is called by `browse-url-button-open' or by `package-browse-url' and others. - `browse-url-with-browser-kind' calls browser functions directly. A possible solution could be to add a function `browse-url-with-function' which takes a function argument: (defun browse-url-with-function (func url &rest args) "Open URL with browser FUNC. If FUNC is a function use this function. If FUNC is nil use the default `browse-url'. For other non-nil values use `browse-url-secondary-browser-function'." (if (not func) (apply #'browse-url url args) (apply (if (functionp func) func browse-url-secondary-browser-function) (browse-url--transform url) args))) All call sites which call a browse function directly could use `browse-url-with-function' instead. Calling browser functions directly should be discouraged. For example `package-browse-url' would simplify to this: (defun package-browse-url (desc &optional secondary) (interactive (list (package--query-desc) current-prefix-arg) package-menu-mode) (unless desc (user-error "No package here")) (let ((url (cdr (assoc :url (package-desc-extras desc))))) (unless url (user-error "No website for %s" (package-desc-name desc))) (browse-url-with-function secondary url))) Similarly `browse-url-with-browser-kind': (defun browse-url-with-browser-kind (kind url &optional arg) (interactive ...) (let ((function (browse-url-select-handler url kind))) (unless function (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)))) (browse-url-with-function function url arg))) Does this sound like an acceptable plan? Thank you. Daniel