From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: emacs-28 354c834: Fix `browse-url-interactive-arg' for certain kinds of events Date: Sun, 21 Nov 2021 09:37:19 -0500 Message-ID: References: <20211120075812.24103.86181@vcs0.savannah.gnu.org> <20211120075814.63AB3209FD@vcs0.savannah.gnu.org> <87h7c5oqrk.fsf@gnus.org> <87tug5n9vt.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37155"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 21 15:38:51 2021 Return-path: Envelope-to: ged-emacs-devel@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 1monzV-0009Tb-T4 for ged-emacs-devel@m.gmane-mx.org; Sun, 21 Nov 2021 15:38:50 +0100 Original-Received: from localhost ([::1]:44414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1monzT-0006qZ-TN for ged-emacs-devel@m.gmane-mx.org; Sun, 21 Nov 2021 09:38:47 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1monyB-0005EJ-HC for emacs-devel@gnu.org; Sun, 21 Nov 2021 09:37:27 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:13316) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mony8-00054o-9K for emacs-devel@gnu.org; Sun, 21 Nov 2021 09:37:26 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id BC31B440A46; Sun, 21 Nov 2021 09:37:21 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C9B794402E5; Sun, 21 Nov 2021 09:37:19 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1637505439; bh=gEcS2kvgiM4kHImIaMFeRiBatIInVX2X//RfFmG7hZA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=eM5G82jnPM9smeO0nU9kLbOrASV17uIVnQIQL9Rrm95EpEHPAWVSjZ1ZRTmEsmyzh O5NAlSH1jIV/Hk/UnjjVyO26DGVRGY2UU2DENl14K3yGr7wpBBic8bI1XNJuHjznfA Van7IzKQjkLl3U9Ruoz0rcsCm3c/tX3UEkIMLdVtrAueEbc812AlYnEVshdX79yv4z e1lzdb8VFgyPJ3HhN7pCugWnbXjsfw6zQLEqsYd/O4hh5K3HryeTHPMYtzYQkdMY89 z/nPPcN+fG1TLqhI6VrkeECs6806k2E+hIkuS1vgLpKYkyhxBZ30wQGxq5xkegMUfF YRAzdrKY7+ErQ== Original-Received: from pastel (unknown [216.154.30.173]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9944B12030C; Sun, 21 Nov 2021 09:37:19 -0500 (EST) In-Reply-To: <87tug5n9vt.fsf@yahoo.com> (Po Lu's message of "Sun, 21 Nov 2021 17:19:50 +0800") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:279851 Archived-At: >>> Shouldn't this be fixed in `mouse-set-point` (or even `event-end` and >>> `event-start`) instead, and then we should remove the `listp` test since >>> `mouse-set-point` nowadays should work with any kind of event. > >> I think it would be convenient if `mouse-set-point' did nothing if the >> event given isn't a mouse event -- we have a bunch of commands that are >> both mousey and non-mousey. It's been that way already for quite a while. Try to call it with an event like `?a`. This is handled in `event-end`. It's just that this special handling did not account for events like `(menu-bar)`. > Either way, I think we should not change the behavior of > `mouse-set-point' in the release branch. I'd agree with that, I'm talking about what goes on `master`. So, more concretely I propose the patch below for `master`. Stefan diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index f85f5f6149..c33517ea10 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -737,8 +737,7 @@ browse-url-interactive-arg This function returns a list (URL NEW-WINDOW-FLAG) for use in `interactive'." (let ((event (elt (this-command-keys) 0))) - (when (mouse-event-p event) - (mouse-set-point event))) + (mouse-set-point event)) (list (read-string prompt (or (and transient-mark-mode mark-active ;; rfc2396 Appendix E. (replace-regexp-in-string diff --git a/lisp/subr.el b/lisp/subr.el index 7ba764880e..4e06aefd06 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1553,22 +1553,22 @@ event-start `posn-timestamp': The time the event occurred, in milliseconds. For more information, see Info node `(elisp)Click Events'." - (if (consp event) (nth 1 event) - ;; Use `window-point' for the case when the current buffer - ;; is temporarily switched to some other buffer (bug#50256) - (or (posn-at-point (window-point)) - (list (selected-window) (window-point) '(0 . 0) 0)))) + (or (and (consp event) (nth 1 event)) + ;; Use `window-point' for the case when the current buffer + ;; is temporarily switched to some other buffer (bug#50256) + (posn-at-point (window-point)) + (list (selected-window) (window-point) '(0 . 0) 0))) (defun event-end (event) "Return the ending position of EVENT. EVENT should be a click, drag, or key press event. See `event-start' for a description of the value returned." - (if (consp event) (nth (if (consp (nth 2 event)) 2 1) event) - ;; Use `window-point' for the case when the current buffer - ;; is temporarily switched to some other buffer (bug#50256) - (or (posn-at-point (window-point)) - (list (selected-window) (window-point) '(0 . 0) 0)))) + (or (and (consp event) (nth (if (consp (nth 2 event)) 2 1) event)) + ;; Use `window-point' for the case when the current buffer + ;; is temporarily switched to some other buffer (bug#50256) + (posn-at-point (window-point)) + (list (selected-window) (window-point) '(0 . 0) 0))) (defsubst event-click-count (event) "Return the multi-click count of EVENT, a click or drag event.