1 |
;;; perl-mode.el --- Perl code editing commands for GNU Emacs |
;;; perl-mode.el --- Perl code editing commands for GNU Emacs |
2 |
|
|
3 |
;; Copyright (C) 1990, 1994 Free Software Foundation, Inc. |
;; Copyright (C) 1990, 1994, 2003 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Author: William F. Mann |
;; Author: William F. Mann |
6 |
;; Maintainer: FSF |
;; Maintainer: FSF |
257 |
("\\$ ?{?^?[_a-zA-Z][_a-zA-Z0-9]*\\('\\)[_a-zA-Z]" (1 "_")) |
("\\$ ?{?^?[_a-zA-Z][_a-zA-Z0-9]*\\('\\)[_a-zA-Z]" (1 "_")) |
258 |
;; format statements |
;; format statements |
259 |
("^[ \t]*format.*=[ \t]*\\(\n\\)" (1 '(7))) |
("^[ \t]*format.*=[ \t]*\\(\n\\)" (1 '(7))) |
260 |
|
;; TODO: here-documents ("<<\\(\\sw\\|['\"]\\)") |
261 |
;; Funny things in sub arg specifications like `sub myfunc ($$)' |
;; Funny things in sub arg specifications like `sub myfunc ($$)' |
262 |
("\\<sub\\s-+\\S-+\\s-*(\\([^)]+\\))" 1 '(1)) |
("\\<sub\\s-+\\S-+\\s-*(\\([^)]+\\))" 1 '(1)) |
263 |
;; regexp and funny quotes |
;; regexp and funny quotes |
370 |
|
|
371 |
(defcustom perl-indent-level 4 |
(defcustom perl-indent-level 4 |
372 |
"*Indentation of Perl statements with respect to containing block." |
"*Indentation of Perl statements with respect to containing block." |
373 |
:type 'integer |
:type 'integer) |
|
:group 'perl) |
|
374 |
(defcustom perl-continued-statement-offset 4 |
(defcustom perl-continued-statement-offset 4 |
375 |
"*Extra indent for lines not starting new statements." |
"*Extra indent for lines not starting new statements." |
376 |
:type 'integer |
:type 'integer) |
|
:group 'perl) |
|
377 |
(defcustom perl-continued-brace-offset -4 |
(defcustom perl-continued-brace-offset -4 |
378 |
"*Extra indent for substatements that start with open-braces. |
"*Extra indent for substatements that start with open-braces. |
379 |
This is in addition to `perl-continued-statement-offset'." |
This is in addition to `perl-continued-statement-offset'." |
380 |
:type 'integer |
:type 'integer) |
|
:group 'perl) |
|
381 |
(defcustom perl-brace-offset 0 |
(defcustom perl-brace-offset 0 |
382 |
"*Extra indentation for braces, compared with other text in same context." |
"*Extra indentation for braces, compared with other text in same context." |
383 |
:type 'integer |
:type 'integer) |
|
:group 'perl) |
|
384 |
(defcustom perl-brace-imaginary-offset 0 |
(defcustom perl-brace-imaginary-offset 0 |
385 |
"*Imagined indentation of an open brace that actually follows a statement." |
"*Imagined indentation of an open brace that actually follows a statement." |
386 |
:type 'integer |
:type 'integer) |
|
:group 'perl) |
|
387 |
(defcustom perl-label-offset -2 |
(defcustom perl-label-offset -2 |
388 |
"*Offset of Perl label lines relative to usual indentation." |
"*Offset of Perl label lines relative to usual indentation." |
389 |
:type 'integer |
:type 'integer) |
|
:group 'perl) |
|
390 |
(defcustom perl-indent-continued-arguments nil |
(defcustom perl-indent-continued-arguments nil |
391 |
"*If non-nil offset of argument lines relative to usual indentation. |
"*If non-nil offset of argument lines relative to usual indentation. |
392 |
If nil, continued arguments are aligned with the first argument." |
If nil, continued arguments are aligned with the first argument." |
393 |
:type '(choice integer (const nil)) |
:type '(choice integer (const nil))) |
|
:group 'perl) |
|
394 |
|
|
395 |
(defcustom perl-tab-always-indent t |
(defcustom perl-tab-always-indent tab-always-indent |
396 |
"*Non-nil means TAB in Perl mode always indents the current line. |
"Non-nil means TAB in Perl mode always indents the current line. |
397 |
Otherwise it inserts a tab character if you type it past the first |
Otherwise it inserts a tab character if you type it past the first |
398 |
nonwhite character on the line." |
nonwhite character on the line." |
399 |
:type 'boolean |
:type 'boolean) |
|
:group 'perl) |
|
400 |
|
|
401 |
;; I changed the default to nil for consistency with general Emacs |
;; I changed the default to nil for consistency with general Emacs |
402 |
;; conventions -- rms. |
;; conventions -- rms. |
405 |
For lines which don't need indenting, TAB either indents an |
For lines which don't need indenting, TAB either indents an |
406 |
existing comment, moves to end-of-line, or if at end-of-line already, |
existing comment, moves to end-of-line, or if at end-of-line already, |
407 |
create a new comment." |
create a new comment." |
408 |
:type 'boolean |
:type 'boolean) |
|
:group 'perl) |
|
409 |
|
|
410 |
(defcustom perl-nochange ";?#\\|\f\\|\\s(\\|\\(\\w\\|\\s_\\)+:" |
(defcustom perl-nochange ";?#\\|\f\\|\\s(\\|\\(\\w\\|\\s_\\)+:" |
411 |
"*Lines starting with this regular expression are not auto-indented." |
"*Lines starting with this regular expression are not auto-indented." |
412 |
:type 'regexp |
:type 'regexp) |
|
:group 'perl) |
|
413 |
|
|
414 |
;;;###autoload |
;;;###autoload |
415 |
(defun perl-mode () |
(defun perl-mode () |
884 |
(or arg (setq arg 1)) |
(or arg (setq arg 1)) |
885 |
(let ((first t)) |
(let ((first t)) |
886 |
(while (and (> arg 0) (< (point) (point-max))) |
(while (and (> arg 0) (< (point) (point-max))) |
887 |
(let ((pos (point)) npos) |
(let ((pos (point))) |
888 |
(while (progn |
(while (progn |
889 |
(if (and first |
(if (and first |
890 |
(progn |
(progn |