Function: perl-indent-exp
perl-indent-exp is an interactive and byte-compiled function defined
in perl-mode.el.gz.
Signature
(perl-indent-exp)
Documentation
Indent each line of the Perl grouping following point.
Key Bindings
Aliases
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/perl-mode.el.gz
(defun perl-indent-exp ()
"Indent each line of the Perl grouping following point."
(interactive)
(let* ((case-fold-search nil)
(oldpnt (point-marker))
(bof-mark (save-excursion
(end-of-line 2)
(perl-beginning-of-function)
(point-marker)))
eol last-mark lsexp-mark delta)
(if (= (char-after (marker-position bof-mark)) ?=)
(message "Can't indent a format statement")
(message "Indenting Perl expression...")
(setq eol (line-end-position))
(save-excursion ; locate matching close paren
(while (and (not (eobp)) (<= (point) eol))
(parse-partial-sexp (point) (point-max) 0))
(setq last-mark (point-marker)))
(setq lsexp-mark bof-mark)
(beginning-of-line)
(while (< (point) (marker-position last-mark))
(setq delta (perl-indent-line nil))
(if (numberp delta) ; unquoted start-of-line?
(progn
(if (eolp)
(delete-horizontal-space))
(setq lsexp-mark (point-marker))))
(end-of-line)
(setq eol (point))
(if (nth 4 (parse-partial-sexp (marker-position lsexp-mark) eol))
(progn ; line ends in a comment
(beginning-of-line)
(if (or (not (looking-at "\\s-*;?#"))
(listp delta)
(and (/= 0 delta)
(= (- (current-indentation) delta) comment-column)))
(if (and comment-start-skip
(re-search-forward comment-start-skip eol t))
(indent-for-comment))))) ; indent existing comment
(forward-line 1))
(goto-char (marker-position oldpnt))
(message "Indenting Perl expression...done"))))