Function: pascal-indent-declaration
pascal-indent-declaration is a byte-compiled function defined in
pascal.el.gz.
Signature
(pascal-indent-declaration &optional ARG START END)
Documentation
Indent current lines as declaration, lining up the :s or =s.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/pascal.el.gz
(defun pascal-indent-declaration (&optional arg start end)
"Indent current lines as declaration, lining up the `:'s or `='s."
(let ((pos (point-marker)))
(if (and (not (or arg start)) (not (pascal-declaration-beg)))
()
(let ((lineup (if (or (looking-at "\\<var\\>\\|\\<record\\>") arg start)
":" "="))
(stpos (if start start
(forward-word-strictly 2) (backward-word 1) (point)))
(edpos (set-marker (make-marker)
(if end end
(max (progn (pascal-declaration-end)
(point))
pos))))
pascal--extra-indent)
(goto-char stpos)
;; Indent lines in record block
(if arg
(while (<= (point) edpos)
(beginning-of-line)
(delete-horizontal-space)
(if (looking-at "end\\>")
(indent-to arg)
(indent-to (+ arg pascal-indent-level)))
(forward-line 1)))
;; Do lineup
(setq pascal--extra-indent (pascal-get-lineup-indent stpos edpos lineup))
(goto-char stpos)
(while (and (<= (point) edpos) (not (eobp)))
(if (search-forward lineup (point-at-eol) 'move)
(forward-char -1))
(delete-horizontal-space)
(indent-to pascal--extra-indent)
(if (not (looking-at lineup))
(forward-line 1) ; No more indent if there is no : or =
(forward-char 1)
(delete-horizontal-space)
(insert " ")
;; Indent record block
(if (looking-at "record\\>")
(pascal-indent-declaration (current-column)))
(forward-line 1)))))
;; If arg - move point
(if arg (forward-line -1)
(goto-char pos))))