[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: |
Thu, 10 Mar 2016 12:21:53 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
On 03/10/2016 10:20 AM, Stefan Monnier wrote:
>> Thanks for the clarification. What's the recommended way to check if the
>> point is in a comment, then? I'm thinking for example of adjusting
>> fill-nobreak-predicate, or similar things.
>
> The recommended way is
>
> (nth 8 (syntax-ppss))
>
> Whether "/<point>*" is inside the comment or not is very debatable, and
> luckily it rarely matters. So if/when it matters and syntax-ppss's
> answer isn't the one we need, then we can discuss the better replacement
> for that specific case, but the specifics will matter then.
Cool, thanks Stefan, As long as this behaviour is consistent with the rest of
Emacs, that's fine by me.
Here's one case where it matters: in tuareg-mode (for OCaml), with the
following code:
(<point>* comment *)
The call to (prettify-symbols-default-compose-p (point) (1+ (point)) nil)
returns t.
On the other hand, the same call with the point as follows returns nil:
(*<point> comment *)
This makes it unreliable to prettify * to × in tuareg mode.
I'll report a bug for prettify-symbols-mode.
Clément.
signature.asc
Description: OpenPGP digital signature
- Re: Problems with syntax-ppss: Was [... Apply `comment-depth' text properties when calling `back_comment'.], (continued)
- Re: Problems with syntax-ppss: Was [... Apply `comment-depth' text properties when calling `back_comment'.], Andreas Röhler, 2016/03/13
- Re: Problems with syntax-ppss: Was [... Apply `comment-depth' text properties when calling `back_comment'.], Stefan Monnier, 2016/03/10
- 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'.]), Clément Pit--Claudel, 2016/03/09
- 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'.]), Kaushal Modi, 2016/03/09
- 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'.]), Clément Pit--Claudel, 2016/03/09
- 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'.]), Kaushal Modi, 2016/03/09
- 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'.]), Clément Pit--Claudel, 2016/03/09
- 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'.]), Stefan Monnier, 2016/03/10
- 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'.]), Clément Pit--Claudel, 2016/03/10
- 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'.]), Stefan Monnier, 2016/03/10
- 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'.]),
Clément Pit--Claudel <=
- 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'.]), Andreas Röhler, 2016/03/12
- 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'.]), Clément Pit--Claudel, 2016/03/12
- Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Richard Stallman, 2016/03/09
- Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Dmitry Gutov, 2016/03/09
- Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Richard Stallman, 2016/03/10
- Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Dmitry Gutov, 2016/03/10
- Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Alan Mackenzie, 2016/03/11
- Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Stefan Monnier, 2016/03/11
- RE: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Drew Adams, 2016/03/11
- Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'., Alan Mackenzie, 2016/03/09