unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Why does cperl-mode slaughter my formatting?
@ 2003-02-01  9:37 Harry Putnam
  2003-02-01 12:22 ` Unknown
  0 siblings, 1 reply; 6+ messages in thread
From: Harry Putnam @ 2003-02-01  9:37 UTC (permalink / raw)


Try to ignore the horrible perl coding for a moment and just look at
the format:

open(FILE, "<./rcfile");
while(<FILE>){
  if (/^<DIR>/) {
    $save_dir = 'TRUE';
  }
  if(/^<\/DIR>/) {
    $save_dir  = "";
  }
  if($save_dir) {
    push @directories,$_;
  }
  if(/^<HEADER_RE>/){
     $save_hre = "TRUE";
  }
  if(/^<\/HEADER_RE>/) {
     $save_hre = "";
  }
  if($save_hre) {
    push @header_re,$_;
  }
  if(/^<BODY_RE>/){
     $save_bre = "TRUE";
  }
  if(/^<\/BODY_RE>/) {
     $save_bre = "";
  }
  if($save_bre) {
    push @body_re,$_;
  }
}

When I use C-M-\ to format above, cperl-mode does this:

open(FILE, "<./rcfile");
while (<FILE>) {
  if (/^<DIR>/) {
    $save_dir = 'TRUE';
  }
      if (/^<\/DIR>/) {
	$save_dir  = "";
      }
	  if ($save_dir) {
	    push @directories,$_;
	  }
	  if (/^<HEADER_RE>/) {
	    $save_hre = "TRUE";
	  }
	      if (/^<\/HEADER_RE>/) {
		$save_hre = "";
	      }
		  if ($save_hre) {
		    push @header_re,$_;
		  }
		  if (/^<BODY_RE>/) {
		    $save_bre = "TRUE";
		  }
		      if (/^<\/BODY_RE>/) {
			$save_bre = "";
		      }
			  if ($save_bre) {
			    push @body_re,$_;
			  }
			}


Surely that can't be a desireable format?
I'd hoped defaults would be good to work with, and maybe they are.
Anyone see how I'm screwing it up?

cperl-version's value is "4.32"

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

* Re: Why does cperl-mode slaughter my formatting?
  2003-02-01  9:37 Why does cperl-mode slaughter my formatting? Harry Putnam
@ 2003-02-01 12:22 ` Unknown
  2003-02-01 19:43   ` Harry Putnam
  0 siblings, 1 reply; 6+ messages in thread
From: Unknown @ 2003-02-01 12:22 UTC (permalink / raw)


Harry Putnam wrote:

> Try to ignore the horrible perl coding for a moment and just look at
> the format:
> 
> open(FILE, "<./rcfile");
> while(<FILE>){
>   if (/^<DIR>/) {
>     $save_dir = 'TRUE';
>   }
>   if(/^<\/DIR>/) {
>     $save_dir  = "";
>   }
>   if($save_dir) {
>     push @directories,$_;
>   }
>   if(/^<HEADER_RE>/){
>      $save_hre = "TRUE";
>   }
>   if(/^<\/HEADER_RE>/) {
>      $save_hre = "";
>   }
>   if($save_hre) {
>     push @header_re,$_;
>   }
>   if(/^<BODY_RE>/){
>      $save_bre = "TRUE";
>   }
>   if(/^<\/BODY_RE>/) {
>      $save_bre = "";
>   }
>   if($save_bre) {
>     push @body_re,$_;
>   }
> }
> 
> When I use C-M-\ to format above, cperl-mode does this:
> 
> open(FILE, "<./rcfile");
> while (<FILE>) {
>   if (/^<DIR>/) {
>     $save_dir = 'TRUE';
>   }
>       if (/^<\/DIR>/) {
> $save_dir  = "";
>       }
> if ($save_dir) {
> push @directories,$_;
> }
> if (/^<HEADER_RE>/) {
> $save_hre = "TRUE";
> }
> if (/^<\/HEADER_RE>/) {
> $save_hre = "";
> }
> if ($save_hre) {
> push @header_re,$_;
> }
> if (/^<BODY_RE>/) {
> $save_bre = "TRUE";
> }
> if (/^<\/BODY_RE>/) {
> $save_bre = "";
> }
> if ($save_bre) {
> push @body_re,$_;
> }
> }
> 
> 
> Surely that can't be a desireable format?
> I'd hoped defaults would be good to work with, and maybe they are.
> Anyone see how I'm screwing it up?

Hi Harry,

Start emacs with "emacs -q", your code should indent correctly, as it does for 
me.  You must have something that confuses cperl-mode in your init scripts.

--
Le

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

* Re: Why does cperl-mode slaughter my formatting?
  2003-02-01 12:22 ` Unknown
@ 2003-02-01 19:43   ` Harry Putnam
  2003-02-02  2:57     ` Harry Putnam
  2003-02-02  4:51     ` Joe Casadonte
  0 siblings, 2 replies; 6+ messages in thread
From: Harry Putnam @ 2003-02-01 19:43 UTC (permalink / raw)


Le Wang <lewang(at@)yahoo.com> writes:

> From: Le Wang <lewang(at@)yahoo.com>
> Subject: Re: Why does cperl-mode slaughter my formatting?
> Newsgroups: gnu.emacs.help
> Date: Sat, 01 Feb 2003 12:22:18 GMT
> Message-ID: <_ZO_9.190104$ej1.56061@news02.bloor.is.net.cable.rogers.com>
>
> Harry Putnam wrote:
>
>> Try to ignore the horrible perl coding for a moment and just look at
>> the format:
>> 
>> open(FILE, "<./rcfile");
>> while(<FILE>){
>>   if (/^<DIR>/) {
>>     $save_dir = 'TRUE';
>>   }
>>   if(/^<\/DIR>/) {
>>     $save_dir  = "";
>>   }
>>   if($save_dir) {
>>     push @directories,$_;
>>   }
>>   if(/^<HEADER_RE>/){
>>      $save_hre = "TRUE";
>>   }
>>   if(/^<\/HEADER_RE>/) {
>>      $save_hre = "";
>>   }
>>   if($save_hre) {
>>     push @header_re,$_;
>>   }
>>   if(/^<BODY_RE>/){
>>      $save_bre = "TRUE";
>>   }
>>   if(/^<\/BODY_RE>/) {
>>      $save_bre = "";
>>   }
>>   if($save_bre) {
>>     push @body_re,$_;
>>   }
>> }
>> 
>> When I use C-M-\ to format above, cperl-mode does this:
>> 
>> open(FILE, "<./rcfile");
>> while (<FILE>) {
>>   if (/^<DIR>/) {
>>     $save_dir = 'TRUE';
>>   }
>>       if (/^<\/DIR>/) {
>> $save_dir  = "";
>>       }
>> if ($save_dir) {
>> push @directories,$_;
>> }
>> if (/^<HEADER_RE>/) {
>> $save_hre = "TRUE";
>> }
>> if (/^<\/HEADER_RE>/) {
>> $save_hre = "";
>> }
>> if ($save_hre) {
>> push @header_re,$_;
>> }
>> if (/^<BODY_RE>/) {
>> $save_bre = "TRUE";
>> }
>> if (/^<\/BODY_RE>/) {
>> $save_bre = "";
>> }
>> if ($save_bre) {
>> push @body_re,$_;
>> }
>> }
>> 
>> 
Doesn't seem to make any difference here:

emacs -q -no-site-file

Then emacs my.pl

then invoke syntax hylight from menu
then invoke cperl-mode

Finally select this region:

#!/usr/local/bin/perl -w

open(FILE, "<./rcfile");
while(<FILE>){
  if (/^<DIR>/) {
    $save_dir = 'TRUE';
  }
  if(/^<\/DIR>/) {
    $save_dir  = "";
  }
  if($save_dir) {
    push @directories,$_;

[...]
}

And press M-C-\
(Blam.. if flys all over town
open(FILE, "<./rcfile");

[...]

		    push @header_re,$_;
		  }
		  if (/^<BODY_RE>/) {
		    $save_bre = "TRUE";
		  }
		      if (/^<\/BODY_RE>/) {
			$save_bre = "";
		      }
			  if ($save_bre) {
			    push @body_re,$_;
			  }
			}


Do we have the same version?
C-h v <RET> cperl-version<RET>
  cperl-version's value is "4.32"

  Version of IZ-supported CPerl package this file is based on.

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

* Re: Why does cperl-mode slaughter my formatting?
  2003-02-01 19:43   ` Harry Putnam
@ 2003-02-02  2:57     ` Harry Putnam
  2003-02-03 14:21       ` Martin Jost
  2003-02-02  4:51     ` Joe Casadonte
  1 sibling, 1 reply; 6+ messages in thread
From: Harry Putnam @ 2003-02-02  2:57 UTC (permalink / raw)


Harry Putnam <hgp@sbcglobal.net> writes:

[...] snipped wild foratting example

> Do we have the same version?
> C-h v <RET> cperl-version<RET>
>   cperl-version's value is "4.32"
>
>   Version of IZ-supported CPerl package this file is based on.

I upgraded my cvs version of emacs and now it works but oddly enough
the cperl-mode.el that came with new cvs shows no diff from previous
version and still shows same versiion.

So I still don't know what was causing my problem.

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

* Re: Why does cperl-mode slaughter my formatting?
  2003-02-01 19:43   ` Harry Putnam
  2003-02-02  2:57     ` Harry Putnam
@ 2003-02-02  4:51     ` Joe Casadonte
  1 sibling, 0 replies; 6+ messages in thread
From: Joe Casadonte @ 2003-02-02  4:51 UTC (permalink / raw)


On Sat, 01 Feb 2003, Harry Putnam wrote:

> Do we have the same version?
> C-h v <RET> cperl-version<RET>
>   cperl-version's value is "4.32"
>
>   Version of IZ-supported CPerl package this file is based on.

I have that version and indenting for me looks OK:

open(FILE, "<./rcfile");
while (<FILE>) {
	if (/^<DIR>/) {
		$save_dir = 'TRUE';
	}
	if (/^<\/DIR>/) {
		$save_dir  = "";
	}
	if ($save_dir) {
		push @directories,$_;
	}
	if (/^<HEADER_RE>/) {
		$save_hre = "TRUE";
	}
	if (/^<\/HEADER_RE>/) {
		$save_hre = "";
	}
	if ($save_hre) {
		push @header_re,$_;
	}
	if (/^<BODY_RE>/) {
		$save_bre = "TRUE";
	}
	if (/^<\/BODY_RE>/) {
		$save_bre = "";
	}
	if ($save_bre) {
		push @body_re,$_;
	}
}

The only cperl indentation customization that I have that is not at
the standard setting is:

Cperl Continued Statement Offset: 4

I do have every "electric" & "hairy" option turned off, when possible.

In fact, outside of the font-lock stuff, I would love to turn ALL of
cperl off -- it can be quite annoying at times.....

--
Regards,

joe
Joe Casadonte
jcasadonte@northbound-train.com

------------------------------------------------------------------------------
         Llama Fresh Farms => http://www.northbound-train.com
   Gay Media Resource List => http://www.northbound-train.com/gaymedia.html
            Perl for Win32 => http://www.northbound-train.com/perlwin32.html
               Emacs Stuff => http://www.northbound-train.com/emacs.html
          Music CD Trading => http://www.northbound-train.com/cdr.html
------------------------------------------------------------------------------
                       Live Free, that's the message!
------------------------------------------------------------------------------

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

* Re: Why does cperl-mode slaughter my formatting?
  2003-02-02  2:57     ` Harry Putnam
@ 2003-02-03 14:21       ` Martin Jost
  0 siblings, 0 replies; 6+ messages in thread
From: Martin Jost @ 2003-02-03 14:21 UTC (permalink / raw)


"Harry Putnam" <hgp@sbcglobal.net> wrote in message
news:m2vg039yor.fsf@sbcglobal.net...
> Harry Putnam <hgp@sbcglobal.net> writes:
>
> [...] snipped wild foratting example
>
> I upgraded my cvs version of emacs and now it works but oddly enough
> the cperl-mode.el that came with new cvs shows no diff from previous
> version and still shows same versiion.
>
> So I still don't know what was causing my problem.

So you live on the bleeding edge ?!
cperl relies heavily on syntax-properties (right name ?)
At least once, a released version of emacs needed to be patched, so that
cperl worked correctly. (A friend of mine asked me a second time, when I
told him he had to get a patch for the c-sources of emacs to get this bug
out)
Maybe something like that was broken on you older version....
You just would have to diff the whole thing ;-)

Just wild guessing...

Martin

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

end of thread, other threads:[~2003-02-03 14:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-01  9:37 Why does cperl-mode slaughter my formatting? Harry Putnam
2003-02-01 12:22 ` Unknown
2003-02-01 19:43   ` Harry Putnam
2003-02-02  2:57     ` Harry Putnam
2003-02-03 14:21       ` Martin Jost
2003-02-02  4:51     ` Joe Casadonte

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