]> code.delx.au - gnu-emacs/blobdiff - src/cmds.c
Fix bug #11367 with assertion violation during vertical motion in egg.el.
[gnu-emacs] / src / cmds.c
index 1cf7ff24fecae6c9977ed0c12f2e6f12e4ffea7c..a020a447eb147c842796d4168d50b305d7c3b6d0 100644 (file)
@@ -1,6 +1,6 @@
 /* Simple built-in editing commands.
 
-Copyright (C) 1985, 1993-1998, 2001-2011  Free Software Foundation, Inc.
+Copyright (C) 1985, 1993-1998, 2001-2012  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -31,10 +31,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "dispextern.h"
 #include "frame.h"
 
-Lisp_Object Qkill_forward_chars, Qkill_backward_chars;
+static Lisp_Object Qkill_forward_chars, Qkill_backward_chars;
 
 /* A possible value for a buffer's overwrite-mode variable.  */
-Lisp_Object Qoverwrite_mode_binary;
+static Lisp_Object Qoverwrite_mode_binary;
 
 static int internal_self_insert (int, EMACS_INT);
 \f
@@ -271,7 +271,8 @@ Whichever character you type to run this command is inserted.
 Before insertion, `expand-abbrev' is executed if the inserted character does
 not have word syntax and the previous character in the buffer does.
 After insertion, the value of `auto-fill-function' is called if the
-`auto-fill-chars' table has a non-nil value for the inserted character.  */)
+`auto-fill-chars' table has a non-nil value for the inserted character.
+At the end, it runs `post-self-insert-hook'.  */)
   (Lisp_Object n)
 {
   int remove_boundary = 1;
@@ -471,7 +472,7 @@ internal_self_insert (int c, EMACS_INT n)
     {
       USE_SAFE_ALLOCA;
       char *strn, *p;
-      SAFE_ALLOCA (strn, char *, n * len);
+      SAFE_NALLOCA (strn, len, n);
       for (p = strn; n > 0; n--, p += len)
        memcpy (p, str, len);
       insert_and_inherit (strn, p - strn);
@@ -511,20 +512,11 @@ internal_self_insert (int c, EMACS_INT n)
 void
 syms_of_cmds (void)
 {
-  Qkill_backward_chars = intern_c_string ("kill-backward-chars");
-  staticpro (&Qkill_backward_chars);
-
-  Qkill_forward_chars = intern_c_string ("kill-forward-chars");
-  staticpro (&Qkill_forward_chars);
-
-  Qoverwrite_mode_binary = intern_c_string ("overwrite-mode-binary");
-  staticpro (&Qoverwrite_mode_binary);
-
-  Qexpand_abbrev = intern_c_string ("expand-abbrev");
-  staticpro (&Qexpand_abbrev);
-
-  Qpost_self_insert_hook = intern_c_string ("post-self-insert-hook");
-  staticpro (&Qpost_self_insert_hook);
+  DEFSYM (Qkill_backward_chars, "kill-backward-chars");
+  DEFSYM (Qkill_forward_chars, "kill-forward-chars");
+  DEFSYM (Qoverwrite_mode_binary, "overwrite-mode-binary");
+  DEFSYM (Qexpand_abbrev, "expand-abbrev");
+  DEFSYM (Qpost_self_insert_hook, "post-self-insert-hook");
 
   DEFVAR_LISP ("post-self-insert-hook", Vpost_self_insert_hook,
               doc: /* Hook run at the end of `self-insert-command'.