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]
| [reply] [d/l] |
|
|
$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. | [reply] [d/l] |
|
|
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]
| [reply] [d/l] [select] |
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.
°) and Perl versions and extensions | [reply] |
|
|
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.
| [reply] |
|
|
| [reply] |
|
|
| [reply] |
|
|
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.
| [reply] |
|
|
| [reply] |
|
|
|
|