[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why does cperl-mode slaughter my formatting?
From: |
Harry Putnam |
Subject: |
Re: Why does cperl-mode slaughter my formatting? |
Date: |
Sat, 01 Feb 2003 19:43:26 GMT |
User-agent: |
Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu) |
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.