Stefan Monnier writes: >> I have some doubts here regarding the effort and the side effects.... > > No doubt. :) In the meantime I found that just ignoring the edge case of a lone "#" at the end of a line starting HERE-docs breaks indentation after the HERE-doc, so I no longer consider this as a valid option. I just failed to get all cases covered when the HERE-doc starter is moved to the next line. So here's another attempt to show HERE-docs with their own face, treat "normal" line-end comments correctly, and work around lines which end with the comment starter. It is a kludge, but maybe for such a rare edge case a kludge is acceptable. The trick: The lone "#" is now syntaxified as "whitespace" and font-lock-faced as comment. This is ugly, but also well-contained in the offending line, so should not have unwanted effects at a distance. The tests are designed for, and pass, for both Perl mode and CPerl mode. -- Cheers, haj