[comp.lang.perl] perl-mode in elisp

marc@athena.mit.edu (03/20/90)

Has anybody written a perl-mode for elisp?  Some of the problems
people have come up with for the novice user contest, especially
omitted ; and mismatched {} would be solved by an intelligent
perl-mode in emacs.  Sorry for those of you who can't use emacs.

So, has anybody hacked up a perl-mode for emacs yet?

		Marc Horowitz

piet@cs.ruu.nl (Piet van Oostrum) (03/20/90)

In article <1990Mar19.174345.13395@uvaarpa.Virginia.EDU>, marc@athena writes:
 `Has anybody written a perl-mode for elisp?  Some of the problems
 `people have come up with for the novice user contest, especially
 `omitted ; and mismatched {} would be solved by an intelligent
 `perl-mode in emacs.  Sorry for those of you who can't use emacs.
 `
I use c-mode. The perl syntax is rather C-ish.
-- 
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')

dovich@uunet.uu.net (Steven J. Dovich) (03/21/90)

I have a perl-mode.el for GNU Emacs that I have derived from the
c-mode.el distributed with the sources. Because of its derivation,
this elisp source is copylefted.

Features:

        * use of c-mode style parameters, for C-like indentation.

        * calls both 'c-mode-hook, and 'perl-mode-hook.
          From my .emacs file:

            (setq perl-mode-hook
                  '(lambda ()
                     (goto-line 2)
                     (if (not (re-search-backward "^#!/util/bin/perl"
                                                  nil t))
                              (progn (goto-char 1)
                                     (insert "#!/util/bin/perl")
                                     (newline)
                                     (goto-char 1)
                                     ))
                     ))
          
          This hook function installs the interpreter exec directive
          into the script file, if it isn't already there. 

Caveats:

        * The '$' character is treated as an ESCAPE syntax class, to
          remove comment status from the '#' charater in array length
          expressions.

        * Regular expressions are still an open issue for this
          perl-mode (since the RE delimiters can be nearly any
          character). The good news is that perl-mode does the right
          thing most of the time.

--
Steven J. Dovich                        <uunet.uu.net!cadence!gda!dovich>
Cadence Design Systems
2 Lowell Research Center Dr.
Lowell, MA  01852-4995                  Phone: (508) 458-1900 x272