Article View: gnu.emacs.bug
Article #98964scan_lists
From: lstead
Date: Tue, 22 Jan 1991 19:59
Date: Tue, 22 Jan 1991 19:59
72 lines
2160 bytes
2160 bytes
In GNU Emacs 18.56.20 of Tue Jan 22 1991 on waimea.b (silicon-graphics-unix)
If you (setq parse-sexp-ignore-comments t), which seems like what you want
normally for lisp, scan_lists doesn't go backward properly. The
problem is that scan_lists assumes "comment end" always ends a comment,
like "*/" for C. But that's not true for "newline" in lisp.
This is my half-baked-low-effort fix - I just change one case.
from syntax.c
scan_lists (from, count, depth, sexpflag)
...
while (count < 0)
{
int cur;
...
case Sendcomment:
if (!parse_sexp_ignore_comments) break;
/* Have to treat Lisp nl specially, since it doesn't always end a comment. */
/* doesn't handle #\; or semicolons inside strings. */
cur = from;
if (c == '\n')
{
while (1)
{
--cur;
if (cur == stop)
goto nosemi;
switch (FETCH_CHAR (cur))
{
case ';' :
goto semi;
/* We got to the beginning of the line without
seeing a semi, so no comment. */
case '\n' :
goto nosemi;
}
}
semi:;
from = cur;
nosemi:;
}
else
{
if (from != stop) from--;
while (1)
{
if (SYNTAX (c = FETCH_CHAR (from)) == Scomment)
break;
if (from == stop) goto done;
from--;
if (SYNTAX_COMSTART_SECOND (c)
&& SYNTAX_COMSTART_FIRST (FETCH_CHAR (from))
&& !char_quoted (from))
break;
}
}
break;
Technical Details
Message-ID:
<9101221959.AA05362@waimea.bellcore.com>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!BREEZE.BELLCORE.COM!lsteadShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,b7c17f9bff57ff9,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1991-01-22 11:59:17 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!BREEZE.BELLCORE.COM!lstead From: lstead@BREEZE.BELLCORE.COM Newsgroups: gnu.emacs.bug Subject: scan_lists Message-ID: <9101221959.AA05362@waimea.bellcore.com> Date: 22 Jan 91 19:59:17 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 72 Approved: bug-gnu-emacs@prep.ai.mit.edu