🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99916

Bug with parse-sexp-ignore-comments in 18.52 and 18.55

#99916
From: salem
Date: Tue, 03 Apr 1990 02:15
103 lines
3674 bytes
Setting parse-sexp-ignore-comments to t, breaks paren flashing and c-m-b in
emacs version 18.55 and 18.52 and probably earlier.  Try it.

We've patched this at Thinking Machines long ago in the syntax.c file.  I'm
enclosing the 18.52 diffs (they are probably similar for 18.55).  Please
fix.

-- jim

*** syntax.c.orig	Wed Nov 23 21:54:29 1988
--- syntax.c	Wed Nov 23 21:59:28 1988
***************
*** 459,464 ****
--- 459,466 ----
    int mathexit = 0;
    register enum syntaxcode code;
    int min_depth = depth;    /* Err out if depth gets less than this. */
+   int ofrom[2];
+   int nq;
  
    if (depth > 0) min_depth = 0;
  
***************
*** 648,668 ****
  		error ("Containing expression ends prematurely");
  	      break;
  
  	    case Sendcomment:
  	      if (!parse_sexp_ignore_comments) break;
  	      if (from != stop) from--;
  	      while (1)
  		{
! 		  if (SYNTAX (c = CharAt (from)) == Scomment)
! 		    break;
! 		  if (from == stop) goto done;
  		  from--;
  		  if (SYNTAX_COMSTART_SECOND (c)
  		      && SYNTAX_COMSTART_FIRST (CharAt (from))
  		      && !char_quoted (from))
! 		    break;
  		}
  	      break;
  
  	    case Sstring:
  	      stringterm = CharAt (from);
--- 650,705 ----
  		error ("Containing expression ends prematurely");
  	      break;
  
+ 	    /* Start Patch (salem 11/22/88) */ 
  	    case Sendcomment:
  	      if (!parse_sexp_ignore_comments) break;
+ 	      /* Recognize any number of begin-comments, with no
+ 	       * intervening end-comments.
+ 	       * If an end-comment is found with no matching
+ 	       * begin-comment, it is treated as whitespace.
+ 	       * Maintain ofrom[0,1] as the last "good" locations
+ 	       * to resume scanning from, for each parity of quotes.
+ 	       * Ofrom[0,1] starts out pointing at the end-comment
+ 	       * sequence, but thereafter points at successive
+ 	       * begin-comment sequences.
+ 	       */
+ 	      ofrom[0] = ofrom[1] = from;
+ 	      nq = 0;
  	      if (from != stop) from--;
  	      while (1)
  		{
! 		  code = SYNTAX (c = CharAt (from));
! #ifdef SWITCH_ENUM_BUG
! 		  switch ((int) code)
! #else
! 		  switch (code)
! #endif
! 		    {
! 		    case Scomment:
! 		      if (char_quoted (from))  break;
! 		      ofrom[nq&1] = from;
! 		      break;
! 		    case Sstring:
! 		      if (!char_quoted (from))
! 			++nq;
! 		      break;
! 		    }
! 		  if (from == stop) break;
  		  from--;
  		  if (SYNTAX_COMSTART_SECOND (c)
  		      && SYNTAX_COMSTART_FIRST (CharAt (from))
  		      && !char_quoted (from))
! 		      ofrom[nq&1] = from;
! 		  if (SYNTAX (c) == Sendcomment
! 		      || SYNTAX_COMEND_SECOND (c)
! 			 && SYNTAX_COMEND_FIRST (CharAt (from))
! 			 && !char_quoted (from))
! 		     /* Reached another end (e.g., \n). */
! 		     break;
  		}
+ 	      from = ofrom[nq&1]; /*backtrack to safe position*/
  	      break;
+ 	      /* End Patch (salem 11/22/88) */ 
  
  	    case Sstring:
  	      stringterm = CharAt (from);
Technical Details
Message-ID: <9004030215.AA00671@mandala.think.com>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!snorkelwacker!tut.cis.ohio-state.edu!THINK.COM!salem

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,7c07e36e6ba8f24f,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-04-03 02:12:08 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!snorkelwacker!tut.cis.ohio-state.edu!THINK.COM!salem
From: salem@THINK.COM
Newsgroups: gnu.emacs.bug
Subject: Bug with parse-sexp-ignore-comments in 18.52 and 18.55
Message-ID: <9004030215.AA00671@mandala.think.com>
Date: 3 Apr 90 02:15:14 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 103
Posted: Tue Apr  3 03:15:14 1990