changeset 26391:216416ad34fe

(Fforward_word): Handle fields even if would have hit an edge of the buffer. Return nil if affected by fields.
author Richard M. Stallman <rms@gnu.org>
date Tue, 09 Nov 1999 19:00:59 +0000
parents 5aa0cfc19c76
children b3d3ff9a7a2c
files src/syntax.c
diffstat 1 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/syntax.c	Tue Nov 09 18:46:09 1999 +0000
+++ b/src/syntax.c	Tue Nov 09 19:00:59 1999 +0000
@@ -1222,26 +1222,24 @@
 DEFUN ("forward-word", Fforward_word, Sforward_word, 1, 1, "p",
   "Move point forward ARG words (backward if ARG is negative).\n\
 Normally returns t.\n\
-If an edge of the buffer is reached, point is left there\n\
-and nil is returned.")
+If an edge of the buffer or a field boundary is reached, point is left there\n\
+and the function returns nil.")
   (count)
      Lisp_Object count;
 {
-  int val, prompt_end;
+  int orig_val, val;
   CHECK_NUMBER (count, 0);
 
-  if (!(val = scan_words (PT, XINT (count))))
-    {
-      SET_PT (XINT (count) > 0 ? ZV : BEGV);
-      return Qnil;
-    }
+  val = orig_val = scan_words (PT, XINT (count));
+  if (! orig_val)
+    val = XINT (count) > 0 ? ZV : BEGV;
 
   /* Avoid jumping out of an input field.  */
   val = XFASTINT (Fconstrain_to_field (make_number (val), make_number (PT),
 				       Qt, Qnil));
 
   SET_PT (val);
-  return Qt;
+  return (val == orig_val ? Qt : Qnil);
 }
 
 Lisp_Object skip_chars ();