diff src/cmds.c @ 22:8fc7fe29b841 r19-15b94

Import from CVS: tag r19-15b94
author cvs
date Mon, 13 Aug 2007 08:50:29 +0200
parents 859a2309aef8
children 131b0175ea99
line wrap: on
line diff
--- a/src/cmds.c	Mon Aug 13 08:50:06 2007 +0200
+++ b/src/cmds.c	Mon Aug 13 08:50:29 2007 +0200
@@ -41,11 +41,15 @@
 /* This is the command that set up Vself_insert_face.  */
 Lisp_Object Vself_insert_face_command;
 
+/* t means beep when movement would take point past (point-min) or */
+/* (point-max) */
+int signal_error_on_buffer_boundary;
 
 DEFUN ("forward-char", Fforward_char, 0, 2, "_p", /*
 Move point right ARG characters (left if ARG negative).
 On reaching end of buffer, stop and signal error.
-If BUFFER is nil, the current buffer is assumed.
+Error signaling is suppressed if `signal-error-on-buffer-boundary'
+is nil.  If BUFFER is nil, the current buffer is assumed.
 */
        (arg, buffer))
 {
@@ -67,12 +71,18 @@
     if (new_point < BUF_BEGV (buf))
       {
 	BUF_SET_PT (buf, BUF_BEGV (buf));
-	Fsignal (Qbeginning_of_buffer, Qnil);
+	if (signal_error_on_buffer_boundary)
+	  Fsignal (Qbeginning_of_buffer, Qnil);
+	else
+	  return Qnil;
       }
     if (new_point > BUF_ZV (buf))
       {
 	BUF_SET_PT (buf, BUF_ZV (buf));
-	Fsignal (Qend_of_buffer, Qnil);
+	if (signal_error_on_buffer_boundary)
+	  Fsignal (Qend_of_buffer, Qnil);
+	else
+	  return Qnil;
       }
 
     BUF_SET_PT (buf, new_point);
@@ -84,7 +94,8 @@
 DEFUN ("backward-char", Fbackward_char, 0, 2, "_p", /*
 Move point left ARG characters (right if ARG negative).
 On attempt to pass beginning or end of buffer, stop and signal error.
-If BUFFER is nil, the current buffer is assumed.
+Error signaling is suppressed if `signal-error-on-buffer-boundary'
+is nil.  If BUFFER is nil, the current buffer is assumed.
 */
        (arg, buffer))
 {
@@ -479,4 +490,10 @@
 More precisely, a char with closeparen syntax is self-inserted.
 */ );
   Vblink_paren_function = Qnil;
+
+  DEFVAR_BOOL ("signal-error-on-buffer-boundary", &signal_error_on_buffer_boundary /*
+t means beep when movement would take point past (point-min) or
+\(point-max).
+*/ );
+  signal_error_on_buffer_boundary = 1;
 }