Subject: Re: bug#8509: 24.0.50; cperl-mode with which-function-mode breaks font-locking

From: Stefan Kangas <[email-masked]>
Date: Fri, 5 Jul 2019 21:55:19 +0200

Frank Terbeck <[email-masked]> writes:

> This is my first bug report for emacs, so bear with me:
>
> I'm encountering odd behaviour when using `which-function-mode' with
> `cperl-mode' in emacs version 24. It's a build of trunk's 103902
> revision.
>
>
> Consider these two files:
>
> foo.el:
>
> [snip]
> (mapc
>   (lambda (pair)
>     (if (eq (cdr pair) 'perl-mode)
>       (setcdr pair 'cperl-mode)))
>   (append auto-mode-alist interpreter-mode-alist))
>
> (which-function-mode t)
> [snap]
>
> And foo.pl:
>
> [snip]
> $foo = qq{I'm just another Perl Hacker.};
> [snap]
>
> Then I would start emacs like this:
>
> % emacs -nw -Q
>
> ...and then:
>
> M-x load-file RET foo.el RET
> C-x C-f foo.pl RET
>
> Now font locking is screwed up. The "qq" is highlighted as
> `cperl-nonoverridable-face', which is correct. But "{I" shows up in
> `default'. Which is wrong. Now, the ' looks like the start of a string
> and it's highlighted as `font-lock-string-face'. But because the "q{"
> isn't the start of the string but the single quote, the closing "}"
> doesn't end the string and so the ";" (and in fact, any following lines
> would be too, until another single quote would be encountered) is
> highlighted in `font-lock-string-face', as well.
>
> When I'm removing the "(which-function-mode t)" line from "foo.el", the
> problem goes away.

Hi,

I can't reproduce this on Emacs 26.2, the latest version of Emacs.

Since the bug was reported 8 years ago, I will assume that this bug has
been fixed while you were waiting for a reply.  I am therefore closing
this bug.

If you can still reproduce this issue on the latest version of Emacs,
please report back and we can re-open the issue.

Thanks,
Stefan Kangas