Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Interactive Emacs/Perl environment

by educated_foo (Vicar)
on Mar 31, 2004 at 04:11 UTC ( [id://341193]=CUFP: print w/replies, xml ) Need Help??

I've come to seriously enjoy Lisp development in Emacs, where with Slime mode you can get all sorts of information out of the inferior Lisp process. Perl has that information available through the B::* modules, but there's no Emacs bridge. Yet. I have hacked together some Perl and Emacs lisp, and was looking for some feedback on it from Emacs users out there. The install isn't automatic, since my hacked version of B::Xref, "Devel::Xref", isn't on CPAN, but it seems to work okay, and it seems useful. Give it a try.

(Update: fix two embarassing bugs.)

Update 2: Code removed. Please see sepia for the current version.

Replies are listed 'Best First'.
Re: Interactive Emacs/Perl environment
by eserte (Deacon) on Mar 31, 2004 at 09:40 UTC
    Unfortunately this does not work for me. I installed the required modules, than started emacs with
    emacs -q -L ~/emacs
    (where ~/emacs is the directory containing the Emacs::EPL lisp and your files). After doing pscope-init, emacs hangs. My environment is: RedHat 8.0, perl 5.8.0 (unthreaded), GNU Emacs 21.2.1.
      Hm... To be honest, I've only tested this on Emacs CVS on Mac OS 10.2. Can you:
      (load-library "epl") (load-library "perl") (setq epl-debugging t)
      then "perl-eval-expression"? If not, then it's a problem with EPL, and unfortunately, its code quite complex (state machine, cookie system for garbage collection, etc) and I'm not familiar with it. If you can send me the dump, I'll try to figure out what's going on, but no guarantees.
        (load-library "epl") (load-library "perl") (setq epl-debugging t) (perl-eval-expression "2+2")
        returns the following output (these are the relevant lines, I think):
        Debugger entered--Lisp error: (wrong-type-argument sequencep t) signal(wrong-type-argument (sequencep t)) (condition-case err (epl-loop) (error (epl-destroy) (signal ... ...) +)) (let* ((process-connection-type nil) (out ...) (epl-interp ...)) (co +ndition-case err (epl-loop) (error ... ...)) (epl-interp-set-status ( +quote ready)) epl-interp) perl-interpreter-new() (setq perl-interpreter (perl-interpreter-new)) (if perl-interpreter (epl-check) (setq perl-interpreter (perl-interp +reter-new))) epl-init() (epl-eval (epl-init) nil context "do { package main; " string " }") perl-eval("2+2" scalar-context)
Re: Interactive Emacs/Perl environment
by Vautrin (Hermit) on Mar 31, 2004 at 16:48 UTC

    I think what you've done is very cool, however I always created a Perl scratch pad by doing:

    C-x b *perl-scratch* RET M-x cperl-mode RET

    And, to evaluate it from inside the buffer *perl-scratch*:

    C-h M-| perl RET

    By the way, can you put some <readmore> tags around your code?


    Want to support the EFF and FSF by buying cool stuff? Click here.
      Yeah, your way of evaluating probably works fine. On the other hand, I can do things like this:
      use Inline C => 'int square(int x) { return x * x; }'; \C-j square(square(23)); \C-j
      and both statements will be sent to the same Perl. I guess that makes it "more interactive" or something. The real gain is, in theory, in the cross-referencing.

      Thanks for pointing out the "readmore" -- I didn't realize that you needed to close the tag before it took effect.

Brilliant
by nmcfarl (Pilgrim) on Mar 31, 2004 at 20:09 UTC
    Works brilliantly. A nice addition to my programming environment. Now it needs to go on CPAN.
      Coming soon to a CPAN mirror near you, as "SEANO/pscope-03-31.tgz". It's too "batteries not included" to be a real distribution yet, but it's there.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://341193]
Approved by kvale
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 07:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found