Function: perl-mode
perl-mode is an autoloaded, interactive and byte-compiled function
defined in perl-mode.el.gz.
Signature
(perl-mode)
Documentation
Major mode for editing Perl code.
Expression and list commands understand all Perl brackets.
Tab indents for Perl code.
Comments are delimited with # ... \n.
Paragraphs are separated by blank lines only.
Delete converts tabs to spaces as it moves back.
C-M-a perl-beginning-of-function
C-M-e perl-end-of-function
C-M-h perl-mark-function
C-M-q perl-indent-exp
DEL backward-delete-char-untabify
Variables controlling indentation style:
perl-tab-always-indent
Non-nil means TAB in Perl mode should always indent the current line,
regardless of where in the line point is when the TAB command is used.
perl-tab-to-comment
Non-nil means that for lines which don't need indenting, TAB will
either delete an empty comment, indent an existing comment, move
to end-of-line, or if at end-of-line already, create a new comment.
perl-nochange
Lines starting with this regular expression are not auto-indented.
perl-indent-level
Indentation of Perl statements within surrounding block.
The surrounding block's indentation is the indentation
of the line on which the open-brace appears.
perl-continued-statement-offset
Extra indentation given to a substatement, such as the
then-clause of an if or body of a while.
perl-continued-brace-offset
Extra indentation given to a brace that starts a substatement.
This is in addition to perl-continued-statement-offset.
perl-brace-offset
Extra indentation for line if it starts with an open brace.
perl-brace-imaginary-offset
An open brace following other text is treated as if it were
this far to the right of the start of its line.
perl-label-offset
Extra indentation for line that is a label.
perl-indent-continued-arguments
Offset of argument lines relative to usual indentation.
Various indentation styles: K&R BSD BLK GNU LW
perl-indent-level 5 8 0 2 4
perl-continued-statement-offset 5 8 4 2 4
perl-continued-brace-offset 0 0 0 0 -4
perl-brace-offset -5 -8 0 0 0
perl-brace-imaginary-offset 0 0 4 0 0
perl-label-offset -5 -8 -2 -2 -2
Turning on Perl mode runs the normal hook perl-mode-hook.
Probably introduced at or before Emacs version 19.29.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/perl-mode.el.gz
;;;###autoload
(define-derived-mode perl-mode prog-mode "Perl"
"Major mode for editing Perl code.
Expression and list commands understand all Perl brackets.
Tab indents for Perl code.
Comments are delimited with # ... \\n.
Paragraphs are separated by blank lines only.
Delete converts tabs to spaces as it moves back.
\\{perl-mode-map}
Variables controlling indentation style:
`perl-tab-always-indent'
Non-nil means TAB in Perl mode should always indent the current line,
regardless of where in the line point is when the TAB command is used.
`perl-tab-to-comment'
Non-nil means that for lines which don't need indenting, TAB will
either delete an empty comment, indent an existing comment, move
to end-of-line, or if at end-of-line already, create a new comment.
`perl-nochange'
Lines starting with this regular expression are not auto-indented.
`perl-indent-level'
Indentation of Perl statements within surrounding block.
The surrounding block's indentation is the indentation
of the line on which the open-brace appears.
`perl-continued-statement-offset'
Extra indentation given to a substatement, such as the
then-clause of an if or body of a while.
`perl-continued-brace-offset'
Extra indentation given to a brace that starts a substatement.
This is in addition to `perl-continued-statement-offset'.
`perl-brace-offset'
Extra indentation for line if it starts with an open brace.
`perl-brace-imaginary-offset'
An open brace following other text is treated as if it were
this far to the right of the start of its line.
`perl-label-offset'
Extra indentation for line that is a label.
`perl-indent-continued-arguments'
Offset of argument lines relative to usual indentation.
Various indentation styles: K&R BSD BLK GNU LW
perl-indent-level 5 8 0 2 4
perl-continued-statement-offset 5 8 4 2 4
perl-continued-brace-offset 0 0 0 0 -4
perl-brace-offset -5 -8 0 0 0
perl-brace-imaginary-offset 0 0 4 0 0
perl-label-offset -5 -8 -2 -2 -2
Turning on Perl mode runs the normal hook `perl-mode-hook'."
:abbrev-table perl-mode-abbrev-table
(setq-local paragraph-start (concat "$\\|" page-delimiter))
(setq-local paragraph-separate paragraph-start)
(setq-local paragraph-ignore-fill-prefix t)
(setq-local indent-line-function #'perl-indent-line)
(setq-local comment-start "# ")
(setq-local comment-end "")
(setq-local comment-start-skip "\\(^\\|\\s-\\);?#+ *")
(setq-local comment-indent-function #'perl-comment-indent)
(setq-local parse-sexp-ignore-comments t)
;; Tell font-lock.el how to handle Perl.
(setq font-lock-defaults '((perl-font-lock-keywords
perl-font-lock-keywords-1
perl-font-lock-keywords-2)
nil nil ((?\_ . "w")) nil
(font-lock-syntactic-face-function
. perl-font-lock-syntactic-face-function)))
(setq-local prettify-symbols-alist perl--prettify-symbols-alist)
(setq-local syntax-propertize-function #'perl-syntax-propertize-function)
(add-hook 'syntax-propertize-extend-region-functions
#'syntax-propertize-multiline 'append 'local)
;; Electricity.
;; FIXME: setup electric-layout-rules.
(setq-local electric-indent-chars
(append '(?\{ ?\} ?\; ?\:) electric-indent-chars))
(add-hook 'electric-indent-functions #'perl-electric-noindent-p nil t)
;; Tell imenu how to handle Perl.
(setq-local imenu-generic-expression perl-imenu-generic-expression)
(setq imenu-case-fold-search nil)
;; Setup outline-minor-mode.
(setq-local outline-regexp perl-outline-regexp)
(setq-local outline-level 'perl-outline-level)
(setq-local add-log-current-defun-function #'perl-current-defun-name)
;; Setup Flymake
(add-hook 'flymake-diagnostic-functions #'perl-flymake nil t))