changeset 6142:2dbc79d01191

(Fforward_comment): Do the right thing at eob.
author Karl Heuer <kwzh@gnu.org>
date Wed, 02 Mar 1994 05:31:15 +0000
parents fefa088fc7f9
children 45bdd0e4b6ea
files src/syntax.c
diffstat 1 files changed, 35 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/src/syntax.c	Wed Mar 02 05:29:01 1994 +0000
+++ b/src/syntax.c	Wed Mar 02 05:31:15 1994 +0000
@@ -599,8 +599,13 @@
   while (count1 > 0)
     {
       stop = ZV;
-      while (from < stop)
+      do
 	{
+	  if (from == stop)
+	    {
+	      SET_PT (from);
+	      return Qnil;
+	    }
 	  c = FETCH_CHAR (from);
 	  code = SYNTAX (c);
 	  from++;
@@ -617,45 +622,40 @@
 	      comstyle = SYNTAX_COMMENT_STYLE (FETCH_CHAR (from));
 	      from++;
 	    }
-
-	  if (code == Scomment)
-	    {
-	      while (1)
-		{
-		  if (from == stop)
-		    {
-		      immediate_quit = 0;
-		      SET_PT (from);
-		      return Qnil;
-		    }
-		  c = FETCH_CHAR (from);
-		  if (SYNTAX (c) == Sendcomment
-		      && SYNTAX_COMMENT_STYLE (c) == comstyle)
-		    /* we have encountered a comment end of the same style
-		       as the comment sequence which began this comment
-		       section */
-		    break;
-		  from++;
-		  if (from < stop && SYNTAX_COMEND_FIRST (c)
-		      && SYNTAX_COMEND_SECOND (FETCH_CHAR (from))
-		      && SYNTAX_COMMENT_STYLE (c) == comstyle)
-		    /* we have encountered a comment end of the same style
-		       as the comment sequence which began this comment
-		       section */
-		    { from++; break; }
-		}
-	      /* We have skipped one comment.  */
-	      break;
-	    }
-	  else if (code != Swhitespace && code != Sendcomment)
+	}
+      while (code == Swhitespace || code == Sendcomment);
+      if (code != Scomment)
+	{
+	  immediate_quit = 0;
+	  SET_PT (from - 1);
+	  return Qnil;
+	}
+      /* We're at the start of a comment.  */
+      while (1)
+	{
+	  if (from == stop)
 	    {
 	      immediate_quit = 0;
-	      SET_PT (from - 1);
+	      SET_PT (from);
 	      return Qnil;
 	    }
+	  c = FETCH_CHAR (from);
+	  if (SYNTAX (c) == Sendcomment
+	      && SYNTAX_COMMENT_STYLE (c) == comstyle)
+	    /* we have encountered a comment end of the same style
+	       as the comment sequence which began this comment
+	       section */
+	    break;
+	  from++;
+	  if (from < stop && SYNTAX_COMEND_FIRST (c)
+	      && SYNTAX_COMEND_SECOND (FETCH_CHAR (from))
+	      && SYNTAX_COMMENT_STYLE (c) == comstyle)
+	    /* we have encountered a comment end of the same style
+	       as the comment sequence which began this comment
+	       section */
+	    { from++; break; }
 	}
-
-      /* End of comment reached */
+      /* We have skipped one comment.  */
       count1--;
     }