|P is for Practical|
Re^3: Desparately seeking a bilingual vim/Emacs expertby stefp (Vicar)
|on Mar 26, 2005 at 21:29 UTC||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_filenameYou 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-refreshOne 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 filesHere 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 | vM-x woman is nicer the M-x man but slower to start :)
...because it compiles the list of man files to provide completion.