Changed "Lucid Emacs" to "XEmacs".
[bpt/emacs.git] / src / syntax.c
index 41a236e..b6f2da2 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU Emacs routines to deal with syntax tables; also word and list parsing.
-   Copyright (C) 1985, 1987, 1993, 1994 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1987, 1993, 1994, 1995 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -401,11 +401,7 @@ describe_syntax (value)
 
   insert_string ("\twhich means: ");
 
-#ifdef SWITCH_ENUM_BUG
-  switch ((int) code)
-#else
-  switch (code)
-#endif
+  switch (SWITCH_ENUM_CAST (code))
     {
     case Swhitespace:
       insert_string ("whitespace"); break;
@@ -471,6 +467,7 @@ describe_syntax_1 (vector)
   struct buffer *old = current_buffer;
   set_buffer_internal (XBUFFER (Vstandard_output));
   describe_vector (vector, Qnil, describe_syntax, 0, Qnil);
+  call0 (intern ("help-mode"));
   set_buffer_internal (old);
   return Qnil;
 }
@@ -617,6 +614,7 @@ between them, return t; otherwise return nil.")
          if (from == stop)
            {
              SET_PT (from);
+             immediate_quit = 0;
              return Qnil;
            }
          c = FETCH_CHAR (from);
@@ -904,11 +902,7 @@ scan_lists (from, count, depth, sexpflag)
          if (SYNTAX_PREFIX (c))
            continue;
 
-#ifdef SWITCH_ENUM_BUG
-         switch ((int) code)
-#else
-         switch (code)
-#endif
+         switch (SWITCH_ENUM_CAST (code))
            {
            case Sescape:
            case Scharquote:
@@ -921,11 +915,7 @@ scan_lists (from, count, depth, sexpflag)
              /* This word counts as a sexp; return at end of it. */
              while (from < stop)
                {
-#ifdef SWITCH_ENUM_BUG
-                 switch ((int) SYNTAX (FETCH_CHAR (from)))
-#else
-                 switch (SYNTAX (FETCH_CHAR (from)))
-#endif
+                 switch (SWITCH_ENUM_CAST (SYNTAX (FETCH_CHAR (from))))
                    {
                    case Scharquote:
                    case Sescape:
@@ -1000,11 +990,7 @@ scan_lists (from, count, depth, sexpflag)
                {
                  if (from >= stop) goto lose;
                  if (FETCH_CHAR (from) == stringterm) break;
-#ifdef SWITCH_ENUM_BUG
-                 switch ((int) SYNTAX (FETCH_CHAR (from)))
-#else
-                 switch (SYNTAX (FETCH_CHAR (from)))
-#endif
+                 switch (SWITCH_ENUM_CAST (SYNTAX (FETCH_CHAR (from))))
                    {
                    case Scharquote:
                    case Sescape:
@@ -1058,11 +1044,7 @@ scan_lists (from, count, depth, sexpflag)
          if (SYNTAX_PREFIX (c))
            continue;
 
-#ifdef SWITCH_ENUM_BUG
-         switch ((int) (quoted ? Sword : code))
-#else
-         switch (quoted ? Sword : code)
-#endif
+         switch (SWITCH_ENUM_CAST (quoted ? Sword : code))
            {
            case Sword:
            case Ssymbol:
@@ -1465,11 +1447,7 @@ scan_sexps_forward (stateptr, from, end, targetdepth,
 
       if (SYNTAX_PREFIX (FETCH_CHAR (from - 1)))
        continue;
-#ifdef SWITCH_ENUM_BUG
-      switch ((int) code)
-#else
-      switch (code)
-#endif
+      switch (SWITCH_ENUM_CAST (code))
        {
        case Sescape:
        case Scharquote:
@@ -1487,11 +1465,7 @@ scan_sexps_forward (stateptr, from, end, targetdepth,
        symstarted:
          while (from < end)
            {
-#ifdef SWITCH_ENUM_BUG
-             switch ((int) SYNTAX (FETCH_CHAR (from)))
-#else
-             switch (SYNTAX (FETCH_CHAR (from)))
-#endif
+             switch (SWITCH_ENUM_CAST (SYNTAX (FETCH_CHAR (from))))
                {
                case Scharquote:
                case Sescape:
@@ -1511,9 +1485,20 @@ scan_sexps_forward (stateptr, from, end, targetdepth,
          curlevel->prev = curlevel->last;
          break;
 
+       startincomment:
+         if (commentstop)
+           goto done;
+         if (from != BEGV)
+           {
+             /* Enter the loop in the middle so that we find
+                a 2-char comment ender if we start in the middle of it.  */
+             prev = FETCH_CHAR (from - 1);
+             goto startincomment_1;
+           }
+         /* At beginning of buffer, enter the loop the ordinary way.  */
+
        case Scomment:
          state.incomment = 1;
-       startincomment:
          if (commentstop)
            goto done;
          while (1)
@@ -1527,6 +1512,7 @@ scan_sexps_forward (stateptr, from, end, targetdepth,
                   encountered.  */
                break;
              from++;
+           startincomment_1:
              if (from < end && SYNTAX_COMEND_FIRST (prev)
                  && SYNTAX_COMEND_SECOND (FETCH_CHAR (from))
                  && SYNTAX_COMMENT_STYLE (prev) == state.comstyle)
@@ -1570,11 +1556,7 @@ scan_sexps_forward (stateptr, from, end, targetdepth,
            {
              if (from >= end) goto done;
              if (FETCH_CHAR (from) == state.instring) break;
-#ifdef SWITCH_ENUM_BUG
-             switch ((int) SYNTAX (FETCH_CHAR (from)))
-#else
-             switch (SYNTAX (FETCH_CHAR (from)))
-#endif
+             switch (SWITCH_ENUM_CAST (SYNTAX (FETCH_CHAR (from))))
                {
                case Scharquote:
                case Sescape: