emacs-devel
[Top][All Lists]
Advanced

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

Re: How do you check if the current point is in a comment or a string? (


From: Clément Pit--Claudel
Subject: Re: How do you check if the current point is in a comment or a string? (Was Re: Problems with syntax-ppss: Was [... Apply `comment-depth' text properties when calling `back_comment'.])
Date: Wed, 9 Mar 2016 14:34:37 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

On 03/09/2016 02:19 PM, Kaushal Modi wrote:
> You are correct; it does not work if the point is before the first
> comment character.  That makes sense if you visualize syntax-ppss to
> look at the chars ONLY up to the point. I never faced this case in my
> application.
> 
> May be have a combination of looking-at comment-start or double quote
> (") and syntax-ppss?

Thanks for the suggestion!

Even then, I don't think this works in CC-mode, or in any language that has 
two-character comment markers: it works in Lisp because the comment marker is a 
single semicolon. But in OCaml, for example, (* is a comment marker and 
syntax-ppss doesn't see (<point>* as a comment. This matches your explanation, 
but I don't think the solution applies to that case.

Clément.

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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