help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

what might stop cperl-mode from indenting?


From: David Combs
Subject: what might stop cperl-mode from indenting?
Date: 22 Jul 2004 23:59:06 -0400

what might stop cperl-mode from indenting?

emacs-version is 21.2 (from the solaris-9 complimentary-software cd),

and these 5 lines from /opt/sfw/share/emacs/21.2/lisp/progmodes/cperl-mode.el:

> (defgroup cperl nil
>   "Major mode for editing Perl code."
>   :prefix "cperl-"
>   :group 'languages
>   :version "20.3")



. Works fine when sub-foo is the *sole* thing in a file ("t.pl"):

Given this: 

> sub foo {
> my $dbg=0;
> $x=5;
> }

If I put the cursor at the my-line left-margin, and hit TAB, then, as
expected, I'm left with this:

> sub foo {
>   my $dbg=0;
> our $x=5;
> }


Futher, M-x cperl-indent-region works just fine, 
leaving me with this:

> sub foo {
>   my $dbg=0;
>   our $x=5;
> }


. Whereas with the a larger (and problematic) perl file (that I'm
working on), when I place that sub-foo between two functions, indenting
doesn't work.

Now, "show me the code that comes before that foo-sub", you demand.

Nope -- doesn't matter.

Because here's what's *really* wild: I get the same problems 
*even* when I've *NARROWED* it to "be identical" to the above t.pl, 
the narrowed-buffer being this:

> 
> sub foo {
> my $dbg=0;
> $x=5;
> }
>

That is, if the my-line is flush left, then a tab-command
does *nothing*.


(QUESTION: What, cperl-mode has X-ray vision?)


NOTE THIS (hey, I learn slowly): Just now, while preparing this post
(off-line), I've discovered that when I have the cursor not at the
left margin (as before), but instead out to the *right* of the
my-line, and *then* I hit tab, it works differently!  

It *does* indent that my-line!

And once that's happened, the $x-line indents ok, even with the
cursor at its left margin.

(We're not through yet -- it's still royally screwed up.)



(Well, sometimes something (in emacs) seems to go into a loop, until I
hit a ^G.
and "top" shows emacs going from 10% cpu to 92% (and still climbing,
when I did the ^G)




However, still in the big file, narrowed, with the my and $x lines
put back at the left margin, if I put the cursor out to the right
of the $x line and hit tab, emacs (or cperl.el) goes into a loop!

(The screen cursor turns into a wee clock-face; in another CDE-window,
top shows emacs growing from 10% of cpu up to 92$, at which
point I ^G emacs, and the cursor stops being a clock-face).

Likewise, perhaps as no surprise now, I can get into that loop doing
"M-x cperl-indent-region".

In this case the minibuf says "(indenting ... ( 6%))


And none of these problems happen in the small file, t.pl 


QUESTION: what might be going wrong?



Thanks for any ideas!

David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]