unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* CPerl Indentation after subs with print in their names
@ 2007-11-22 16:43 Stefan Kamphausen
  2007-11-23  8:41 ` Ilya Zakharevich
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Kamphausen @ 2007-11-22 16:43 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

today I came across a subtle mis-indentation in Perl-code.  Assume a
file like this:

----------------------------------------------------------------------
#! /usr/bin/perl
use strict;
use warnings;

sub anything {
    print "OK\n";
}
# here indentation is OK
sub print_something {
    print "Something\n";
}
  # but here not ??
----------------------------------------------------------------------

If I remove the "print_" from the the name of the subroutine
everything indents correctly.  I tried a few other special words from
the Perl language:

Function   Indentation
printf     wrong
while      OK
sprintf    OK
substr     OK
open       OK


This happens with:
Gnu Emacs 22.1.1, cperl-version 5.22.


Steps to reproduce:
shell> emacs -q test.pl
emacs> M-x cperl-mode
emacs> M-x goto-line 12  ;; the line # but here not ??
emacs> TAB


Is this a bug or some stupidity on my part?


Regards,
Stefan
-- 
Stefan Kamphausen --- http://www.skamphausen.de
a blessed +42 regexp of confusion (weapon in hand)
You hit. The format string crumbles and turns to dust.

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

* Re: CPerl Indentation after subs with print in their names
  2007-11-22 16:43 CPerl Indentation after subs with print in their names Stefan Kamphausen
@ 2007-11-23  8:41 ` Ilya Zakharevich
  2007-11-23  9:40   ` Stefan Kamphausen
  0 siblings, 1 reply; 10+ messages in thread
From: Ilya Zakharevich @ 2007-11-23  8:41 UTC (permalink / raw)
  To: help-gnu-emacs

[A complimentary Cc of this posting was sent to
Stefan Kamphausen 
<skampi@gmx.net>], who wrote in article <85zlx6qlid.fsf@usenet.my.skamphausen.de>:
> # here indentation is OK
> sub print_something {
>     print "Something\n";
> }
>   # but here not ??
> ----------------------------------------------------------------------
> 
> If I remove the "print_" from the the name of the subroutine
> everything indents correctly.  I tried a few other special words from
> the Perl language:
> 
> Function   Indentation
> printf     wrong
> while      OK

> Gnu Emacs 22.1.1, cperl-version 5.22.

I suspect that Emacsen come with broken cperl-mode.  See
ilyaz.org/software/emacs

Hope this helps,
Ilya

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

* Re: CPerl Indentation after subs with print in their names
  2007-11-23  8:41 ` Ilya Zakharevich
@ 2007-11-23  9:40   ` Stefan Kamphausen
  2007-11-23 23:19     ` Ilya Zakharevich
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Kamphausen @ 2007-11-23  9:40 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Ilya,

Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:

> [A complimentary Cc of this posting was sent to
> Stefan Kamphausen 
> <skampi@gmx.net>],

... which does not help since that address is rarely read ;-)

 > who wrote in article <85zlx6qlid.fsf@usenet.my.skamphausen.de>:
>> # here indentation is OK
>> [SNIP]
> I suspect that Emacsen come with broken cperl-mode.  See
> ilyaz.org/software/emacs
>
> Hope this helps,

It does and then confuses me even more.

It helps in that your version indents the perl code correctly.  That
made me compare those files which both announce the same version in
cperl-version: 5.22.  The line-count differs by 1542 lines which means
there is more than subtle changes and an ediff-session confirms this.

I'd be interested in knowing how the development is done.  Do you,
Ilya, still maintain the code?  The comments at the beginning of the
file state this.  There would have been a small chance for me to
notice the difference had I used the menu entry Perl-> Micro Docs->
CPerl version which in case of the version shipped with Emacs appends
a "-Emacs" to cperl-version.

Some of the differences may be important to you, too.

Anyway, thanks for getting me on the track and thanks for providing
cperl-mode of course.

Kind regards,
stefan
-- 
Stefan Kamphausen --- http://www.skamphausen.de
a blessed +42 regexp of confusion (weapon in hand)
You hit. The format string crumbles and turns to dust.

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

* Re: CPerl Indentation after subs with print in their names
  2007-11-23  9:40   ` Stefan Kamphausen
@ 2007-11-23 23:19     ` Ilya Zakharevich
  2007-11-26  8:21       ` Stefan Kamphausen
  0 siblings, 1 reply; 10+ messages in thread
From: Ilya Zakharevich @ 2007-11-23 23:19 UTC (permalink / raw)
  To: help-gnu-emacs

[A complimentary Cc of this posting was sent to
Stefan Kamphausen 
<skampi@gmx.net>], who wrote in article <853auxqozl.fsf@usenet.my.skamphausen.de>:
> I'd be interested in knowing how the development is done.

I explain it often on g.e.h.  Google for it.

Hope this helps,
Ilya

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

* Re: CPerl Indentation after subs with print in their names
  2007-11-23 23:19     ` Ilya Zakharevich
@ 2007-11-26  8:21       ` Stefan Kamphausen
  2007-11-26 23:05         ` Ilya Zakharevich
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Kamphausen @ 2007-11-26  8:21 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Ilya,

Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:

>> I'd be interested in knowing how the development is done.
>
> I explain it often on g.e.h.  Google for it.

OK, feeling a bit stupid now.

Nevertheless, it was wasted time on my side (comparing those files)
and on yours (writing posts) which could have been saved if there were
some comments at the beginning of the file that explained the way
things are.

Anyway thanks and regards,
Stefan 
-- 
Stefan Kamphausen --- http://www.skamphausen.de
a blessed +42 regexp of confusion (weapon in hand)
You hit. The format string crumbles and turns to dust.

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

* Re: CPerl Indentation after subs with print in their names
  2007-11-26  8:21       ` Stefan Kamphausen
@ 2007-11-26 23:05         ` Ilya Zakharevich
  2007-11-27  8:14           ` Stefan Kamphausen
  0 siblings, 1 reply; 10+ messages in thread
From: Ilya Zakharevich @ 2007-11-26 23:05 UTC (permalink / raw)
  To: help-gnu-emacs

[A complimentary Cc of this posting was sent to
Stefan Kamphausen 
<skampi@gmx.net>], who wrote in article <85bq9h2z9r.fsf@usenet.my.skamphausen.de>:
> > I explain it often on g.e.h.  Google for it.
> 
> OK, feeling a bit stupid now.
> 
> Nevertheless, it was wasted time on my side (comparing those files)
> and on yours (writing posts) which could have been saved if there were
> some comments at the beginning of the file that explained the way
> things are.

Ha, I see you presume people would read what is "at the beginning of
the file"!  And where you think this "beginning" is, before/after
license/changelog, or where?

  [If you can agree on that, I put it into my TODO ;-]

Yours,
Ilya

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

* Re: CPerl Indentation after subs with print in their names
  2007-11-26 23:05         ` Ilya Zakharevich
@ 2007-11-27  8:14           ` Stefan Kamphausen
  2007-11-28  9:05             ` Tim X
  2007-12-16 18:41             ` David Combs
  0 siblings, 2 replies; 10+ messages in thread
From: Stefan Kamphausen @ 2007-11-27  8:14 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Ilya,

Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:

>> Nevertheless, it was wasted time on my side (comparing those files)
>> and on yours (writing posts) which could have been saved if there were
>> some comments at the beginning of the file that explained the way
>> things are.
>
> Ha, I see you presume people would read what is "at the beginning of
> the file"!  And where you think this "beginning" is, before/after
> license/changelog, or where?

Can't tell.  I won't even assume that other people read all that, but
/I/ do and I always write my stuff as if others would, too :-)

Hm, let's see ... there is this comment:

;; DO NOT FORGET to read micro-docs (available from `Perl' menu)   <<<<<<
;; or as help on variables `cperl-tips', `cperl-problems',         <<<<<<
;; `cperl-praise', `cperl-speed'.				   <<<<<<

Somewhere close to that would be a good idea maybe.  Or it could be a
micro-doc itself.  cperl-development or cperl-versions or
cperl-maintenance or something like that.  

>   [If you can agree on that, I put it into my TODO ;-]

:-)

Regards,
Stefan
-- 
Stefan Kamphausen --- http://www.skamphausen.de
a blessed +42 regexp of confusion (weapon in hand)
You hit. The format string crumbles and turns to dust.

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

* Re: CPerl Indentation after subs with print in their names
  2007-11-27  8:14           ` Stefan Kamphausen
@ 2007-11-28  9:05             ` Tim X
  2007-12-16 18:41             ` David Combs
  1 sibling, 0 replies; 10+ messages in thread
From: Tim X @ 2007-11-28  9:05 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Kamphausen <skampi@gmx.net> writes:

> Hi Ilya,
>
> Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:
>
>>> Nevertheless, it was wasted time on my side (comparing those files)
>>> and on yours (writing posts) which could have been saved if there were
>>> some comments at the beginning of the file that explained the way
>>> things are.
>>
>> Ha, I see you presume people would read what is "at the beginning of
>> the file"!  And where you think this "beginning" is, before/after
>> license/changelog, or where?
>
> Can't tell.  I won't even assume that other people read all that, but
> /I/ do and I always write my stuff as if others would, too :-)
>
> Hm, let's see ... there is this comment:
>
> ;; DO NOT FORGET to read micro-docs (available from `Perl' menu)   <<<<<<
> ;; or as help on variables `cperl-tips', `cperl-problems',         <<<<<<
> ;; `cperl-praise', `cperl-speed'.				   <<<<<<
>
> Somewhere close to that would be a good idea maybe.  Or it could be a
> micro-doc itself.  cperl-development or cperl-versions or
> cperl-maintenance or something like that.  
>
>>   [If you can agree on that, I put it into my TODO ;-]
>
> :-)
>
> Regards,
> Stefan

I have to say I agree with Stefan's point here. After quite a few years of
using cperl, I can say that almost without exception, everytime I've run
into problems, replacing the provided version with a newer one from Ilya's
site fixes the issue. However, it can be difficult to tell which version is
the later one (though I think there is more info in the file on this than
there use to be - I do remember being very confused in the beginning). 

Tim

-- 
tcross (at) rapttech dot com dot au

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

* Re: CPerl Indentation after subs with print in their names
  2007-11-27  8:14           ` Stefan Kamphausen
  2007-11-28  9:05             ` Tim X
@ 2007-12-16 18:41             ` David Combs
  2007-12-16 20:21               ` Ilya Zakharevich
  1 sibling, 1 reply; 10+ messages in thread
From: David Combs @ 2007-12-16 18:41 UTC (permalink / raw)
  To: help-gnu-emacs

In article <85zlx0hzph.fsf@usenet.my.skamphausen.de>,
Stefan Kamphausen  <skampi@gmx.net> wrote:
>Hi Ilya,
>
>Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:
>
>>> Nevertheless, it was wasted time on my side (comparing those files)
>>> and on yours (writing posts) which could have been saved if there were
>>> some comments at the beginning of the file that explained the way
>>> things are.
>>
>> Ha, I see you presume people would read what is "at the beginning of
>> the file"!  And where you think this "beginning" is, before/after
>> license/changelog, or where?
>
>Can't tell.  I won't even assume that other people read all that, but
>/I/ do and I always write my stuff as if others would, too :-)
>
>Hm, let's see ... there is this comment:
>
>;; DO NOT FORGET to read micro-docs (available from `Perl' menu)   <<<<<<
>;; or as help on variables `cperl-tips', `cperl-problems',         <<<<<<
>;; `cperl-praise', `cperl-speed'.				   <<<<<<
>
>Somewhere close to that would be a good idea maybe.  Or it could be a
>micro-doc itself.  cperl-development or cperl-versions or
>cperl-maintenance or something like that.  
>
>>   [If you can agree on that, I put it into my TODO ;-]
>
>:-)

A probably-stupid question: what's a "micro-doc"?

Some kind of emacs terminology?  Or cperl's, maybe?


I googled it ("micro doc" emacs), and it came up
with this very thread!

Thanks!

David

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

* Re: CPerl Indentation after subs with print in their names
  2007-12-16 18:41             ` David Combs
@ 2007-12-16 20:21               ` Ilya Zakharevich
  0 siblings, 0 replies; 10+ messages in thread
From: Ilya Zakharevich @ 2007-12-16 20:21 UTC (permalink / raw)
  To: help-gnu-emacs

[A complimentary Cc of this posting was sent to
David Combs
<dkcombs@panix.com>], who wrote in article <fk3rfs$aar$1@reader1.panix.com>:
> A probably-stupid question: what's a "micro-doc"?
> 
> Some kind of emacs terminology?  Or cperl's, maybe?

An entry in the mode menu for CPerl mode.  Basically, via-mouse access
to (IMO) most useful doc-strings.

Yours,
Ilya

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

end of thread, other threads:[~2007-12-16 20:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-22 16:43 CPerl Indentation after subs with print in their names Stefan Kamphausen
2007-11-23  8:41 ` Ilya Zakharevich
2007-11-23  9:40   ` Stefan Kamphausen
2007-11-23 23:19     ` Ilya Zakharevich
2007-11-26  8:21       ` Stefan Kamphausen
2007-11-26 23:05         ` Ilya Zakharevich
2007-11-27  8:14           ` Stefan Kamphausen
2007-11-28  9:05             ` Tim X
2007-12-16 18:41             ` David Combs
2007-12-16 20:21               ` Ilya Zakharevich

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