[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Feature request/RFC: proper highlighting of code embedded in comment
From: |
Clément Pit--Claudel |
Subject: |
Re: Feature request/RFC: proper highlighting of code embedded in comments |
Date: |
Mon, 17 Oct 2016 10:19:47 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 2016-10-17 09:02, Stefan Monnier wrote:
>> Thanks! How is the package called? I don't see it list-packages :/
>
> It's called sm-c-mode. And no, it's not in GNU ELPA, it's in elpa.git.
Thanks! I'll look.
>> The issue here is that “What a great example” is a string. I tried
>> using a syntactic face function to mark the last ‘>’ as a string
>> closer and the newline as a string opener,
>
> Never set `syntax-table` text properties from
> font-lock-syntactic-face-function (this will bring nothing but
> problems that are difficult to track down). Been there, done that.
> Do it from syntax-propertize-function.
Woops, this was a typo. I'm using a syntax-propertize-function.
>> but that confused the existing function, which expects the docstring
>> starter to be ‘"""’, not ‘\n’. Even after fixing this, python-mode
>> was unusable: it inflooped when trying to find a whole defun, because
>> the nav-end-of-defun function isn't ready to accept ‘\n’ as
>> a string starter.
>
> Sounds like you need to adjust other parts of the code, yes.
>
> Alternatively, don't use `syntax-table` text properties at all, and
> highlight the nested strings "by hand" (with regexps and/or manual
> parsing).
OK; I think I'll go with the solution I posted in the other subthread :)
Thanks!
Clément.
signature.asc
Description: OpenPGP digital signature