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.devel Subject: Re: Native compilation of Keyboard Macros Date: Sat, 17 Sep 2022 20:52:38 +0300 Organization: LINKOV.NET Message-ID: <86wna1c2hl.fsf@mail.linkov.net> References: <878rmj408c.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35695"; 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: Philip Kaludercic , emacs-devel@gnu.org, Andrea Corallo To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Sep 17 20:18:05 2022 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 1oZcOD-00097f-NQ for ged-emacs-devel@m.gmane-mx.org; Sat, 17 Sep 2022 20:18:05 +0200 Original-Received: from localhost ([::1]:51554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oZcOC-0005FZ-Hj for ged-emacs-devel@m.gmane-mx.org; Sat, 17 Sep 2022 14:18:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZcNX-0003ys-8c for emacs-devel@gnu.org; Sat, 17 Sep 2022 14:17:23 -0400 Original-Received: from relay11.mail.gandi.net ([217.70.178.231]:49701) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZcNV-00018k-4s for emacs-devel@gnu.org; Sat, 17 Sep 2022 14:17:23 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 8F85B100002; Sat, 17 Sep 2022 18:17:10 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Fri, 16 Sep 2022 15:27:18 -0400") Received-SPF: pass client-ip=217.70.178.231; envelope-from=juri@linkov.net; helo=relay11.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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:295538 Archived-At: > So, I think you should focus on the problem of turning a keyboard macro > into code. We know it's impossible in general, so it has to be > "user-visible" (i.e. the user specifically asks for it and is made aware > that the result is a chunk of code which will not always run the same > commands as the keyboard macro). > > You could have a "run kmacro and turn *this* execution into ELisp code". > IIUC some people tried to do that already, but I can't remember where > I saw that and my search-fu is weak right now. The last executed commands are already remembered at different levels, so the hard task is to decide at what level to turn them to code: 1. at level of complex command execution, such as from the history retrieved by `repeat-complex-command` (C-x ESC ESC), for example: (rgrep "macro" "* .*" "emacs/lisp/") 2. at level of commands corresponding to all typed keys, such as retrieved by `view-lossage` (C-h l), for example, for the same as above: M-x ;; execute-extended-command r ;; self-insert-command g ;; self-insert-command r ;; self-insert-command ;; minibuffer-complete ;; minibuffer-complete-and-exit m ;; self-insert-command a ;; self-insert-command c ;; self-insert-command r ;; self-insert-command o ;; self-insert-command ;; exit-minibuffer ;; exit-minibuffer ;; minibuffer-complete-and-exit