Index: file-coding.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/file-coding.c,v
retrieving revision 1.7.2.23
diff -u -r1.7.2.23 file-coding.c
--- file-coding.c	1999/10/24 03:48:37	1.7.2.23
+++ file-coding.c	1999/10/26 08:55:45
@@ -1666,11 +1666,21 @@
       nread = Lstream_read (stream, random_buffer, sizeof (random_buffer));
       if (nread)
 	{
+	  int comment_found = 0;
 	  unsigned char *cp = random_buffer;
 
-	  while (cp < random_buffer + nread)
+	  while (cp < random_buffer + nread && *cp != '\r' && *cp != '\n')
 	    {
-	      if ((*cp++ == 'c') && (cp < random_buffer + nread) &&
+	      if (!comment_found
+		  && (*cp++ == '-') && (cp < random_buffer + nread)
+		  && (*cp++ == '*') && (cp < random_buffer + nread)
+		  && (*cp++ == '-') && (cp < random_buffer + nread))
+		comment_found = 1;
+
+	      if (comment_found &&
+		  (*cp++ == 'c') && (cp < random_buffer + nread) &&
+		  ((*(cp - 2) == ' ') || (*(cp - 2) == '\t')
+		   || (*(cp - 2) == ';')) &&
 		  (*cp++ == 'o') && (cp < random_buffer + nread) &&
 		  (*cp++ == 'd') && (cp < random_buffer + nread) &&
 		  (*cp++ == 'i') && (cp < random_buffer + nread) &&
@@ -1686,8 +1696,9 @@
 		    {
 		      cp++;
 		    }
-		  while ( (cp < random_buffer + nread) &&
-			  (*cp != ' ') && (*cp != '\t') && (*cp != ';') )
+		  while ((cp < random_buffer + nread)
+			 && (*cp != ' ') && (*cp != '\t')
+			 && (*cp != ';') && (*cp != '\r') && (*cp != '\n'))
 		    {
 		      *np++ = *cp++;
 		    }
