]> code.delx.au - gnu-emacs/blobdiff - src/cmds.c
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
[gnu-emacs] / src / cmds.c
index e81d7c61e59acc4fa6a9bf677209b731d588a415..df8cd6d064503be17c8e37285fe5ff76811b3691 100644 (file)
@@ -1,5 +1,5 @@
 /* Simple built-in editing commands.
-   Copyright (C) 1985, 1992 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1993 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -41,17 +41,28 @@ On reaching end of buffer, stop and signal error.")
   else
     CHECK_NUMBER (n, 0);
 
-  SET_PT (point + XINT (n));
-  if (point < BEGV)
-    {
-      SET_PT (BEGV);
-      Fsignal (Qbeginning_of_buffer, Qnil);
-    }
-  if (point > ZV)
-    {
-      SET_PT (ZV);
-      Fsignal (Qend_of_buffer, Qnil);
-    }
+  /* This used to just set point to point + XINT (n), and then check
+     to see if it was within boundaries.  But now that SET_PT can
+     potentially do a lot of stuff (calling entering and exiting
+     hooks, etcetera), that's not a good approach.  So we validate the
+     proposed position, then set point.  */
+  {
+    int new_point = point + XINT (n);
+
+    if (new_point < BEGV)
+      {
+       SET_PT (BEGV);
+       Fsignal (Qbeginning_of_buffer, Qnil);
+      }
+    if (new_point > ZV)
+      {
+       SET_PT (ZV);
+       Fsignal (Qend_of_buffer, Qnil);
+      }
+
+    SET_PT (new_point);
+  }
+
   return Qnil;
 }
 
@@ -230,10 +241,10 @@ In Auto Fill mode, if no numeric arg, break the preceding line if it's long.")
   arg = Fprefix_numeric_value (arg1);
 
   if (!NILP (current_buffer->read_only))
-    Fsignal (Qbuffer_read_only, Qnil);
+    Fbarf_if_buffer_read_only ();
 
   /* Inserting a newline at the end of a line produces better
-     redisplay in try_window_id than inserting at the ebginning fo a
+     redisplay in try_window_id than inserting at the beginning of a
      line, and the textual result is the same.  So, if we're at
      beginning of line, pretend to be at the end of the previous line.  
 
@@ -369,6 +380,8 @@ keys_of_cmds ()
   initial_define_key (global_map, Ctl('I'), "self-insert-command");
   for (n = 040; n < 0177; n++)
     initial_define_key (global_map, n, "self-insert-command");
+  for (n = 0240; n < 0377; n++)
+    initial_define_key (global_map, n, "self-insert-command");
 
   initial_define_key (global_map, Ctl ('A'), "beginning-of-line");
   initial_define_key (global_map, Ctl ('B'), "backward-char");