changeset 21726:1771dc61b028

(Fcommand_execute): Truncate command-history here.
author Richard M. Stallman <rms@gnu.org>
date Thu, 23 Apr 1998 21:25:55 +0000
parents 375190ad5062
children 88afa87063ff
files src/keyboard.c
diffstat 1 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Thu Apr 23 21:24:29 1998 +0000
+++ b/src/keyboard.c	Thu Apr 23 21:25:55 1998 +0000
@@ -488,6 +488,8 @@
 Lisp_Object Qextended_command_history;
 EMACS_TIME timer_check ();
 
+extern Lisp_Object Vhistory_length;
+
 extern char *x_get_keysym_name ();
 
 static void record_menu_key ();
@@ -7474,13 +7476,24 @@
 	 other sorts of commands, call-interactively takes care of
 	 this.  */
       if (!NILP (record_flag))
-	Vcommand_history
-	  = Fcons (Fcons (Qexecute_kbd_macro,
-			  Fcons (final, Fcons (prefixarg, Qnil))),
-		   Vcommand_history);
+	{
+	  Vcommand_history
+	    = Fcons (Fcons (Qexecute_kbd_macro,
+			    Fcons (final, Fcons (prefixarg, Qnil))),
+		     Vcommand_history);
+
+	  /* Don't keep command history around forever.  */
+	  if (NUMBERP (Vhistory_length) && XINT (Vhistory_length) > 0)
+	    {
+	      tem = Fnthcdr (Vhistory_length, Vcommand_history);
+	      if (CONSP (tem))
+		XCONS (tem)->cdr = Qnil;
+	    }
+	}
 
       return Fexecute_kbd_macro (final, prefixarg);
     }
+
   if (CONSP (final) || SUBRP (final) || COMPILEDP (final))
     {
       backtrace.next = backtrace_list;