help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: identifiing strings and comments in program source files (to skip th


From: Stefan Monnier
Subject: Re: identifiing strings and comments in program source files (to skip them over)
Date: Wed, 26 Apr 2006 02:01:53 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> I have a mode what uses font-lock-mode and highlights everything nicely. I
> think I could use this (= the face set by font-lock-mode) for identifiing
> if e.g. a search stopped in a string or comment. (I know font-lock-mode
> must be enabled for this.) This way I could omit reparsing the buffer (with
> parse-partial-sexp) e.g. in a function what searches something "real" (=
> strings and comments should be skipped).

You can use this (I've used it in several occasions).
In Emacs-CVS you can also use syntax-ppss which is like parse-partial-sexp
except it does caching (and it's used by font-lock so the cache is already
filled by the font-lock activity).


        Stefan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]