From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: Feature request/RFC: proper highlighting of code embedded in comments Date: Sun, 16 Oct 2016 17:05:01 -0400 Message-ID: <0a7df382-4edf-3a27-a102-bfc61e5b6aae@gmail.com> References: <930446db-6dad-72a0-d0cd-a0710e5c6ec3@mit.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hhIgCjdSIQJqf9KMKFT1Ogs5Xqm91QV28" X-Trace: blaine.gmane.org 1476652000 21782 195.159.176.226 (16 Oct 2016 21:06:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 16 Oct 2016 21:06:40 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 16 23:06:37 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 1bvsdZ-0004JQ-I9 for ged-emacs-devel@m.gmane.org; Sun, 16 Oct 2016 23:06:29 +0200 Original-Received: from localhost ([::1]:57788 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bvsdb-00081V-N0 for ged-emacs-devel@m.gmane.org; Sun, 16 Oct 2016 17:06:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bvscL-0007Ii-QV for emacs-devel@gnu.org; Sun, 16 Oct 2016 17:05:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bvscH-0008Vh-RU for emacs-devel@gnu.org; Sun, 16 Oct 2016 17:05:13 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.135]:62062) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bvscH-0008Uu-HJ for emacs-devel@gnu.org; Sun, 16 Oct 2016 17:05:09 -0400 Original-Received: from [18.189.6.80] ([18.189.6.80]) by mrelayeu.kundenserver.de (mreue003) with ESMTPSA (Nemesis) id 0MaoDm-1cF38A029K-00KODJ for ; Sun, 16 Oct 2016 23:05:08 +0200 In-Reply-To: X-Provags-ID: V03:K0:zS8fqs2T2VqDxL2Kl5WTQGCwNP3GslXX5QiokelbENfTGfyAzJ8 nnQ8wOoOLB/+lGMSkTxzDowi/KJDaMQzPGZEpW3qTTyxXsKGqouE3bs/MP/N1zT+zUxPVGQ b0HEL0wAJeJM3jAQ080W2GxmRUehyTldelQyCIyZFyBH+5KgsbxPTYiTSPe2P+AqpbwEKZS Kr8+e7sjifaLaguWyGtjw== X-UI-Out-Filterresults: notjunk:1;V01:K0:Knfq/cQr3tE=:1UkPgmQmo6b+xg0d6qGGT3 0xihERSii7Muu4Klol563Y3dBeGiU+h4A5JasHECnRbQt9Wt3XK1FtaekGSxukuxF9jQjXA8H 9bROGN2KyXcCU9g3MTfufnvulgKkdYZa5qzgMrJCW7uBGsEo12pe+Tgk4o9M0D/Kro/6DElST IJIs4dXKfYAtLDaTC4JeWtWK36QoDnC34gvdnAZUMuu/qrAeEbS+f7HAnzPabcMeP8TzeR7+s 7XqsVJtSFb+VZ48gVVJB2HOoQBShPL5j07LkP+JnelKBb2b5tATMJZPKe2IA+Aw3oSqZUCbhZ hkJYlFSseukNdeanxu+EoGBwAXB82eQ20mB3XHT3xuGalbHIagfwplnHzGrVINaySfTaTXcNP NqHTeDU2KHDmbgN1JTJeF1/KXWzsaDyR8yIhkdFiVGKe0MYu2nayOAmezBlGIkTIGe75+yTdh hfI2SzcdLq644q+rh+e+/vBmXPKbaHP93nccJbyxkNhV3Gss0yTK3Rtwh35RRxCvxKe5D5ak4 /s4A4AW3O1AWvkP/mx2PLVoGLdM1EjreuoIopu3zE5O8OtWIsbyVVPrCY95n3J9gSxclmn373 6zfdcHsjqBT6NFNRfyvbVAdeDct3iVDMWnfcXqq/NJdH326C06SEPYbQJ0u8cQ/IstDQ0UwDX W4DmyFnRPELJdiMPIUWe4weJRUSmCSp9pzSfdNBiATsnfPfb+6iVfUcH8Qz/clrQDkLA= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.135 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:208341 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hhIgCjdSIQJqf9KMKFT1Ogs5Xqm91QV28 Content-Type: multipart/mixed; boundary="2Tp1qSf0ExUag5E2SIFsbMRk8n80tXwLF"; protected-headers="v1" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: emacs-devel@gnu.org Message-ID: <0a7df382-4edf-3a27-a102-bfc61e5b6aae@gmail.com> Subject: Re: Feature request/RFC: proper highlighting of code embedded in comments References: <930446db-6dad-72a0-d0cd-a0710e5c6ec3@mit.edu> In-Reply-To: --2Tp1qSf0ExUag5E2SIFsbMRk8n80tXwLF Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Thanks! How is the package called? I don't see it list-packages :/ This sounds pretty similar to the solution I outlined before, though. Th= e problem that I ran into with python is that I also need to "reopen" the= quotes or comments. For example. a bit of code might be in the middle o= f a docstring, like this: def example(): """Blah >>> blah(xyz) bluh! What a great example! """ The issue here is that =93What a great example=94 is a string. I tried u= sing a syntactic face function to mark the last =91>=92 as a strong close= r and the newline as a string opener, but that confused the existing func= tion, which expects the docstring starter to be =91"""=92, not =91\n=92. = Even after fixing this, python-mode was unusable: it inflooped when tryi= ng to find a whole defun, because the nav-end-of-defun function isn't rea= dy to accept =91\n=92 as a string starter. Cheers, Cl=E9ment. On 2016-10-16 13:42, Stefan Monnier wrote: > FWIW, in sm-c-mode.el (in elpa.git), CPP directives are treated as > comments, and since they do contain code, I have to solve the same kind= > of problem. >=20 > I (ab)use for that purpose a syntactic face function. The starting > point is: >=20 > (setq-local font-lock-syntactic-face-function #'sm-c-syntactic-face-f= unction) >=20 > Take a look at sm-c-syntactic-face-function and especially > sm-c--cpp-fontify-syntactically to see how I try to re-use the existing= > font-lock functionality. >=20 > It's a bit gross, tho. >=20 >=20 > Stefan >=20 >=20 >=20 --2Tp1qSf0ExUag5E2SIFsbMRk8n80tXwLF-- --hhIgCjdSIQJqf9KMKFT1Ogs5Xqm91QV28 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYA+t9AAoJEPqg+cTm90wjdU0P/0rGdBjxJo5ASakjezYD+kfv 3nRRRdYNuU7wYpft0sPXRB5DPen+v50YtVjigZnlChQ90Ah4zzmhGz028B8JYVez b/xd1dwOd0z9vmN1/FPceNaavB7ea5ZS9tuZ/euq7iZXw6qgXYBUOO/nJDxSYsyj Jznseor0c9r0dG2d64PYfRaES4rztIGxMkAa+tynKqIwkgeQVHT9Khv1WuIPciXB NnXZiTUVzfD18uIA9Bf5vn0TaifUQ/YoS/qY8co3kwUAQsQjOwbrLxZpolNEQfip j4EaKZ1bjSXE+giXV+0R5Ij7Nzl7JYum6M5GhFbu2B5tjm0iAL1lDfkcS8btZCxD 6gxrhqOdELQxebuf6R3Ilvtr/jTn8EoeQH/RUPRhJz20RFZZQJ8sdQsKeKwZ/WYt zfZj8ud9YB+j3ftzLZ+IdQDu8TEckPPWNtjhLlboIN7UXWKYPmArOUCvXQrNk31S 02fim9HaSCSb5d7+nD1YyUZcEnv3ajfApXTLpOMbg84bSfEB6QXklEskCRq8Pzbe jju8ope9/r7mHMpYWcRkV59bfl5gcu9b/R8FfBE0FB7hAEr3pClta2xcVtw9e8pH 4wU2K2/97JQK6PNnoTGsAKT9lzKDV+H56kaQkYpfn9KQzhMKMolYuRIvadImIhUr y8vKWbUK/4iBWujuBIiu =zjww -----END PGP SIGNATURE----- --hhIgCjdSIQJqf9KMKFT1Ogs5Xqm91QV28--