all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Perl Indentation
@ 2003-08-07 18:44 Aaron Lenfestey
  0 siblings, 0 replies; 9+ messages in thread
From: Aaron Lenfestey @ 2003-08-07 18:44 UTC (permalink / raw)


This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.3.2 (i386-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2003-04-24 on raven, modified by Debian
configured using `configure  i386-linux --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --with-x=yes --with-x-toolkit=athena --without-gif'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

Emacs is not correctly indenting my perl.  As in the example, it too much 
indents a line following a statement including '::'. 

{
    mylib::perlfunc();
      mylib::perlfunc();
}

A minor change causes correct behavior:

{
    mylibperlfunc();
    mylib::perlfunc();
}

Also, note that correct behavior is exhibited without the enclosing {}.

Recent input:
SPC <tab> <tab> <down> <tab> <tab> <down> <tab> <tab> 
<down> <tab> <down-mouse-1> <mouse-movement> <mouse-1> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<down-mouse-1> <mouse-1> <backspace> <backspace> <backspace> 
<backspace> <backspace> <down-mouse-1> <mouse-1> <down> 
; <up> <right> <right> ; <down> <tab> <tab> <tab> <backspace> 
<tab> <tab> <tab> <up> <right> <right> <down> <tab> 
<tab> <up> <right> <right> <right> <right> <backspace> 
<down> <tab> <tab> <up> <tab> <tab> <down> <tab> <tab> 
<down> <tab> <down> <tab> <down> <tab> <down-mouse-1> 
<mouse-1> M-x r e p o r t - b u g <return> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> r e 
p <tab> <help-echo> <down-mouse-2> <mouse-2>

Recent messages:
Loading font-lock...done
Loading mwheel...done
For information about the GNU Project and its goals, type C-h C-p.
service_export.pl has auto save data; consider M-x recover-file
Loading perl-mode...done
Auto-saving...done
Auto-saving...done
Making completion list...
Loading view...done
Loading emacsbug...done

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

* perl indentation
@ 2008-12-01 16:13 Jagadeesh
  2008-12-01 19:11 ` aartist
  0 siblings, 1 reply; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ messages in thread

* Re: perl indentation
  2008-12-06  4:45       ` Jagadeesh
@ 2008-12-06  7:14         ` Teemu Likonen
  0 siblings, 0 replies; 9+ 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] 9+ messages in thread

* RE: perl indentation
@ 2008-12-08  9:35 Bourgneuf Francois
  0 siblings, 0 replies; 9+ 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] 9+ messages in thread

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

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-07 18:44 Perl Indentation Aaron Lenfestey
  -- strict thread matches above, loose matches on Subject: below --
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
2008-12-08  9:35 Bourgneuf Francois

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.