]> code.delx.au - gnu-emacs/blobdiff - src/callint.c
* charset.c (load_charset_map_from_file)
[gnu-emacs] / src / callint.c
index 3641fbc5b779057f86fd991554763d602e465710..2c6ab983de2ec63e13013ae8839ef1915a06bf21 100644 (file)
@@ -1,6 +1,6 @@
 /* Call a Lisp function interactively.
    Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 2000, 2001, 2002,
-                 2003, 2004, 2005, 2006, 2007, 2008, 2009
+                 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
                  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -20,6 +20,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 #include <config.h>
+#include <setjmp.h>
 
 #include "lisp.h"
 #include "buffer.h"
@@ -42,6 +43,7 @@ Lisp_Object Vcommand_history;
 
 extern Lisp_Object Vhistory_length;
 extern Lisp_Object Vthis_original_command, real_this_command;
+extern int history_delete_duplicates;
 
 Lisp_Object Vcommand_debug_status, Qcommand_debug_status;
 Lisp_Object Qenable_recursive_minibuffers;
@@ -366,12 +368,15 @@ invoke it.  If KEYS is omitted or nil, the return value of
        {
          /* We should record this command on the command history.  */
          Lisp_Object values;
+         Lisp_Object this_cmd;
          /* Make a copy of the list of values, for the command history,
             and turn them into things we can eval.  */
          values = quotify_args (Fcopy_sequence (specs));
          fix_command (input, values);
-         Vcommand_history
-           = Fcons (Fcons (function, values), Vcommand_history);
+         this_cmd = Fcons (function, values);
+         if (history_delete_duplicates)
+           Vcommand_history = Fdelete (this_cmd, Vcommand_history);
+         Vcommand_history = Fcons (this_cmd, Vcommand_history);
 
          /* Don't keep command history around forever.  */
          if (INTEGERP (Vhistory_length) && XINT (Vhistory_length) > 0)
@@ -900,46 +905,45 @@ syms_of_callint ()
   callint_message = Qnil;
   staticpro (&callint_message);
 
-  preserved_fns = Fcons (intern ("region-beginning"),
-                        Fcons (intern ("region-end"),
-                               Fcons (intern ("point"),
-                                      Fcons (intern ("mark"), Qnil))));
-  staticpro (&preserved_fns);
+  preserved_fns = pure_cons (intern_c_string ("region-beginning"),
+                        pure_cons (intern_c_string ("region-end"),
+                               pure_cons (intern_c_string ("point"),
+                                      pure_cons (intern_c_string ("mark"), Qnil))));
 
-  Qlist = intern ("list");
+  Qlist = intern_c_string ("list");
   staticpro (&Qlist);
-  Qlet = intern ("let");
+  Qlet = intern_c_string ("let");
   staticpro (&Qlet);
-  Qif = intern ("if");
+  Qif = intern_c_string ("if");
   staticpro (&Qif);
-  Qwhen = intern ("when");
+  Qwhen = intern_c_string ("when");
   staticpro (&Qwhen);
-  Qletx = intern ("let*");
+  Qletx = intern_c_string ("let*");
   staticpro (&Qletx);
-  Qsave_excursion = intern ("save-excursion");
+  Qsave_excursion = intern_c_string ("save-excursion");
   staticpro (&Qsave_excursion);
-  Qprogn = intern ("progn");
+  Qprogn = intern_c_string ("progn");
   staticpro (&Qprogn);
 
-  Qminus = intern ("-");
+  Qminus = intern_c_string ("-");
   staticpro (&Qminus);
 
-  Qplus = intern ("+");
+  Qplus = intern_c_string ("+");
   staticpro (&Qplus);
 
-  Qhandle_shift_selection = intern ("handle-shift-selection");
+  Qhandle_shift_selection = intern_c_string ("handle-shift-selection");
   staticpro (&Qhandle_shift_selection);
 
-  Qcall_interactively = intern ("call-interactively");
+  Qcall_interactively = intern_c_string ("call-interactively");
   staticpro (&Qcall_interactively);
 
-  Qcommand_debug_status = intern ("command-debug-status");
+  Qcommand_debug_status = intern_c_string ("command-debug-status");
   staticpro (&Qcommand_debug_status);
 
-  Qenable_recursive_minibuffers = intern ("enable-recursive-minibuffers");
+  Qenable_recursive_minibuffers = intern_c_string ("enable-recursive-minibuffers");
   staticpro (&Qenable_recursive_minibuffers);
 
-  Qmouse_leave_buffer_hook = intern ("mouse-leave-buffer-hook");
+  Qmouse_leave_buffer_hook = intern_c_string ("mouse-leave-buffer-hook");
   staticpro (&Qmouse_leave_buffer_hook);
 
   DEFVAR_KBOARD ("prefix-arg", Vprefix_arg,