Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
I am afraid not. emacs shines and sucks in the same way perl5 does. Does the job. Too old, too much history.

But it is not so daunting. Here is a quick 101 to use emacs for debugging and light editing.

Until recently, I think that emacs did not include the last version of cperl. This resulted in haphazard hightlighting. Once a perl file is loaded, one can check the cperl version by typing C-h v cperl-version. It must be the same that the most recent file in http://www.cpan.org/modules/by-module/CPAN/ILYAZ/cperl-mode. Currently it is 7.32. If one is root he can adds it to his site specific directory A common place is /usr/share/emacs/site-lisp. Other wise he can add it to a personal elisp directory and he will load it by adding (load-file "elisp/cperl.el") in in .emacs file

Perl debugging is part of the grand unified debugger scheme gud.el written by the inevitable esr. This is used to debug with gdb too. In my system the file is at /usr/share/emacs/21.3/lisp/gud.el where one can find the perl specific stuff by grepping "perldb".

You run a session with the command

  M-x perldb RET your_filename
You get two buffers in your frame. One is the file currently debugged. The other is the debugging session where you get to use all the commands described in the perldebug pod file. So that's known territory.

You can also interact directly in the perl file buffer thanks to gud-minor-mode. A minor mode adds functionalities to the major mode by adding key-bindings.

You can get all the bindings of the said buffer using C-h C-b. I paste the binding concerning the gud minor mode. Using the minor binding of the perl file avoid to clutter the debug window by explicit commands.

C-x SPC		gud-break
C-x C-a C-p	gud-print
C-x C-a C-r	gud-cont
C-x C-a C-n	gud-next
C-x C-a C-s	gud-step
C-x C-a C-d	gud-remove
C-x C-a C-b	gud-break
C-x C-a C-l	gud-refresh
One can scroll a buffer using the mouse.

Here is a list of minimal keybindings for people that want to use emacs for debbugging and minor edition while wanting to go mouseless.

C-x o   allows to cycle the caret thru all the buffers
C-x b   list all the buffer in the meacs session.
       In that buffer ENTER  selects a file

C-x w  write the current file
C-x q  toggle the read-only mode. Because so many binding do
       something it can be a good stopping gap.

^H i gets to the info files
Here is a chart for moving in progressively coarser granularity from the current position.
In the vertical axis : char, word, begin/end of line
In the horizontal axis : line, begin/end of subroutine
                          ^
                          |
                          C-M-a
                          |
                          C-p
C-a <--- M-b <-- C-b  <-- .  --> C-f --> M-f --> C-e
                          |
                          C-n
                          |
                          C-M-e
                          |
                          v
M-x woman is nicer the M-x man but slower to start :)
...because it compiles the list of man files to provide completion.

-- stefp


In reply to Re^3: Desparately seeking a bilingual vim/Emacs expert by stefp
in thread Desparately seeking a bilingual vim/Emacs expert by TheDamian

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (6)
    As of 2014-12-23 03:14 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (134 votes), past polls