http://qs321.pair.com?node_id=11118830


in reply to Re: Breathing life into the (Emacs) cperl-mode
in thread Breathing life into the (Emacs) cperl-mode

Thanks for the feedback! To wit: ERT is Emacs Lisp Regression Testing.

With regard to integrating with Perl, a connection to modules like PPI or even Code::ART would be interesting. To quote THeDamian: How hard can that be? But then, I'm not Damian, he's doing his sourcery in Vimscript, so don't hold your breath.

  • Comment on Re^2: Breathing life into the (Emacs) cperl-mode

Replies are listed 'Best First'.
Re^3: Breathing life into the (Emacs) cperl-mode
by choroba (Cardinal) on Jul 02, 2020 at 16:47 UTC
    > it isn't that easy to query the fontification of a particular character in an Emacs buffer from Perl

    Just use htmlize and your favourite Perl HTML parser ;-)

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      Thanks, but I pass :) For our notorious snippet $a++ / $b; # /; htmlize provides:

      $a++ <span class="constant">/</span> <span class="string"> </span> <span class="variable-name">$b</span> <span class="string">; # </span> <span class="constant">/</span>;

      That surely is a lot of noise. As you can see (you can, can't you?), this is the output from a broken cperl-mode.

      My preferred approach for large-scale fontification tests would be Lindydancer's faceup markup, which together with the other repositories by the same author are really awesome tools to debug and test font-lock features.

      Advertisement: As a recent addition, I added Damian Conway's "Perl Best Practice" recommendations for indenting code to M-x cperl-indent-style. I guess that amongst Perlers PBP is waaay more popular than K&R, BSD, or GNU conventions.

        But after your fix, it gives a bit more sense:
        <span class="variable-name">$a</span>++ / <span class="variable-name"> +$b</span>; <span class="comment-delimiter"># </span><span class="comm +ent">/; </span>
        map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re^3: Breathing life into the (Emacs) cperl-mode
by LanX (Saint) on Jul 03, 2020 at 10:02 UTC
    Hi

    • division: the final .el should be a single one, sure. I was thinking of a build and testing process triggered from a Perl script joining different parts. Testing with different emacs versions° is not easy and you'll find more contributors providing Perl tests.
    • docs: sorry, you misunderstood me, cperl has a long list of one liner description for each Perl command. IMHO these should be outsourced.
    • info: What you mean is the hypertext help system which relies on static perldocs in "info" format. Info is great for navigation of deep manuals, perldocs are rather flat and should be IMHO better displayed with "woman.el" (man doesn't work on windows).
    • if you drop support for older or other versions like XEmacs you should maybe consider renaming the fork of cperl-mode

    On a different note: elisp regexing is a PITA because of slasheritis and pretty unreadable. (Btw: XEmacs solved this with raw strings)

    I was thinking of translating Perl regex to lisp to open up for a broader audience.

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

    °) and Perl versions and extensions

      About Perl documentation...
      ...perldocs are rather flat and should be IMHO better displayed with "woman.el" (man doesn't work on windows).

      Update: I've just pushed a cperl-mode where M-x cperl-perldoc just works on Windows. I didn't find woman.el particularly rewarding, though, and I took a different route. On the plus side, hyperlinks in POD files now work, and are resolved in your local installation (unless they are https links). Many perldoc pages are flat, but others like the Moose::Cookbook make more fun when links work.

      Other documentation functions of cperl-mode will also be made available on Windows, as my time permits.

      The code is at cperl-mode.el on GitHub, there's also a List of changes.

      I've also completed the FSF paperwork, so there are chances that some changes will make their way into the official Emacs distribution.

      Sorry, I'm afraid that I'm going to disappoint you...

      • division: I fail to see how a division helps with either testing with different emacs versions or finding contributors providing Perl tests. I do see, however, some overhead to set up that process and document how to use it. So that's still pretty low on my priority list.
      • Outsourcing docs: That is another job for Shouldbedone-Man. I don't see enough benefit right now.
      • info format: Having convenient access to perldocs documentation from within Emacs is a valid requirement. The requirement is not exactly new, but the tool suggested in the answer to Sean's article seems to have rotted away. So it's either getting pod2info or pod2texi back to life, or ... but wait... It seems that you already have a solution. Care to share?
      • The decision to drop support for older and other versions hasn't be done by me, but by the Emacs maintainers, before I started to hack on cperl-mode. I've only removed some conditionals where cperl-mode worked around XEmacs quirks, or provided workarounds for old Emacs versions. I intend my work to be a drop-in replacement for the cperl-mode which comes with Emacs - or maybe even become the maintainer of cperl-mode, a position which has been vacant for quite some time now. So, no, renaming is not an option.
      I was thinking of translating Perl regex to lisp to open up for a broader audience.

      Excellent! Please go ahead!

        > Sorry, I'm afraid that I'm going to disappoint you...

        You are not disappointing me at all, you asked for opinions I shared mine in the hope they might be helpful. :)

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

      Another update:
      perldocs are rather flat and should be IMHO better displayed with "woman.el" (man doesn't work on windows).

      As it turns out, this is already available. Not from Emacs nor ELPA/MELPA, but there's Emacs::PDE on CPAN. This distribution provides, among other tools, M-x perldoc which is using WoMan and works quite fine on Windows. Even better, there's a command M-x perldoc-tree which offers all local docs in a nice tree view.

      This, of course, makes a refurbishment of the perldoc stuff in cperl-mode a lot less interesting.

        Yeah I saw this already, problem is PDE is mostly abandoned, and many things don't work anymore.

        There are also other projects/bundles

        That's why I'd rather prefer decomposing features into modules which can be maintained independently...

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