From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Okamsn Newsgroups: gmane.emacs.help Subject: Re: [External] : Re: How to get keyboard macro that was just run? Date: Sun, 18 Jun 2023 17:50:30 +0000 Message-ID: <8bfaa1c7-ddbf-f17e-bf58-a14509d9345e@protonmail.com> References: <955be829-a167-2805-5255-c2b848d30583@protonmail.com> <6c170d4b-c93a-d19d-7b7f-1b719373ed9d@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35848"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "help-gnu-emacs@gnu.org" To: Drew Adams , Eduardo Ochs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 18 19:51:43 2023 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 1qAwYx-00098l-69 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 18 Jun 2023 19:51:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qAwY7-0000j1-JG; Sun, 18 Jun 2023 13:50:51 -0400 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 1qAwY4-0000iX-JU for help-gnu-emacs@gnu.org; Sun, 18 Jun 2023 13:50:48 -0400 Original-Received: from mail-4316.protonmail.ch ([185.70.43.16]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qAwY0-00044G-RO for help-gnu-emacs@gnu.org; Sun, 18 Jun 2023 13:50:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1687110641; x=1687369841; bh=v8JF7jwxUapRuAI0HpKg7OENCEPHZDkfR/Us/5tKbyM=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=aKgUTPmqqQz4ZtH/D+vLtfCYkOAdFjiQ8ADa44Ol3K8xDpGj6quQjauTD6Er9CT4X 2DLiIx8F/qb89ubym4EVE3V90OJx33n8USGBLGCj4W4d4/CfiyVcu2ukgslB4Ppn1R nYde/3wqiePnf80oPfnVrh2cCh2lmCUnu7X+ZxzGIbUrX8IeS27u32Zz8L8GjaeJJ+ rgWxQnabVuTsCoM9LtuYa+eg3Xrs1mGJUB/JdZqglNY+OCKkMLopcuZe2bvd38/O8O /AD15HALiJPFw5NNcNkpWLxQNIY1pz/JyoleotnCwYRLWZJcv2X+s2oWHxHRxFKoUN WGyCxlD4jPFIw== In-Reply-To: Feedback-ID: 25935600:user:proton Received-SPF: pass client-ip=185.70.43.16; envelope-from=okamsn@protonmail.com; helo=mail-4316.protonmail.ch X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.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, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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:143991 Archived-At: On 2023-06-18 17:13 UTC, Drew Adams wrote: > I may be misunderstanding, but is there a > reason you don't just name the keyboard > macro you want to reuse multiple times? > ___ >=20 > kmacro-name-last-macro is an interactive compiled Lisp function in > =E2=80=98kmacro.el=E2=80=99. >=20 > It is bound to C-x C-k n. >=20 > (kmacro-name-last-macro SYMBOL) >=20 > For more information see the manuals. >=20 > Assign a name to the last keyboard macro defined. > Argument SYMBOL is the name to define. > The symbol's function definition becomes the keyboard macro string. > Such a "function" cannot be called from Lisp, but it is a valid editor co= mmand. Hello Drew, I will try to explain in more detail. In the package Meow, there is a feature to play easily keyboard macros=20 at multiple locations. It does this by running the most recently defined=20 keyboard macro at point using `execute-kbd-macro` and then running the=20 command again at each of the other locations. That feature is described here:=20 https://github.com/meow-edit/meow/blob/master/EXPLANATION.org#multiedit I think that this is an interesting idea, but it is currently limited to=20 running the macro in `last-kbd-macro`. In Consult, there exists the command `consult-kmacro`, which can be used=20 to easily and quickly run kmacros that are not in `last-kbd-macro`. This=20 is better for using a kmacro that I defined a while ago and now wish to=20 use again, without having to first find it by cycling the kmacro ring=20 (and then maybe naming it if I think I will want to use it more=20 frequently next, as you suggest). `consult-kmacro` is easier for=20 one-off-ish re-uses. I proposed changes to `consult-kmacro` that would make it easier to=20 advise for use with Meow's "beacons"=20 (https://github.com/minad/consult/pull/813). However, Consult's author=20 wanted to know whether this integration could happen without making=20 changes in Consult. For that, I am here asking whether it is possible to get information=20 about a kmacro that was just run, so that I could feed that information=20 to Meow for running at its "beacons". If possible, I am still not sure whether that would be the right path=20 forward, because Meow also uses kmacros to run commands bound to the=20 conventional keys, such as `C-w` for cutting commands. So, I suspect=20 that advising `execute-kbd-macro` would be too much and break things.=20 Right now, though, I am just trying to find if there is a better way to=20 get the info about the kmacro.