Subject: bug#69627: closed (Re: bug#69627: 30.0.50; [PATCH] Allow 'browse-url-interactive-arg' to return the actual prefix arg)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 10 Mar 2024 21:11:01 +0000

Your bug report

#69627: 30.0.50; [PATCH] Allow 'browse-url-interactive-arg' to return the actual prefix arg

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
69627: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69627
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#69627: 30.0.50; [PATCH] Allow 'browse-url-interactive-arg' to return the actual prefix arg
From: Jim Porter <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked]
Date: Sun, 10 Mar 2024 14:09:13 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On 3/8/2024 1:02 PM, Jim Porter wrote:
> On 3/8/2024 12:18 PM, Eli Zaretskii wrote:
>> Yes, something like this.
> 
> Thanks. Updated patch attached. If no one has any other concerns, I'll 
> merge this in the next day or two.

Now merged to master as 46afc91c9f7, and closing this bug.

Subject: 30.0.50; [PATCH] Allow 'browse-url-interactive-arg' to return the actual prefix arg
From: Jim Porter <[email-masked]>
To: [email-masked]
Date: Thu, 7 Mar 2024 22:04:39 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

By default this shouldn't do anything different from before. However, 
with this patch, functions for 'browse-url-browser-function' can look at 
the argument (as modified by 'browse-url-new-window-flag') and do 
something special. For example, with this patch, I have a custom browser 
function that works like this:

   M-x browse-url      Open in Firefox
   C-u M-x browse-url  Open in EWW
   C-- M-x browse-url  Open in Firefox Private Browsing

From cae6d59d30d2082aba1899a1d34d1ee109f07c8d Mon Sep 17 00:00:00 2001
From: Jim Porter <[email-masked]>
Date: Thu, 7 Mar 2024 21:55:45 -0800
Subject: [PATCH] Let 'browse-url-interactive-arg' return more values for
 NEW-WINDOW-FLAG

Previously it always returned t or nil for NEW-WINDOW-FLAG, but now it
can return the actual prefix arg when appropriate.  This lets functions
for 'browse-url-browser-function' consult it and do more things than
just open a new window or not (for example, you could use "C--" as the
prefix arg to do something special in a custom function).

* lisp/net/browse-url.el (browse-url-interactive-arg):
---
 lisp/net/browse-url.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index ddc57724343..a04b87827e3 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -715,8 +715,7 @@ browse-url-interactive-arg
 				      (buffer-substring-no-properties
 				       (region-beginning) (region-end))))
 				(browse-url-url-at-point)))
-	(not (eq (null browse-url-new-window-flag)
-		 (null current-prefix-arg)))))
+	(xor browse-url-new-window-flag current-prefix-arg)))
 
 ;; called-interactive-p needs to be called at a function's top-level, hence
 ;; this macro.  We use that rather than interactive-p because
-- 
2.25.1