[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23461: perl-mode: Displaying HERE-docs as strings instead of comment
From: |
Harald Jörg |
Subject: |
bug#23461: perl-mode: Displaying HERE-docs as strings instead of comments [PATCH] |
Date: |
Wed, 23 Dec 2020 15:37:51 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
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
Description: Display HERE-docs as strings
- bug#23461: perl-mode: Displaying HERE-docs as strings instead of comments [PATCH], Harald Jörg, 2020/12/22
- bug#23461: perl-mode: Displaying HERE-docs as strings instead of comments [PATCH], Stefan Monnier, 2020/12/22
- bug#23461: perl-mode: Displaying HERE-docs as strings instead of comments [PATCH],
Harald Jörg <=
- bug#23461: perl-mode: Displaying HERE-docs as strings instead of comments [PATCH], Stefan Monnier, 2020/12/23
- bug#23461: perl-mode: Displaying HERE-docs as strings instead of comments [PATCH], Harald Jörg, 2020/12/23
- bug#23461: perl-mode: Displaying HERE-docs as strings instead of comments [PATCH], Stefan Monnier, 2020/12/23
- bug#23461: perl-mode: Displaying HERE-docs as strings instead of comments [PATCH], Stefan Monnier, 2020/12/23
- bug#23461: perl-mode: Displaying HERE-docs as strings instead of comments [PATCH], Harald Jörg, 2020/12/24
- bug#23461: perl-mode: Displaying HERE-docs as strings instead of comments [PATCH], Stefan Monnier, 2020/12/24