From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: Another bug with the macro counter
Date: Sun, 31 Oct 2004 15:01:05 -0600 (CST) [thread overview]
Message-ID: <200410312101.i9VL15p06356@raven.dms.auburn.edu> (raw)
In-Reply-To: <m3zn23na1v.fsf@kfs-l.imdomain.dk> (storm@cua.dk)
Your alternate patch seems OK, but I would make three changes to it.
First one:
+ (defun kmacro-keyboard-quit ()
+ (or kmacro-appending-p
+ (kmacro-ring-empty-p)
+ (kmacro-pop-ring))
+ (setq kmacro-appending-p nil))
As you may already have pointed out yourself, you actually need:
+ (defun kmacro-keyboard-quit ()
+ (or (not defining-kbd-macro)
kmacro-appending-p
+ (kmacro-ring-empty-p)
+ (kmacro-pop-ring))
+ (setq kmacro-appending-p nil))
The second one is that I would rename kmacro-appending-p to
kmacro-appending-flag.
>From `(elisp)Tips for Defining':
`...-flag'
The value is significant only as to whether it is `nil' or not.
The `-p' convention is for functions.
The third one is that I would keep the docstring I gave for
kmacro-appending-flag:
"Non-nil when appending to a keyboard macro definition.
The value is nil when defining a new keyboard macro.
In other situations, the value is undefined."
The `(setq kmacro-appending-p nil)' is not sufficient to guarantee
that kmacro-appending-p will be nil outside a macro definition.
There are two reasons to quit inside a keyboard macro.
The first, in my usage by far the most common, is that you start
defining a macro and then mess it up. You do C-g while Emacs is
waiting for keyboard input to get rid of the erroneous macro.
Currently that duplicates the last correct keyboard macro in a
confusing way. This is the situation we are trying to correct.
The second is that a function called during the keyboard macro
definition takes a huge amount of time and the user quits to regain
control. In this situation, `keyboard-quit' is not called and the
quit is handled by QUIT. Now the C-g terminates the macro definition
without becoming part of it, just like C-x ). The new macro is likely
to be useless. Unlike in the first case, the user can not but notice
what happened and hence can remove the macro with C-x C-k C-d. This
situation remains unchanged after either your or my patch. If this
situation happens while appending to a keyboard macro, then
kmacro-appending-p will remain t, even though no macro is being defined.
I could give a concrete example if desired.
Sincerely,
Luc.
next prev parent reply other threads:[~2004-10-31 21:01 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-21 1:07 Another bug with the macro counter Luc Teirlinck
2004-10-30 2:38 ` Luc Teirlinck
2004-10-30 3:27 ` Luc Teirlinck
2004-10-30 4:06 ` Stefan
2004-10-30 14:19 ` Luc Teirlinck
2004-10-30 16:12 ` Stefan
2004-10-30 18:06 ` David Kastrup
2004-10-30 23:13 ` Luc Teirlinck
2004-10-31 0:09 ` Stefan
2004-10-31 7:43 ` David Kastrup
2004-10-31 13:30 ` Andreas Schwab
2004-10-31 17:05 ` Stefan
2004-10-31 18:36 ` David Kastrup
2004-10-31 18:52 ` Luc Teirlinck
2004-10-30 14:24 ` Luc Teirlinck
2004-10-30 14:51 ` Luc Teirlinck
2004-10-30 21:57 ` Kim F. Storm
2004-10-30 22:04 ` Luc Teirlinck
2004-10-30 22:09 ` Luc Teirlinck
2004-10-30 22:43 ` Kim F. Storm
2004-10-31 21:01 ` Luc Teirlinck [this message]
2004-10-31 23:23 ` Kim F. Storm
2004-11-01 7:24 ` Richard Stallman
2004-10-31 9:42 ` Richard Stallman
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=200410312101.i9VL15p06356@raven.dms.auburn.edu \
--to=teirllm@dms.auburn.edu \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.