unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* perl indentation
@ 2008-12-01 16:13 Jagadeesh
  2008-12-01 19:11 ` aartist
  0 siblings, 1 reply; 8+ messages in thread
From: Jagadeesh @ 2008-12-01 16:13 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,
Again this is a newbie question.

how do I indent perl code? Is there any key?

Thanks
Jagadeesh


^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: perl indentation
@ 2008-12-08  9:35 Bourgneuf Francois
  0 siblings, 0 replies; 8+ messages in thread
From: Bourgneuf Francois @ 2008-12-08  9:35 UTC (permalink / raw)
  To: help-gnu-emacs

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 : 
> help-gnu-emacs-bounces+francois.bourgneuf=groupe-mma.fr@gnu.or
> g 
> [mailto:help-gnu-emacs-bounces+francois.bourgneuf=groupe-mma.f
> r@gnu.org] De la part de Teemu Likonen
> Envoyé : samedi 6 décembre 2008 08:14
> À : help-gnu-emacs@gnu.org
> 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.
> 
> 




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-12-08  9:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-01 16:13 perl indentation Jagadeesh
2008-12-01 19:11 ` aartist
2008-12-02  4:53   ` Jagadeesh
2008-12-02 14:44     ` Ted Zlatanov
2008-12-02 15:32     ` Phil Carmody
2008-12-06  4:45       ` Jagadeesh
2008-12-06  7:14         ` Teemu Likonen
  -- strict thread matches above, loose matches on Subject: below --
2008-12-08  9:35 Bourgneuf Francois

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).