[Top][All Lists]

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

Re: Feature request/RFC: proper highlighting of code embedded in comment

From: Stefan Monnier
Subject: Re: Feature request/RFC: proper highlighting of code embedded in comments
Date: Mon, 17 Oct 2016 09:02:35 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

> 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.

> 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.

> 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


reply via email to

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