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 21:40:56 +0300 Organization: LINKOV.NET Message-ID: <865yhlc093.fsf@mail.linkov.net> References: <878rmj408c.fsf@posteo.net> <86wna1c2hl.fsf@mail.linkov.net> <87k061g8m2.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="31804"; 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: Stefan Monnier , emacs-devel@gnu.org, Andrea Corallo To: Philip Kaludercic Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Sep 17 20:42:59 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 1oZcmJ-00085I-Dg for ged-emacs-devel@m.gmane-mx.org; Sat, 17 Sep 2022 20:42:59 +0200 Original-Received: from localhost ([::1]:34140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oZcmH-0002eg-UW for ged-emacs-devel@m.gmane-mx.org; Sat, 17 Sep 2022 14:42:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZclA-0001wN-DV for emacs-devel@gnu.org; Sat, 17 Sep 2022 14:41:48 -0400 Original-Received: from relay12.mail.gandi.net ([2001:4b98:dc4:8::232]:56473) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZcl8-0004cW-7T for emacs-devel@gnu.org; Sat, 17 Sep 2022 14:41:48 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id AE63D200004; Sat, 17 Sep 2022 18:41:35 +0000 (UTC) In-Reply-To: <87k061g8m2.fsf@posteo.net> (Philip Kaludercic's message of "Sat, 17 Sep 2022 18:26:45 +0000") Received-SPF: pass client-ip=2001:4b98:dc4:8::232; envelope-from=juri@linkov.net; helo=relay12.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, 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:295542 Archived-At: >> 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 > > Intuitively I would expect the first level to make more sense, though I > see that when considering commands like `self-insert-command' you > couldn't just deduce all the command invocations and wrap them in a > `progn' body. At the same time, what is there to compile on the second > level? You still need to look up all the commands and invoke them. As > Stefan said, it is perhaps necessary to either detect what commands can > be safely converted into repeat-complex-command'-esque representations > (and what commands can be assisted/transformed), and only optimise if > that is possible. Keyboard macros are executed on the keys level, so even the decision what complex command to execute might depend on the position of that command in the completion list of `M-x', e.g.: M-x ;; execute-extended-command r ;; self-insert-command ;; minibuffer-complete ;; switch-to-completions ;; next-completion ;; next-completion ;; next-completion ;; next-completion ;; choose-completion