From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: Convert a keyboard macro to equivalent Lisp code
Date: Wed, 09 Jun 2010 10:17:29 -0400 [thread overview]
Message-ID: <jwv39ww70t8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87y6eo3a4r.fsf@mail.jurta.org> (Juri Linkov's message of "Wed, 09 Jun 2010 11:34:04 +0300")
> But your objection prompted me to look closely at `self-insert-command',
> and I found another reason (`translate_char') why it won't work ;-)
AFAIK translate-char is not used. I suggested to get rid of it in
Emacs-23, so it's obsolete since Emacs-23.1.
AFAIK it's only ever been used for Emacs-22's char-unification support.
>> I'm heading towards a special "recording&running macro" mode where
>> various commands may have a slightly different behavior (less DWIMish,
>> more amenable to scripting, more amenable to transforming into Elisp
>> code), so "verifying" might not be the right approach since a different
>> behavior might not be a problem but a feature.
> Then it's a different feature.
Yes and no: yes, in the sense that the difference is considered
a feature, but no in the sense that it's *very* similar, used for the
same purpose, and could use the same keybindings.
> This is more like command translation during recording and running
> a macro. This is already possible to do without core support with:
If it can be done without changing C code, that's an advantage.
> (add-hook 'pre-command-hook
> (lambda ()
> (when (or defining-kbd-macro executing-kbd-macro)
> (cond ((eq this-command 'next-line)
> (setq this-command 'forward-line))))))
Yuck.
> (add-hook 'pre-command-hook
> (lambda ()
> (when (or defining-kbd-macro executing-kbd-macro)
> (cond ((memq this-command '(next-line previous-line))
> (setq line-move-visual nil))))))
> (add-hook 'post-command-hook
> (lambda ()
> (when (or defining-kbd-macro executing-kbd-macro)
> (cond ((memq this-command '(next-line previous-line))
> (setq line-move-visual t))))))
Even more yuck!
Those settings would be enabled disabled when you enter/leave the macro
recording/running mode rather than around each command. Still, the
above does not record the commands, so there's more work to do.
Stefan
prev parent reply other threads:[~2010-06-09 14:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-05 19:57 Convert a keyboard macro to equivalent Lisp code Juri Linkov
2010-06-07 9:27 ` Richard Stallman
2010-06-07 9:27 ` Richard Stallman
2010-06-07 13:36 ` Stefan Monnier
2010-06-07 18:33 ` Juri Linkov
2010-06-07 18:35 ` Juri Linkov
2010-06-07 20:11 ` Stefan Monnier
2010-06-08 8:05 ` Juri Linkov
2010-06-09 1:36 ` Stefan Monnier
2010-06-09 8:34 ` Juri Linkov
2010-06-09 14:17 ` Stefan Monnier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv39ww70t8.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=juri@jurta.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.