[comp.lang.perl] perl-mode in gemacs: "In format statement"

jas@ISI.EDU (Jeff Sullivan) (03/01/91)

I loaded up the perl-mode GNU emacs extension, and it seems to work
fine except that it can't seem to tell when it completes a format
statement.  If I have code after a format, it won't let me TAB there
because it says "In a format statement" (or words to that effect).

Is there a fix for this?

jas

--
--------------------------------------------------------------------------
Jeffrey A. Sullivan		| Senior Systems Programmer
jas@venera.isi.edu		| Information Sciences Institute
jas@isi.edu                    	| University of Southern California

piet@cs.ruu.nl (Piet van Oostrum) (03/01/91)

This is the reply I got when I complained about this. It solves the
problem:

From: bill@ksr.com (Bill Mann)
To: piet@cs.ruu.nl
Subject: Re: perl-mode.el
Date: Sun, 24 Feb 91 18:55:37 EST

In article <4920@ruuinf.cs.ruu.nl> you write:
>I have been using this perl-mode.el for a time, and occasionally I couldn't
>get the indentation right. This happens if you have statements after a
>format statement. perl-mode thinks that it is in a format statement and
>refuses to indent the code, e.g.
>
>format stdout = 
>This is a format statement
>.
>
>if ($x==1) {
>-- 
>Piet* van Oostrum, Dept of Computer Science, Utrecht University,
>Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
>Telephone: +31 30 531806   Uucp:   uunet!mcsun!ruuinf!piet
>Telefax:   +31 30 513791   Internet:  piet@cs.ruu.nl   (*`Pete')

Thanks for your report.  I rarely use formats, so I'd like you to 
evaluate the enclosed patch, and let me know whether it solves your
problem.  

FYI, I treat formats almost like subroutines.

*** 1.3	1991/02/23 20:44:38
--- perl-mode.el	1991/02/24 23:39:49
***************
*** 572,578 ****
    (or arg (setq arg 1))
    (if (< arg 0) (forward-char 1))
    (and (/= arg 0)
!        (re-search-backward "^\\s(\\|^\\s-*sub\\b[^{]+{\\|^\\s-*format\\b[^=]*="
  			   nil 'move arg)
         (goto-char (1- (match-end 0))))
    (point))
--- 572,578 ----
    (or arg (setq arg 1))
    (if (< arg 0) (forward-char 1))
    (and (/= arg 0)
!        (re-search-backward "^\\s(\\|^\\s-*sub\\b[^{]+{\\|^\\s-*format\\b[^=]*=\\|^\\."
  			   nil 'move arg)
         (goto-char (1- (match-end 0))))
    (point))

-bill
-- 
Piet* van Oostrum, Dept of Computer Science, Utrecht University,
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
Telephone: +31 30 531806   Uucp:   uunet!mcsun!ruuinf!piet
Telefax:   +31 30 513791   Internet:  piet@cs.ruu.nl   (*`Pete')