Re: Favorite Hacks in Emacs
by Joost (Canon) on May 12, 2009 at 20:22 UTC
|
Couple of things from the top of my head:
M-x rgrep recursive grep. Very useful for coding in general.
M-x compile also works for perl programs, with error file/line navigation, like rgrep.
Sepia is pretty cool.
Version control: psvn (M-x svn-status) is good for SVN. GIT's own git.el is OK, but there might be something better.
| [reply] [Watch: Dir/Any] [d/l] [select] |
Re: Favorite Hacks in Emacs
by artist (Parson) on May 13, 2009 at 02:23 UTC
|
| [reply] [Watch: Dir/Any] [d/l] |
Re: Favorite Hacks in Emacs
by Porculus (Hermit) on May 13, 2009 at 07:09 UTC
|
shell-command-on-region. With a prefix argument it replaces the region with the shell command's output. Great way to run Perl one-liners on whatever you're editing!
Also, align-regexp. Ideal for picky types who want a bunch of assignments to line up on the =. ;)
| [reply] [Watch: Dir/Any] [d/l] [select] |
|
| [reply] [Watch: Dir/Any] [d/l] |
Re: Favorite Hacks in Emacs
by Your Mother (Archbishop) on May 13, 2009 at 05:39 UTC
|
(global-set-key "\M-3" 'script-blank)
(global-set-key "\M-4" 'subroutine-blank)
(define-skeleton script-blank
"Insert a blank script."
nil
"#!/usr/bin/perl
\n
use strict;
use warnings;
# et cetera... Looooooong list of modules which
# are easier to cut when unused than type otherwise.
\n
_
\n
\n
"exit 0;
__DATA__
"
)
;;--------------------------------------------------------------------
(define-skeleton subroutine-blank
"Insert a blank sub."
nil
"sub " _ " {"
\n
\n
\n
\n
"}"
)
| [reply] [Watch: Dir/Any] [d/l] |
Re: Favorite Hacks in Emacs
by shem (Initiate) on May 13, 2009 at 11:37 UTC
|
(defun cw_save_check ()
"Run the Perl syntax checker on this buffer after saving."
(cond
((equal mode-name "CPerl")
(progn
(save-current-buffer
(set-buffer (get-buffer-create "*Perl cw output*"))
(erase-buffer))
(call-process-region (point-min) (point-max) "/usr/bin/perl" nil
+ "*Perl cw output*" n
il "-c -I.")
(save-current-buffer
(set-buffer "*Perl cw output*")
(cond
((equal (buffer-string) "- syntax OK\n") (message "%s" "Synta
+x OK"))
(t (message "%s" "The program has errors."))))))
(t nil)))
(add-hook 'after-save-hook 'cw_save_check)
| [reply] [Watch: Dir/Any] [d/l] |
Re: Favorite Hacks in Emacs
by juster (Friar) on May 13, 2009 at 04:58 UTC
|
I use C-c C-h p aka M-x cperl-perldoc to lookup module and builtin docs but maybe I should try Sepia!
I just recently started using 'Emacs Got Git' (egg) and it's pretty cool. | [reply] [Watch: Dir/Any] [d/l] [select] |
Re: Favorite Hacks in Emacs
by monarch (Priest) on May 13, 2009 at 14:32 UTC
|
<Ctrl>-x, <enter>, f
Changes encoding of a file (useful when converting to/from DOS/Unix line formats).
e.g. I might be on a Unix system and I need to create a MS-DOS compatible text file, I type <ctrl>-x, <enter>, f and type "undecided-DOS".
Or I might be on a Win32 machine and want to save a file in unix format for transfer to a remote system as a shell script. <ctrl>-x, <enter>, f and type "undecided-unix".
| [reply] [Watch: Dir/Any] |
Re: Favorite Hacks in Emacs
by jplindstrom (Monsignor) on May 13, 2009 at 14:25 UTC
|
Libs
- org-mode
- ediff-buffers / ediff-regions-linewise (bet you didn't know about the last one)
- SVN integration, with ediff (awesome)
- Keyboard macros
- PerlySense <-- on top of cperl-mode
- project-root
- sql-mysql - buffer
- yasnippet
Snippets:
;; Display trailing whitespace (use a very very light color)
(defun my-turn-on-show-trailing-whitespace ()
"Set `show-trailing-whitespace' to t."
(setq show-trailing-whitespace t))
(mapc (lambda (hook)
(add-hook hook 'my-turn-on-show-trailing-whitespace))
'(cperl-mode-hook))
| [reply] [Watch: Dir/Any] [d/l] |
Re: Favorite Hacks in Emacs
by morgon (Priest) on May 13, 2009 at 14:55 UTC
|
Don't listen to these people.
They follow a dangerous cult.
I'll post "favourite hacks in vim" soon :-) | [reply] [Watch: Dir/Any] |
|
:)
Perl and Emacs are very similar - kitchen sink philosophy.
VI falls in line with Unix toolbox philosophy.
RDBMSes are a similar software prison to Perl and Emacs.
Never forget: the car is in the cdr, not the cdr in the car
| [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
Re: Favorite Hacks in Emacs
by Nkuvu (Priest) on May 13, 2009 at 18:47 UTC
|
I've seen this in a few places, so you are probably already aware of it:
;;run the current perl program
(defun run-perl ()
(interactive "*")
(setq perl-buffer-name buffer-file-name)
(shell)
(setq perl-run-command "perl ")
(insert perl-run-command)
(insert perl-buffer-name)
)
(global-set-key [f7] 'run-perl)
But I have to say that I don't do many perl-specific things from within emacs. I'd rather jump over to a command window instead (somehow the green letters on black background mean "shell" to me a lot more than an emacs window, and black text on a white background means "write code here"). | [reply] [Watch: Dir/Any] [d/l] |
Re: Favorite Hacks in Emacs
by LanX (Saint) on May 13, 2009 at 19:00 UTC
|
| [reply] [Watch: Dir/Any] |
Re: Favorite Hacks in Emacs
by skangas (Novice) on May 15, 2009 at 06:31 UTC
|
I'm sure you've heard about it already, but I like outline-minor-mode. Not at all essential, but still very nice to have sometimes.
CPerlModeOutlineMode at EmacsWiki.
| [reply] [Watch: Dir/Any] |
Re: Favorite Hacks in Emacs
by joojar (Initiate) on May 16, 2009 at 10:43 UTC
|
http://www.emacswiki.org/cgi-bin/emacs-en/PerlLanguage
http://nschum.de/src/emacs/ # highlight-parenthese, company-mode, window-numbering-mode
http://coderepos.org/share/browser/lang/elisp
# perl-completion
http://www.emacswiki.org/cgi-bin/wiki/Ye_Wenbin
# some stuff for Perl
http://www.emacswiki.org/emacs/CPerlAutoName # cperl-auto-name
modes: cperl-mode, flymake, flymake-extensions, yasnippet, org-mode,..
REPL: in Sepia and PDE we have REPL's, but nice REPL
is Stylish, but
need perl 5.10 and Devel::REPL from jrockway's repositary (or test with
Devel::REPL from CPAN, may be it already works), see screencast
;; To highlight a region between parenthesis
(setq show-paren-delay 0 show-paren-style 'expression)
(show-paren-mode 1)
(set-face-background 'show-paren-match-face "#efedd2")
Anyway emacswiki
and emacs planet -- our friends
| [reply] [Watch: Dir/Any] |
|
I found a better perl tool for emacs call Sepia and it have everything
| [reply] [Watch: Dir/Any] |