unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe.
@ 2011-12-03 23:23 Alan Mackenzie
  2011-12-03 23:40 ` Daniel Colascione
  2011-12-04  3:39 ` Stefan Monnier
  0 siblings, 2 replies; 16+ messages in thread
From: Alan Mackenzie @ 2011-12-03 23:23 UTC (permalink / raw)
  To: emacs-devel

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).



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2011-12-06 13:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-03 23:23 Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe Alan Mackenzie
2011-12-03 23:40 ` Daniel Colascione
2011-12-04  3:39 ` Stefan Monnier
2011-12-04 10:41   ` martin rudalics
2011-12-04 15:21     ` Stefan Monnier
2011-12-04 17:06       ` martin rudalics
2011-12-04 20:47         ` Andreas Röhler
2011-12-05  3:33         ` Stefan Monnier
2011-12-05  7:41           ` martin rudalics
2011-12-05 14:01             ` Stefan Monnier
2011-12-05 11:35           ` Alan Mackenzie
2011-12-05 11:25         ` Alan Mackenzie
2011-12-06 10:15           ` martin rudalics
2011-12-06 10:33             ` Alan Mackenzie
2011-12-06 13:39               ` martin rudalics
2011-12-06 13:50               ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).