[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why does cperl-mode slaughter my formatting?
From: |
Le Wang |
Subject: |
Re: Why does cperl-mode slaughter my formatting? |
Date: |
Sat, 01 Feb 2003 12:22:18 GMT |
User-agent: |
KNode/0.7.1 |
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