help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: perl indentation


From: Bourgneuf Francois
Subject: RE: perl indentation
Date: Mon, 8 Dec 2008 10:35:10 +0100

You may use perltidy.

I have inserted the following code in my .emacs, then C-c t will do the job on 
any marked region.
If you use activeperl, perltidy will be located in 
"Perl_Directory"/site/bin/perltidy
Regards 
Bour9

;; PerlTidy
(defmacro mark-active ()
    "Xemacs/emacs compatibility macro"
    (if (boundp 'mark-active)
        'mark-active
      '(mark)))
(defun perltidy ( )
  "Run perltidy on the current region or buffer."
  (interactive)
  (let ((orig-point (point)))
    (unless (mark-active) (mark-defun))
    (shell-command-on-region (point) (mark) "perltidy -q -ci=2 -bli -l=0 -lp 
-vt=1 -vtc=1 -nsfs -ndln" nil t)
    (goto-char orig-point)))
(global-set-key "\C-ct" 'perltidy) 




> -----Message d'origine-----
> De : 
> address@hidden
> g 
> [mailto:help-gnu-emacs-bounces+francois.bourgneuf=groupe-mma.f
> address@hidden De la part de Teemu Likonen
> Envoyé : samedi 6 décembre 2008 08:14
> À : address@hidden
> Objet : Re: perl indentation
> 
> Jagadeesh (2008-12-05 20:45 -0800) wrote:
> 
> > Yes. TAB Does the magic. But when you are writing tons of line, you
> > can not press tons of TABs. So is there any block indentation
> > technique? VIM has this feature.
> 
> For any region you can use C-M-\ (indent-region) or you can 
> also use C-j
> (newline-and-indent) instead of Enter (newline) when writing the code.
> 
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]