Merge from emacs--devo--0
[bpt/emacs.git] / src / cmds.c
index c8e7881..45b3f87 100644 (file)
@@ -1,12 +1,12 @@
 /* Simple built-in editing commands.
    Copyright (C) 1985, 1993, 1994, 1995, 1996, 1997, 1998, 2001, 2002,
-                 2003, 2004, 2005 Free Software Foundation, Inc.
+                 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -77,12 +77,12 @@ On reaching end of buffer, stop and signal error.  */)
     if (new_point < BEGV)
       {
        SET_PT (BEGV);
-       Fsignal (Qbeginning_of_buffer, Qnil);
+       xsignal0 (Qbeginning_of_buffer);
       }
     if (new_point > ZV)
       {
        SET_PT (ZV);
-       Fsignal (Qend_of_buffer, Qnil);
+       xsignal0 (Qend_of_buffer);
       }
 
     SET_PT (new_point);
@@ -245,14 +245,14 @@ N was explicitly specified.  */)
       if (XINT (n) < 0)
        {
          if (pos < BEGV)
-           Fsignal (Qbeginning_of_buffer, Qnil);
+           xsignal0 (Qbeginning_of_buffer);
          else
            del_range (pos, PT);
        }
       else
        {
          if (pos > ZV)
-           Fsignal (Qend_of_buffer, Qnil);
+           xsignal0 (Qend_of_buffer);
          else
            del_range (PT, pos);
        }
@@ -536,7 +536,8 @@ internal_self_insert (c, noautofill)
           justification, if any, know where the end is going to be.  */
        SET_PT_BOTH (PT - 1, PT_BYTE - 1);
       tem = call0 (current_buffer->auto_fill_function);
-      if (c == '\n')
+      /* Test PT < ZV in case the auto-fill-function is strange.  */
+      if (c == '\n' && PT < ZV)
        SET_PT_BOTH (PT + 1, PT_BYTE + 1);
       if (!NILP (tem))
        hairy = 2;