develooper Front page | perl.pod-people | Postings from November 2005

improving Pod viewing in emacs

Thread Next
Sean M. Burke
November 18, 2005 21:33
improving Pod viewing in emacs
Message ID:
Now that I am no longer responsible for actually implementing Pod 
thingies, I feel free (existentially!) to make sage pronouncements and 
saucy suggestions.  And here's one idea that recently occurred to me:

I'm a not-very-sophisticated Emacs user, so I beg a thousand 
cyberpardons if my understanding of the problem space is wonky.  But:
Last I looked at emacs's Perl support, the only way to browse Pod from 
within emacs was either just to run a shell command to perldoc, or to 
call the smarter function cperl-perldoc.  But cperl-perldoc (from 
cperl-mode.el, of course) simply passes off to calling pod2man (either 
directly or via perldoc and Man-getpage-in-background) with TERM set to 
"dumb".  Of course, this produces just plaintext, with no fontification 
and with no hyperlinking of the the L<...> things.  That makes me sad.

I figure there's two different ways that someone with better emacs 
skills that I could make this work:

* Have perldoc spit out the raw *roff code and then coax some part of 
woman.el into doing the formatting.  (woman.el parses and formats *roff 
code right in emacs, instead of having *roff do it.)

* Or completely avoid the whole detour thru nroff, and instead have 
perldoc use a different formatting class (via a -M switch) that would 
dumpthe parsed Pod as a big Lisp form.  This could be easily produced by 
copying the short and sweet Pod::Simple::XMLOutStream and tweaking it to 
spit out Lisp instead (freely scavanging from as_Lisp_form in 
HTML::Element).  Emacs could then just eval that Lisp form, and then 
accordingly produce a buffer with the text bits having appropriate 
formatting and also hyperlinks that work.

I figure an experienced elisp superstah could do either of these on some 
well-caffeinated afternoon.  If there are any within the sound of my 
voice: you know you want to do this!

Sean M. Burke

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About