* 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-01 16:13 perl indentation Jagadeesh
@ 2008-12-01 19:11 ` aartist
2008-12-02 4:53 ` Jagadeesh
0 siblings, 1 reply; 8+ messages in thread
From: aartist @ 2008-12-01 19:11 UTC (permalink / raw)
To: help-gnu-emacs
On Dec 1, 11:13 am, Jagadeesh <mnjagade...@gmail.com> wrote:
> Hi,
> Again this is a newbie question.
>
> how do I indent perl code? Is there any key?
>
> Thanks
> Jagadeesh
M-x cperl-mode
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: perl indentation
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
0 siblings, 2 replies; 8+ messages in thread
From: Jagadeesh @ 2008-12-02 4:53 UTC (permalink / raw)
To: help-gnu-emacs
On Dec 2, 12:11 am, aartist <aart...@gmail.com> wrote:
> On Dec 1, 11:13 am, Jagadeesh <mnjagade...@gmail.com> wrote:
>
> > Hi,
> > Again this is a newbie question.
>
> > how do I indent perl code? Is there any key?
>
> > Thanks
> > Jagadeesh
>
> M-x cperl-mode
Thanks for the reply.
Its not indenting it. when I do M-x cperl-mode, there is no effect.
Thanks
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: perl indentation
2008-12-02 4:53 ` Jagadeesh
@ 2008-12-02 14:44 ` Ted Zlatanov
2008-12-02 15:32 ` Phil Carmody
1 sibling, 0 replies; 8+ messages in thread
From: Ted Zlatanov @ 2008-12-02 14:44 UTC (permalink / raw)
To: help-gnu-emacs
On Mon, 1 Dec 2008 20:53:45 -0800 (PST) Jagadeesh <mnjagadeesh@gmail.com> wrote:
J> On Dec 2, 12:11 am, aartist <aart...@gmail.com> wrote:
>> On Dec 1, 11:13 am, Jagadeesh <mnjagade...@gmail.com> wrote:
>>
>> > Hi,
>> > Again this is a newbie question.
>>
>> > how do I indent perl code? Is there any key?
>>
>> > Thanks
>> > Jagadeesh
>>
>> M-x cperl-mode
J> Thanks for the reply.
J> Its not indenting it. when I do M-x cperl-mode, there is no effect.
Start Emacs without any init files:
emacs -q test.pl
Then do
M-x cperl-mode
Type in a short program, e.g.
#!/usr/bin/perl
if (scalar @ARGV)
{
print "indentation test here\n";
}
Does line 5 not indent when you hit TAB? It does for me.
Ted
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: perl indentation
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
1 sibling, 1 reply; 8+ messages in thread
From: Phil Carmody @ 2008-12-02 15:32 UTC (permalink / raw)
To: help-gnu-emacs
Jagadeesh <mnjagadeesh@gmail.com> writes:
> On Dec 2, 12:11 am, aartist <aart...@gmail.com> wrote:
>> On Dec 1, 11:13 am, Jagadeesh <mnjagade...@gmail.com> wrote:
>>
>> > Hi,
>> > Again this is a newbie question.
>>
>> > how do I indent perl code? Is there any key?
>>
>> > Thanks
>> > Jagadeesh
>>
>> M-x cperl-mode
>
> Thanks for the reply.
> Its not indenting it. when I do M-x cperl-mode, there is no effect.
It's not designed to automatically re-indent the current file.
Any new code you enter will be indented according to style,
as well any line you press 'TAB' on. To set the particular
style, use cperl-set-style - my personal favourite is 'C++',
even though it has problems with multi-line lists.
There's also 'perl-mode', which again will not automatically
re-intent any of your buffer. It's a bit less colourful, but
just as functional as 'cperl-mode'.
Phil
--
I tried the Vista speech recognition by running the tutorial. I was
amazed, it was awesome, recognised every word I said. Then I said the
wrong word ... and it typed the right one. It was actually just
detecting a sound and printing the expected word! -- pbhj on /.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: perl indentation
2008-12-02 15:32 ` Phil Carmody
@ 2008-12-06 4:45 ` Jagadeesh
2008-12-06 7:14 ` Teemu Likonen
0 siblings, 1 reply; 8+ messages in thread
From: Jagadeesh @ 2008-12-06 4:45 UTC (permalink / raw)
To: help-gnu-emacs
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.
Thanks
Jagadeesh
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: perl indentation
2008-12-06 4:45 ` Jagadeesh
@ 2008-12-06 7:14 ` Teemu Likonen
0 siblings, 0 replies; 8+ messages in thread
From: Teemu Likonen @ 2008-12-06 7:14 UTC (permalink / raw)
To: help-gnu-emacs
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
* 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).