in reply to Re^6: IDE for Perl programming? ( *cperl-mode* bug)
in thread IDE for Perl programming?

Well, there is a bug in CPerl mode. It is a bit evasive and not that easy to trigger. choroba has filed a bug report and there's a patch which you should be able to use at least in Emacs 27.1. It also contains a test case with a sequence of commands which triggers the bug in Emacs 26.1 to Emacs 28.

I am well aware of the deprecation of cperl-under-as-char and provided it only as a possible workaround. By the way: There be dragons. Superword mode treats all symbol characters as word characters, and in CPerl mode the colon : is also a symbol character.

In general, the fontification of CPerl mode should not depend on the setting of this variable nor on the setting of superword mode, and in most (but not all, as we see here) cases the underscore is explicitly included when parsing Perl identifiers.

  • Comment on Re^7: IDE for Perl programming? ( *cperl-mode* bug)

Replies are listed 'Best First'.
Re^8: IDE for Perl programming? ( *cperl-mode* bug)
by LanX (Saint) on Mar 15, 2021 at 22:42 UTC
    Hi

    You are right! Now that I was able to automate the testing I'm seeing clearer.

    The bug is not present with emacs-24 -q but with emacs-27 -q

    For the unwary, -q means that I don't load my personal config so that I can test vanilla emacs and not my own fixes, patches and cperl-modes.

    What I forgot tho was explicitly switching to Ilya's cperl-mode, gnu-emacs is favorizing it's own perl-mode, which is much simpler and probably doesn't even try to handle y

    Now running this (windows version)

    c:\nonBKU\emacs-27.1-i686\bin>runemacs.exe -Q D:\tmp\pm\tst.pl -eval " +(progn (cperl-mode)(goto-line 4)(newline))" c:\nonBKU\emacs-27.1-i686\bin>

    will show the bug and an error message

    End of ‘y_ ... _’ string/RE not found: (scan-error Unbalanced parentheses 49 80)

    That's the content of tst.pl:

    #!/usr/bin/perl use strict; use warnings; sub y_max { 1 } print "Done";

    Automated tests are cool! xD

    update

    > there's a patch which you should be able to use at least in Emacs 27.1.

    it worked in 24.3 so something must have introduced the bug later.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      it worked in 24.3 so something must have introduced the bug later.

      Probably caused by changes in Emacs defaults (electric-indent-mode would be a candidate), since CPerl mode was rather untouched during that period.

      Anyway, the patch for the bug report makes the problem go away in Emacs 26.1 to 28.1.