[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Another bug with the macro counter
From: |
Luc Teirlinck |
Subject: |
Re: Another bug with the macro counter |
Date: |
Sat, 30 Oct 2004 17:04:57 -0500 (CDT) |
Kim Storm wrote:
If appending-to-kbd-macro is non-nil in the second line, you don't get
to the third line which sets it to nil (i.e. it is only set to nil if
it is already nil).
Yes, that was just some confusion on my part.
I think it will be better if kmacro.el defines a function
and:
If appending-to-kbd-macro is non-nil in the second line, you don't get
to the third line which sets it to nil (i.e. it is only set to nil if
it is already nil).
I think it will be better if kmacro.el defines a function
(defun kmacro-quit ()
(or appending-to-kbd-macro
(kmacro-ring-empty-p)
(kmacro-pop-ring))
(setq appending-to-kbd-macro nil))
which does the cleanup and then simply call this as
(if (fboundp 'kmacro-quit)
(kmacro-quit))
in keyboard-quit.
Or even better, define a keyboard-quit-hook and add kmacro-quit to it.
Here is a patch which does that:
I will take a look at it.
Just in case, here is the corrected version of my patch (although your
one might indeed be better, I still have to look at it.)
===File ~/simple-diff-5=====================================
*** simple.el 25 Oct 2004 07:40:49 -0500 1.664
--- simple.el 30 Oct 2004 16:41:28 -0500
***************
*** 865,873 ****
(if (and (integerp value)
(or (not (memq this-command '(eval-last-sexp
eval-print-last-sexp)))
(eq this-command last-command)
! (and (boundp 'edebug-active) edebug-active)))
(let ((char-string
! (if (or (and (boundp 'edebug-active) edebug-active)
(memq this-command '(eval-last-sexp
eval-print-last-sexp)))
(prin1-char value))))
(if char-string
--- 865,874 ----
(if (and (integerp value)
(or (not (memq this-command '(eval-last-sexp
eval-print-last-sexp)))
(eq this-command last-command)
! ;; Use `if' instead of `and' to avoid compiler warning.
! (if (boundp 'edebug-active) edebug-active)))
(let ((char-string
! (if (or (if (boundp 'edebug-active) edebug-active)
(memq this-command '(eval-last-sexp
eval-print-last-sexp)))
(prin1-char value))))
(if char-string
***************
*** 3907,3912 ****
--- 3908,3918 ----
;Turned off because it makes dbx bomb out.
(setq blink-paren-function 'blink-matching-open)
+ (defvar appending-to-kbd-macro nil
+ "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.")
+
;; This executes C-g typed while Emacs is waiting for a command.
;; Quitting out of a program does not go through here;
;; that happens in the QUIT macro at the C code level.
***************
*** 3916,3921 ****
--- 3922,3933 ----
At top-level, as an editor command, this simply beeps."
(interactive)
(deactivate-mark)
+ (or appending-to-kbd-macro
+ ;; Just for safety. kmacro.el should be loaded if we got here.
+ ;; Nothing else sets `appending-to-kbd-macro' to t.
+ (not (featurep 'kmacro))
+ (with-no-warnings (kmacro-ring-empty-p))
+ (with-no-warnings (kmacro-pop-ring)))
(setq defining-kbd-macro nil)
(signal 'quit nil))
============================================================
- Re: Another bug with the macro counter, (continued)
- Re: Another bug with the macro counter, Luc Teirlinck, 2004/10/30
- Re: Another bug with the macro counter, Stefan, 2004/10/30
- Re: Another bug with the macro counter, David Kastrup, 2004/10/31
- Re: Another bug with the macro counter, Andreas Schwab, 2004/10/31
- Re: Another bug with the macro counter, Stefan, 2004/10/31
- Re: Another bug with the macro counter, David Kastrup, 2004/10/31
- Re: Another bug with the macro counter, Luc Teirlinck, 2004/10/31
- Re: Another bug with the macro counter, Luc Teirlinck, 2004/10/30
- Re: Another bug with the macro counter, Luc Teirlinck, 2004/10/30
- Re: Another bug with the macro counter, Kim F. Storm, 2004/10/30
- Re: Another bug with the macro counter,
Luc Teirlinck <=
- Re: Another bug with the macro counter, Luc Teirlinck, 2004/10/30
- Re: Another bug with the macro counter, Kim F. Storm, 2004/10/30
- Re: Another bug with the macro counter, Luc Teirlinck, 2004/10/31
- Re: Another bug with the macro counter, Kim F. Storm, 2004/10/31
- Re: Another bug with the macro counter, Richard Stallman, 2004/10/31