Open CeleritasCelery opened 7 years ago
And is there a fix for stock Emacs you could prepare as pull request here?
I do not have a fix. There is bug open on Emacs proper, but it has not gathered any attention
The bug has now drawn attention but it is unlikely that it can be fixed in Emacs.
The root cause is the use of the insert
function here: Use insert-and-inherit
and everything works as expected.
Background: cperl-mode uses text properties to decide about the HEREiness of buffer contents. If you enter text using your keyboard, then text properties will be propagated from its surroundings. However, insert
just inserts the raw text without any properties which confuses cperl-mode. insert-and-inherit
, on the other hand, will apply the text properties from the surroundings to the text it inserts.
If you can't directly modify the call to insert
: The command cperl-find-pods-heres
, also available from the menu under
Perl -> Refresh "hard" constructions, re-calculates the text properties and recovers from the situation.
When inside a cperl HERE doc, using any function that inserts a newline at the start of a line will causes the rest of the file to highlighted with
font-lock-comment-face
. The only way to fix this is to make changes to the correctly highlighted part of the HERE doc which causes it to re-parse. My guess is that cperl is getting mixed up with POD highlighting and trying to applycperl-pod-face
since POD's and HERE documents are very closely related incperl-mode
code.To reproduce: have a
cperl-mode
file that looks like suchYou will see that the rest of the file is highlighted with the comment face. Calling any function that finds the HERE doc region will be incorrect (e.g.
cperl-narrow-to-here-doc
). I have already confirmed that this bug exists in stock Emacs 25.1 as well.