unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: Feature request/RFC: proper highlighting of code embedded in comments
Date: Mon, 17 Oct 2016 09:02:35 -0400	[thread overview]
Message-ID: <jwvmvi3dtfk.fsf-monnier+gmane.emacs.devel@gnu.org> (raw)
In-Reply-To: 0a7df382-4edf-3a27-a102-bfc61e5b6aae@gmail.com

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


        Stefan




  reply	other threads:[~2016-10-17 13:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-15 15:19 Feature request/RFC: proper highlighting of code embedded in comments Clément Pit--Claudel
2016-10-15 20:22 ` Dmitry Gutov
2016-10-15 21:21   ` Clément Pit--Claudel
2016-10-16 17:42 ` Stefan Monnier
2016-10-16 21:05   ` Clément Pit--Claudel
2016-10-17 13:02     ` Stefan Monnier [this message]
2016-10-17 14:19       ` Clément Pit--Claudel
2016-10-16 21:10 ` Clément Pit--Claudel
2016-10-17 13:12   ` Stefan Monnier
2016-10-17 14:25     ` Clément Pit--Claudel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvmvi3dtfk.fsf-monnier+gmane.emacs.devel@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).