unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Indentations, PERL
@ 2007-06-27  5:47 Александр Поляков
  2007-06-27  8:00 ` martin rudalics
  2007-06-27  8:06 ` martin rudalics
  0 siblings, 2 replies; 6+ messages in thread
From: Александр Поляков @ 2007-06-27  5:47 UTC (permalink / raw)
  To: bug-gnu-emacs

Hello,

I am a very basic user of Emacs, and I have never configured anything 
special about Emacs. So, in case what I am writing about will turn out 
to be just a problem with my default configuration files, I apologize.

What I think is the bug, is a problem with automatic indentations when I 
type PERL programs. Let me get right to the point and I'll paste first 
the code how it is automatically indented:

sub insert_sub {
    return unless (save_slide());
    my $after = 0;

    prompt(0, 'New Subtitle', "Would you like to " .
       "insert the new subtitle\n" .
       "before the current one or after?",
       [{GTK_ID => 'gtk-cancel',
         LABEL => 'Cancel',
         ALIGN => 'right',
         SUB => sub { $after = -1;}},
{GTK_ID => 'gtk-go-back',
 LABEL => 'Before',
 ALIGN => 'left',
 SUB => sub {$after = 0;}},
{GTK_ID => 'gtk-go-forward',
 LABEL => 'After',
 ALIGN => 'right',
 SUB => sub {$after = 1}},
    ]);

if ($after == 0) {
    insert_before($srt_idx);
} elsif ($after == 1) {
    insert_before($srt_idx + 1);
}
}


Next, is how I believe would be a proper way to indent the same code:

sub insert_sub {
    return unless (save_slide());
    my $after = 0;

    prompt(0, 'New Subtitle', "Would you like to " .
           "insert the new subtitle\n" .
           "before the current one or after?",
           [{GTK_ID => 'gtk-cancel',
             LABEL => 'Cancel',
             ALIGN => 'right',
             SUB => sub { $after = -1;}},
            {GTK_ID => 'gtk-go-back',
             LABEL => 'Before',
             ALIGN => 'left',
             SUB => sub {$after = 0;}},
            {GTK_ID => 'gtk-go-forward',
             LABEL => 'After',
             ALIGN => 'right',
             SUB => sub {$after = 1}},
           ]);

    if ($after == 0) {
        insert_before($srt_idx);
    } elsif ($after == 1) {
        insert_before($srt_idx + 1);
    }
}

(Somehow the exact spacing differ here, but I think you can see the 
difference in general.)

 Basically after I enter "{... SUB => sub {}}," the indentation screws 
up. I hope this makes sense.

Thanks,
Alex.

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

* Re: Indentations, PERL
  2007-06-27  5:47 Indentations, PERL Александр Поляков
@ 2007-06-27  8:00 ` martin rudalics
  2007-06-27  8:06 ` martin rudalics
  1 sibling, 0 replies; 6+ messages in thread
From: martin rudalics @ 2007-06-27  8:00 UTC (permalink / raw)
  To: Александр Поляков
  Cc: bug-gnu-emacs

> What I think is the bug, is a problem with automatic indentations when I 
> type PERL programs. Let me get right to the point and I'll paste first 
> the code how it is automatically indented:
> 
> sub insert_sub {
>    return unless (save_slide());
>    my $after = 0;
> 
>    prompt(0, 'New Subtitle', "Would you like to " .
>       "insert the new subtitle\n" .
> Next, is how I believe would be a proper way to indent the same code:
> 
> sub insert_sub {
>    return unless (save_slide());
>    my $after = 0;
> 
>    prompt(0, 'New Subtitle', "Would you like to " .
>           "insert the new subtitle\n" .
>           "before the current one or after?",
>           [{GTK_ID => 'gtk-cancel',
>             LABEL => 'Cancel',
>             ALIGN => 'right',
>             SUB => sub { $after = -1;}},
>            {GTK_ID => 'gtk-go-back',
>             LABEL => 'Before',
>             ALIGN => 'left',
>             SUB => sub {$after = 0;}},
>            {GTK_ID => 'gtk-go-forward',
>             LABEL => 'After',
>             ALIGN => 'right',
>             SUB => sub {$after = 1}},
>           ]);
> 
>    if ($after == 0) {
>        insert_before($srt_idx);
>    } elsif ($after == 1) {
>        insert_before($srt_idx + 1);
>    }
> }
> 
> (Somehow the exact spacing differ here, but I think you can see the 
> difference in general.)
> 
> Basically after I enter "{... SUB => sub {}}," the indentation screws 
> up. I hope this makes sense.
> 
> Thanks,
> Alex.
> 
> 
> _______________________________________________
> bug-gnu-emacs mailing list
> bug-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs
> 

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

* Re: Indentations, PERL
  2007-06-27  5:47 Indentations, PERL Александр Поляков
  2007-06-27  8:00 ` martin rudalics
@ 2007-06-27  8:06 ` martin rudalics
       [not found]   ` <4684B476.1020007@comcast.net>
  1 sibling, 1 reply; 6+ messages in thread
From: martin rudalics @ 2007-06-27  8:06 UTC (permalink / raw)
  To: Александр Поляков
  Cc: bug-gnu-emacs

Pleae ignore my first reply on this, it got mangled while sending.

 > What I think is the bug, is a problem with automatic indentations when I
 > type PERL programs. Let me get right to the point and I'll paste first
 > the code how it is automatically indented:
 >
 > sub insert_sub {
 >    return unless (save_slide());
 >    my $after = 0;
 >
 >    prompt(0, 'New Subtitle', "Would you like to " .
 >       "insert the new subtitle\n" .

Could you please tell how you inserted the last line.  Here, typing RET
at the end of the line before as well as hitting TAB on the last line do
the right thing.

 > Next, is how I believe would be a proper way to indent the same code:

It does so here.

 > (Somehow the exact spacing differ here, but I think you can see the
 > difference in general.)
 >
 > Basically after I enter "{... SUB => sub {}}," the indentation screws
 > up. I hope this makes sense.

Please tell us which Emacs version and which perl mode (cperl-mode or
perl-mode) you use.

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

* Re: Indentations, PERL
       [not found]   ` <4684B476.1020007@comcast.net>
@ 2007-06-29  7:55     ` martin rudalics
  2007-06-29 13:42       ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2007-06-29  7:55 UTC (permalink / raw)
  To: Александр Поляков
  Cc: bug-gnu-emacs, Stefan Monnier

> for all the indentation, I always hit the <return> key, and then the 
> <tab> to get the automatic alignment. Oh, I've tried using cperl-mode, 
> instead of perl-mode, and that fixes it. So, it seems this is only 
> happens in perl-mode. The emacs version I have is: 21.4.1, I've 
> installed it from a package for Ubuntu.

I could reproduce it.  This has been fixed for Emacs 22.1.  You should
install that to get the right behavior.  I'm not sure whether the latest
perl-mode works with Emacs 21.4.

Stefan could you comment on that?

> So, is this just how perl-mode works? Is there anyway for me to slightly 
> adjust it, because I prefer the highlighting in perl-mode better than 
> cperl-mode?

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

* Re: Indentations, PERL
  2007-06-29  7:55     ` martin rudalics
@ 2007-06-29 13:42       ` Stefan Monnier
  2007-06-29 13:56         ` martin rudalics
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2007-06-29 13:42 UTC (permalink / raw)
  To: martin rudalics
  Cc: bug-gnu-emacs,
	Александр Поляков

>> for all the indentation, I always hit the <return> key, and then the <tab>
>> to get the automatic alignment.  Oh, I've tried using cperl-mode, instead
>> of perl-mode, and that fixes it.  So, it seems this is only happens in
>> perl-mode.  The Emacs version I have is: 21.4.1, I've installed it from
>> a package for Ubuntu.

> I could reproduce it.  This has been fixed for Emacs 22.1.  You should
> install that to get the right behavior.  I'm not sure whether the latest
> perl-mode works with Emacs 21.4.

> Stefan could you comment on that?

I cannot remember using features specific to Emacs-22 in perl-mode, but
I can't guarantee that it will work with Emacs-21 either.

If it doesn't work, it should be pretty easy to make it work, tho.
In any case, I'd first lobby Ubuntu to include an emacs22 package since that
will give you other improvements at the same time.


        Stefan

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

* Re: Indentations, PERL
  2007-06-29 13:42       ` Stefan Monnier
@ 2007-06-29 13:56         ` martin rudalics
  0 siblings, 0 replies; 6+ messages in thread
From: martin rudalics @ 2007-06-29 13:56 UTC (permalink / raw)
  To: Stefan Monnier
  Cc: bug-gnu-emacs,
	Александр Поляков

> I cannot remember using features specific to Emacs-22 in perl-mode, but
> I can't guarantee that it will work with Emacs-21 either.

It uses `syntax-ppss' which doesn't exist in Emacs 21.

> If it doesn't work, it should be pretty easy to make it work, tho.
> In any case, I'd first lobby Ubuntu to include an emacs22 package since that
> will give you other improvements at the same time.

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

end of thread, other threads:[~2007-06-29 13:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-27  5:47 Indentations, PERL Александр Поляков
2007-06-27  8:00 ` martin rudalics
2007-06-27  8:06 ` martin rudalics
     [not found]   ` <4684B476.1020007@comcast.net>
2007-06-29  7:55     ` martin rudalics
2007-06-29 13:42       ` Stefan Monnier
2007-06-29 13:56         ` martin rudalics

Code repositories for project(s) associated with this public inbox

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

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).