From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: Another bug with the macro counter Date: Sat, 30 Oct 2004 17:04:57 -0500 (CDT) Message-ID: <200410302204.i9UM4vl03402@raven.dms.auburn.edu> References: <200410210107.i9L176B10842@raven.dms.auburn.edu> <200410300238.i9U2cOD02290@raven.dms.auburn.edu> <200410300327.i9U3RWW02355@raven.dms.auburn.edu> <200410301451.i9UEpNG02900@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1099173936 5174 80.91.229.6 (30 Oct 2004 22:05:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 30 Oct 2004 22:05:36 +0000 (UTC) Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 31 00:05:26 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CO1Lh-0002Xg-00 for ; Sun, 31 Oct 2004 00:05:25 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CO1Tc-0002Vn-Ij for ged-emacs-devel@m.gmane.org; Sat, 30 Oct 2004 18:13:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CO1TV-0002Vh-P0 for emacs-devel@gnu.org; Sat, 30 Oct 2004 18:13:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CO1TV-0002VV-Bu for emacs-devel@gnu.org; Sat, 30 Oct 2004 18:13:29 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CO1TV-0002VS-4q for emacs-devel@gnu.org; Sat, 30 Oct 2004 18:13:29 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CO1LX-0001iX-7S for emacs-devel@gnu.org; Sat, 30 Oct 2004 18:05:15 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id i9UM58Fu000057; Sat, 30 Oct 2004 17:05:08 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id i9UM4vl03402; Sat, 30 Oct 2004 17:04:57 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: storm@cua.dk In-reply-to: (storm@cua.dk) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:29196 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:29196 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)) ============================================================