[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Musings: Supposed places of safety, guaranteed by parse-partial-sexp are
From: |
Alan Mackenzie |
Subject: |
Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe. |
Date: |
Sat, 3 Dec 2011 23:23:01 +0000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi, Emacs.
There's a problem with parse-partial-sexp. If one scans to the middle
of a comment opener /*
^
|
, parse-partial-sexp gives no indication that we might be half inside a
comment. In particular, checking (nth 3 state) and (nth 4 state) is
insufficient to know that one is at a "safe place".
parse-partial-sexp does, however, notify the caller when it is just
after a backquote, a somewhat analogous situation.
No doubt there is some record of this state hidden away in (nth 9
state).
I think it would be a good idea to provide a function to test for this
"half comment" state, somewhat like `syntax-ppss-toplevel-pos'. This
new defun could be called something like
`syntax-ppss-comment-half-opener' and calling it would return nil
usually, but ?/ in these circumstances.
What do other people think?
--
Alan Mackenzie (Nuremberg, Germany).
- Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe.,
Alan Mackenzie <=
- Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe., Daniel Colascione, 2011/12/03
- Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe., Stefan Monnier, 2011/12/03
- Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe., martin rudalics, 2011/12/04
- Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe., Stefan Monnier, 2011/12/04
- Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe., martin rudalics, 2011/12/04
- Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe., Andreas Röhler, 2011/12/04
- Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe., Stefan Monnier, 2011/12/04
- Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe., martin rudalics, 2011/12/05
- Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe., Stefan Monnier, 2011/12/05
- Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe., Alan Mackenzie, 2011/12/05