GNU bug report logs - #23461
perl mode uses same color for comments and here documents

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Thu, 5 May 2016 21:05:02 UTC

Severity: wishlist

Tags: fixed

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #19 received at 23461 <at> debbugs.gnu.org (full text, mbox):

From: haj <at> posteo.de (Harald Jörg)
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 23461 <at> debbugs.gnu.org
Subject: Re: bug#23461: perl-mode: Displaying HERE-docs as strings instead of
 comments [PATCH]
Date: Wed, 23 Dec 2020 15:37:51 +0100
[Message part 1 (text/plain, inline)]
Stefan Monnier writes:

>> Investigating how to fix this leads to the longer story.  There are two
>> possible approaches:
>>
>>   1) use a string-style syntax (generic string) instead of c-style
>>      comments to flag HERE-documents.  That way, font-lock picks up the
>>      correct face automagically.
>>
>>   2) Keep HERE_docs as c-style comments, but change the face mapping by
>>      injecting a function into font-lock-defaults which applies the
>>      string face to c-style comments.
>
> 3) Use `font-lock-syntactic-face-function`?

Ah - thanks for this pointer!  I wasn't aware of this function, though
this feature is already in use in perl-mode.el.

This looks like to be an improved variation of 2): HERE-docs remain
marked as c-style comments, and `font-lock-syntactic-face-function` is
used to display them as strings.

A patch for this variation is attached.  Tests and test resources are
the same as with the first patch, and this patch also contains the same
fix for HERE-doc starters with a trailing comment.
-- 
Cheers,
haj
[0001-perl-mode-Display-here-docs-as-strings-instead-of-co.patch (text/x-diff, attachment)]

This bug report was last modified 4 years and 196 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.