From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74936: 30.0.91; special-event-map does not respect t Date: Wed, 18 Dec 2024 18:37:03 -0500 Message-ID: References: <86h671m6v0.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20597"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Psionic K , 74936@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 19 00:38:34 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 1tO3cf-0005B0-SA for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 19 Dec 2024 00:38:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tO3cC-0001X4-36; Wed, 18 Dec 2024 18:38:04 -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 1tO3cA-0001Wi-JQ for bug-gnu-emacs@gnu.org; Wed, 18 Dec 2024 18:38:02 -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 1tO3cA-00032f-BN for bug-gnu-emacs@gnu.org; Wed, 18 Dec 2024 18:38:02 -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=vlGqjM9MgoJmEiRUsAk22y0scvwQjrFcoTxSU5SPSxo=; b=e/z3foUWxampDZtYV3RX4VOwDLr36rxxnVhOVff33Z5crgJrLOR9M4iP49HVYoZaTfMUsHJbt74Vl34Jy5lTAO9H5ntFlmeifJh56u7r2G8UvYLALnix7My5hQslek/eA3lqY2J+V9MVozc/W2smqH84KL05dQv89ZkX7svPVjTHUSemIXTw2OMhpufLczHzU19KamO+ri8zqAri86ySix+70TEJhXTtt6KWuJeKVvgwUD7XPMm45I5xUGm0KssM+LmcjqHaQ7uqIPRH6vjL6UQqjyPKa2HDFm7GMR8JevY64K8mSwWr5dvhFbp7NAvV8fZord1SdbgNaewA0jJ85A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tO3c9-0008Ki-SC for bug-gnu-emacs@gnu.org; Wed, 18 Dec 2024 18:38:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Dec 2024 23:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74936 X-GNU-PR-Package: emacs Original-Received: via spool by 74936-submit@debbugs.gnu.org id=B74936.173456503831954 (code B ref 74936); Wed, 18 Dec 2024 23:38:01 +0000 Original-Received: (at 74936) by debbugs.gnu.org; 18 Dec 2024 23:37:18 +0000 Original-Received: from localhost ([127.0.0.1]:36449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tO3bS-0008JK-5Y for submit@debbugs.gnu.org; Wed, 18 Dec 2024 18:37:18 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:50440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tO3bQ-0008J6-JF for 74936@debbugs.gnu.org; Wed, 18 Dec 2024 18:37:16 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 8F2D980829; Wed, 18 Dec 2024 18:37:10 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1734565029; bh=cx6NgQw366ZF/ghul5byRNpOlfeMBbWn7pDCiCnnzSo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=HMxh4YzbVmRiN9pDleimtAbu8di86gH+dz8uk5qQ5BVjA+A36nzMMHg0a5Ai5WKks CTowTTx8oIOfPnY8HmPPCk8YgDpd3VXt6wpHHRyX7u2fR1Aej/1hrdV3c5rKblcvhh stTOhTUGTQtu/pN2sW9jo96w6W7RfhU2GjsogdOpoxCXvujUaMKqXAXETcVkhOWIIO igrjcomAeSGnsLBVM84lDC20qUNYfro6YV7D79nyj2LHSfVmXtNf3aXvrklRNd7waK PMkNZUYZpLai2JsezF1vsEPaMJOsJ0X/M+++2Ac57ueha2fLykbu/zS6lKc1BIfa45 uiR6ZIO4Ulqjg== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 91DA980758; Wed, 18 Dec 2024 18:37:09 -0500 (EST) Original-Received: from pastel (104-195-225-43.cpe.teksavvy.com [104.195.225.43]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 419811200E4; Wed, 18 Dec 2024 18:37:09 -0500 (EST) In-Reply-To: <86h671m6v0.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 18 Dec 2024 15:57:23 +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:297353 Archived-At: >> This is necessary to differentiate real user input from fake user input >> performed during automated playback >> functionality. We need to capture events before `read-event` and buffer >> them for later playback. Since I >> can't predict all of the bindings I would otherwise need to cover, the >> t binding would be a great help. > > Stefan, any comments? They're trying to implement something similar to the built-in keyboard macros but where the replay is done at the same speed as the original recording, with the same kind of "idling" in-between, so they need some way to detect if we receive a "real" event while replaying the recorded events. Looking at `read_char` I saw that a possible solution is to use a catchall `[t]` binding in `special-event-map` since this map is applied to incoming real events but not to events coming from `unread-command-events`. But `read_char` call `access_keymap` with `t_ok == false` when consulting `special-event-map` so that suggestion of mine currently can't work. Hence his request. Of course, their needs could be satisfied in many other ways, but the patch below does seem cheap and harmless. A big caveat, tho: I don't know that the patch is sufficient to satisfy their needs. Psionic, could you apply the patch below to a local build of Emacs, and then play with it in your package to confirm that it indeed makes your life easier? Stefan diff --git a/src/keyboard.c b/src/keyboard.c index 6d28dca9aeb..cd3251e04e3 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -3065,7 +3065,7 @@ read_char (int commandflag, Lisp_Object map, and loop around to read another event. */ save = Vquit_flag; Vquit_flag = Qnil; - tem = access_keymap (get_keymap (Vspecial_event_map, 0, 1), c, 0, 0, 1); + tem = access_keymap (get_keymap (Vspecial_event_map, 0, 1), c, true, 0, 1); Vquit_flag = save; if (!NILP (tem))