emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Native compilation of Keyboard Macros


From: Juri Linkov
Subject: Re: Native compilation of Keyboard Macros
Date: Sat, 17 Sep 2022 20:52:38 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

> 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
   <tab>              ;; minibuffer-complete
   <return>           ;; minibuffer-complete-and-exit
   m                  ;; self-insert-command
   a                  ;; self-insert-command
   c                  ;; self-insert-command
   r                  ;; self-insert-command
   o                  ;; self-insert-command
   <return>           ;; exit-minibuffer
   <return>           ;; exit-minibuffer
   <return>           ;; minibuffer-complete-and-exit



reply via email to

[Prev in Thread] Current Thread [Next in Thread]