Article View: gnu.emacs.bug
Article #99645parse-sexp-ignore-comments considered inconvenient
From: David Detlefs
Date: Wed, 20 Jun 1990 20:07
Date: Wed, 20 Jun 1990 20:07
44 lines
2503 bytes
2503 bytes
To whomever is interested:
I was the original implementor of the c++-mode.el that is (I am given
to understand) to be included in version 19 of gnu-emacs. Back a few
years ago when I did that I ran into some problems that still remain
problems. I thought I would see if someone knowledgeable wished to
comment.
I originally thought the task was going to be easy: just take c-mode
and tweak it a bit. Well, it's almost that simple, bug not quite.
The big catch is the introduction of comments that begin with "//" and
end with the next newline in C++. In the doc string for
'parse-sexp-ignore-comments' it says
If comments are terminated by newlines,
you must make this variable nil.
Pretty direct. Since we have comments terminated by newlines in C++,
this must be nil. Unfortunately, this has an unpleasant side effect:
parse-partial-sexp will now look at the bodies of comments. At least
one effect of this is that "'" can no longer be a string delimiter.
If it is, then code like this
foo(bar,
// Don't do this!
baz)
will not match parens correctly when the close paren is typed, since
it will think it's still within a string. And, in fact, paren matching
will be messed up for the rest of the file. So, I made "'" a
punctuation character and lived with it. I forgot the reason for this
(and didn't write it down anywhere), so someone pointed out a year
later that "'" should be a string delimiter, so I mistakenly changed
it back for a while before I remembered the reason. Just today
someone else has pointed out the same mistake. Can anyone think of
any way around this? It seems like it would be nice if
parse-sexp-ignore-comments didn't have to be nil when newline-ended
coments were in use. But I imagine there's good reasons for it.
Thanks!
Dave
P.S. I hope I've chosen the appropriate group for this message.
Technical Details
Message-ID:
<9006202107.AA06974@life.ai.mit.edu>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!F.GP.CS.CMU.EDU!dldShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,7eeed121198bf31f,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1990-06-20 13:07:46 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!F.GP.CS.CMU.EDU!dld From: dld@F.GP.CS.CMU.EDU (David Detlefs) Newsgroups: gnu.emacs.bug Subject: parse-sexp-ignore-comments considered inconvenient Message-ID: <9006202107.AA06974@life.ai.mit.edu> Date: 20 Jun 90 20:07:46 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 44 Posted: Wed Jun 20 21:07:46 1990