From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#50067: Context menus Date: Thu, 25 Nov 2021 21:28:47 +0200 Organization: LINKOV.NET Message-ID: <865ysgkpao.fsf@mail.linkov.net> References: <87pmufb3u0.fsf@mail.linkov.net> <875ytr1vkp.fsf@mail.linkov.net> <864k8mwgzr.fsf@mail.linkov.net> <86bl2hux4y.fsf@mail.linkov.net> <86h7c0wu5r.fsf@mail.linkov.net> <83czmo7hpn.fsf@gnu.org> 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="3638"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 50067@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 25 20:34:22 2021 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 1mqKVh-0000lP-Ue for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Nov 2021 20:34:21 +0100 Original-Received: from localhost ([::1]:44762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mqKVg-0002Q1-Sq for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Nov 2021 14:34:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqKVO-0002Pq-6z for bug-gnu-emacs@gnu.org; Thu, 25 Nov 2021 14:34:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46512) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mqKVN-0001Jv-VH for bug-gnu-emacs@gnu.org; Thu, 25 Nov 2021 14:34:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mqKVN-0003YW-OG for bug-gnu-emacs@gnu.org; Thu, 25 Nov 2021 14:34:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 25 Nov 2021 19:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50067 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 50067-submit@debbugs.gnu.org id=B50067.163786878613604 (code B ref 50067); Thu, 25 Nov 2021 19:34:01 +0000 Original-Received: (at 50067) by debbugs.gnu.org; 25 Nov 2021 19:33:06 +0000 Original-Received: from localhost ([127.0.0.1]:58058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mqKUU-0003XM-3Y for submit@debbugs.gnu.org; Thu, 25 Nov 2021 14:33:06 -0500 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:45339) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mqKUP-0003Wm-05 for 50067@debbugs.gnu.org; Thu, 25 Nov 2021 14:33:04 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 9E7711C0005; Thu, 25 Nov 2021 19:32:53 +0000 (UTC) In-Reply-To: <83czmo7hpn.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 25 Nov 2021 10:38:44 +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" Xref: news.gmane.io gmane.emacs.bugs:220848 Archived-At: --=-=-= Content-Type: text/plain >> @@ -367,7 +367,7 @@ DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 3, 0, >> event with parameters. */ >> ptrdiff_t next_event; >> for (next_event = 0; next_event < key_count; next_event++) >> - if (EVENT_HAS_PARAMETERS (AREF (keys, next_event))) >> + if (inhibit_mouse_event_check || EVENT_HAS_PARAMETERS (AREF (keys, next_event))) >> break; >> >> /* Handle special starting chars `*' and `@'. Also `-'. */ >> @@ -618,6 +618,7 @@ DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 3, 0, >> do >> next_event++; >> while (next_event < key_count >> + && ! inhibit_mouse_event_check >> && ! EVENT_HAS_PARAMETERS (AREF (keys, next_event))); >> >> break; > > Why check this condition inside the loops, rather than avoid entering > the loops when the condition is right, in the first place? I thought that checking the condition inside the loops would be less risky for the emacs-28 release branch. > And please add comments there explaining the meaning of the > inhibit_mouse_event_check test. This patch also adds comments, and removes one condition that is not unnecessary when event with parameters is not searched when inhibit_mouse_event_check is non-nil: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=inhibit_mouse_event_check_2.patch diff --git a/src/callint.c b/src/callint.c index 44dae361c1..68f103759a 100644 --- a/src/callint.c +++ b/src/callint.c @@ -364,11 +364,14 @@ DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 3, 0, /* The index of the next element of this_command_keys to examine for the 'e' interactive code. Initialize it to point to the first - event with parameters. */ - ptrdiff_t next_event; - for (next_event = 0; next_event < key_count; next_event++) - if (EVENT_HAS_PARAMETERS (AREF (keys, next_event))) - break; + event with parameters. When `inhibit_mouse_event_check' is non-nil, + the command can accept an event without parameters, + so don't search for the event with parameters in this case. */ + ptrdiff_t next_event = 0; + if (!inhibit_mouse_event_check) + for (; next_event < key_count; next_event++) + if (EVENT_HAS_PARAMETERS (AREF (keys, next_event))) + break; /* Handle special starting chars `*' and `@'. Also `-'. */ /* Note that `+' is reserved for user extensions. */ @@ -606,7 +609,7 @@ DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 3, 0, break; case 'e': /* The invoking event. */ - if (!inhibit_mouse_event_check && next_event >= key_count) + if (next_event >= key_count) error ("%s must be bound to an event with parameters", (SYMBOLP (function) ? SSDATA (SYMBOL_NAME (function)) @@ -614,11 +617,15 @@ DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 3, 0, args[i] = AREF (keys, next_event); varies[i] = -1; - /* Find the next parameterized event. */ - do + /* `inhibit_mouse_event_check' allows non-parameterized events. */ + if (inhibit_mouse_event_check) next_event++; - while (next_event < key_count - && ! EVENT_HAS_PARAMETERS (AREF (keys, next_event))); + else + /* Find the next parameterized event. */ + do + next_event++; + while (next_event < key_count + && ! EVENT_HAS_PARAMETERS (AREF (keys, next_event))); break; --=-=-=--