[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fri, 19 Jul 2002 13:52:41 -0400
> (defun inside-comment-or-string-p ()
> "Return non-nil if `point' is inside a comment or string."
> (let ((state (syntax-ppss (point))))
> (or (nth 3 state) (nth 4 state))))
> Stefan, do you see any reason this would be wrong?
No particular reason, no.
> (Depending on font lock would not be a general solution.)
Indeed. It's a convenient hack, but no more.
> If Stefan sees no basic flaw in this, then would one of you like to
> try modifying some of the functions in lisp.el to test this criterion?
> I guess backward-up-list could move backward out of the string
> constant and treat that as one level of list. Same-level motion
> commands could move to the beginning or end of the string and count
> that as having moved over one sexp.
Of course if backward-up-list can work all within the string
(in which it currently already DTRT), it should still DTRT.
So it should first try "within the string/comment" and only if
that fails, should it move out.
I'm sure there are more special cases to think of,