From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Feature request/RFC: proper highlighting of code embedded in comments Date: Mon, 17 Oct 2016 09:02:35 -0400 Message-ID: References: <930446db-6dad-72a0-d0cd-a0710e5c6ec3@mit.edu> <0a7df382-4edf-3a27-a102-bfc61e5b6aae@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1476709684 28186 195.159.176.226 (17 Oct 2016 13:08:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 17 Oct 2016 13:08:04 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 17 15:08:01 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bw7di-0004Tg-An for ged-emacs-devel@m.gmane.org; Mon, 17 Oct 2016 15:07:38 +0200 Original-Received: from localhost ([::1]:32988 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw7dk-0005dZ-Ez for ged-emacs-devel@m.gmane.org; Mon, 17 Oct 2016 09:07:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw7Zx-0003DH-Pb for emacs-devel@gnu.org; Mon, 17 Oct 2016 09:03:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bw7Zt-00043M-Pi for emacs-devel@gnu.org; Mon, 17 Oct 2016 09:03:45 -0400 Original-Received: from [195.159.176.226] (port=52167 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bw7Zt-000433-J4 for emacs-devel@gnu.org; Mon, 17 Oct 2016 09:03:41 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1bw7ZI-00013Z-SE for emacs-devel@gnu.org; Mon, 17 Oct 2016 15:03:04 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 27 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:PqjNeWOZvvLxwDa+aklZeCV3Hv4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:208352 Archived-At: > 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