From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Psionic K Newsgroups: gmane.emacs.help Subject: Re: differentiating real and fake command events Date: Sun, 15 Dec 2024 15:00:44 +0900 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="410"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org, Psionic K To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 15 07:02:01 2024 Return-path: Envelope-to: geh-help-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 1tMhhY-000AVK-AT for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 15 Dec 2024 07:02:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tMhgd-0005t2-3c; Sun, 15 Dec 2024 01:01:03 -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 1tMhga-0005sR-6u for help-gnu-emacs@gnu.org; Sun, 15 Dec 2024 01:01:00 -0500 Original-Received: from mail-yb1-xb2a.google.com ([2607:f8b0:4864:20::b2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tMhgX-0007rn-IA for help-gnu-emacs@gnu.org; Sun, 15 Dec 2024 01:00:59 -0500 Original-Received: by mail-yb1-xb2a.google.com with SMTP id 3f1490d57ef6-e3fd6cd9ef7so2238701276.1 for ; Sat, 14 Dec 2024 22:00:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=positron.solutions; s=google; t=1734242455; x=1734847255; darn=gnu.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=DTMiqa9CsI2rh+Fs965iyX6/8628vjyatPag/lI7h3U=; b=kI9xJh4tkp9UWd82KPaopK6YuetJMdVzs7tpGpxkbZd2oMLxHOKT5swr2lUOJ3PiWT xIUMA+gtg7DsiuApBTDvDM+QR7UmR7AYzFDjZmJ25zzG7Gx3UjCXEUCgnSVMTYen1XXG R8H9xXqFbh2bn6oOrvnDsjgOgszdDsIL5R/OYN5yN9oNK4pZAfq1fFykgJtMWf4BoFlo wqA/bKNM/RcvYLz0ipKToAji+M0I55jwcWt/PTHk5J2vWP4TA4kvhk8zNr4GTIpm/qdV MjQFZMlKrErL40n7iqIT/U46S0TzOTSUlVNwixa2SDuN5GCUPqt/x/kLv/VLMdONmgCQ 7xaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734242455; x=1734847255; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=DTMiqa9CsI2rh+Fs965iyX6/8628vjyatPag/lI7h3U=; b=uoEcTOYFzseHObUhb706P4RCrx8xjgWchcqVW+Fnp9BVU76sLd8QQ6ojiTmy9B7ckA skcKT0csBVsHnJIqxjy8bQxqKpdtd6En5D3KWn9z6sMYjDUqt8l4h3HiKbLnfchKgUsy jS13N06rLU0EAeiB8TKHcjeJmTp/Usz0e2PwmnKo14jAFqcDaPue3qq/1TPZIMVdlgYI 3T1E1M3cb49EXhKFKvAEBHE3lx/NxFqc9CkmT8v6AZZbIeCAna5wdw4CdyKhK9/c0TFE vKBAfDJ/HD28YX9noRMbppN/0lsB4b3LbxQX5j9SfPOOcu+TnyQ5QwPJzMFLCvb2ybC4 i9NQ== X-Gm-Message-State: AOJu0YxFxVBp0QBbu8TytQ0tjJJ6WA7Ls+jifd6Wfrk7YJkNAGgJYZpZ 7ItU2TuodmYcTBNUqJCwBghsdk1/etT1b8WMUBXLsjGD6yOoSDEPofK88lrRrBxtf3SAOHb0S3G I25g035/WL+rKAtqDnq0z1JyfhbhaX/lBcU1OmQ== X-Gm-Gg: ASbGncsPaAeDVkeJCf4TZmFCZhBZeEQvmhGtEQTip0aEbo7T8pPYIdYKznn93crv1LK 5wloYF5J2kWK3mLgbw+0ZVWONkNw6+yA2ocA16uYx X-Google-Smtp-Source: AGHT+IFbUaFnxKnaZAIJou0gTuc02syWMPinCR7imOI/ZvrG1h1HynOR2CVaXD8fnYbbvbWCXAEJRleacVQtb00gvGQ= X-Received: by 2002:a05:6902:1881:b0:e4b:6673:8b3e with SMTP id 3f1490d57ef6-e4b66738ed6mr730433276.8.1734242455314; Sat, 14 Dec 2024 22:00:55 -0800 (PST) Received-SPF: pass client-ip=2607:f8b0:4864:20::b2a; envelope-from=exec@positron.solutions; helo=mail-yb1-xb2a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:148807 Archived-At: > I don't understand enough of the context. Could you explain in what way > you need something different from `execute-kbd-macro`? I'm implementing "live" demo features for dslide. It relies on playing back macros at human speed. The goal is to emulate the results of using Emacs by hand, to appear as a live demonstration, but with reproducibility. This frees the presenter from having to think and type at the same time while still conveying the organic experience to those watching. Keyboard macros executed via `execute-kbd-macro' replay input at inhuman speed and lose the similarity of feedback that enables the audience to relate what they see with what they normally do. The first issue I ran into was simply getting `unread-command-events' to result in input. For my first pass solution, I accomplished this with a function that calls itself recursively via `run-at-time'. I may try threads. The recursive function currently also compares `last-input-event' to detect incoherence caused by extra user inputs (and possibly others?). If the last key pushed into `unread-command-events' doesn't match, it messages and aborts. This approach is invalid for replaying sequences that will result in extra events. Rather than detect potentially corrupting extra inputs, I would block the user's inputs and allow only the synthetic events to succeed. It is unnatural to block the user from typing inputs while also pushing synthetic input into `unread-command-events'. One idea I had was to activate a keymap in between pushing events. However, I think this would depend on the command loop evaluation order and wind up being fragile. I expect there are many paths that appear viable but only some that are truly good and will remain so for at least a few years.