Function: pascal-get-lineup-indent

pascal-get-lineup-indent is a byte-compiled function defined in pascal.el.gz.

Signature

(pascal-get-lineup-indent B E STR)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/pascal.el.gz
;  "Return the indent level that will line up several lines within the region
;from b to e nicely. The lineup string is str."
(defun pascal-get-lineup-indent (b e str)
  (save-excursion
    (let ((pascal--extra-indent 0)
	  (reg (concat str "\\|\\(\\<record\\>\\)\\|" pascal-defun-re)))
      (goto-char b)
      ;; Get rightmost position
      (while (< (point) e)
        (and (re-search-forward reg (min e (line-end-position 2)) 'move)
	     (cond ((match-beginning 1)
		    ;; Skip record blocks
		    (pascal-declaration-end))
		   ((match-beginning 2)
		    ;; We have entered a new procedure.  Exit.
		    (goto-char e))
		   (t
		    (goto-char (match-beginning 0))
		    (skip-chars-backward " \t")
		    (if (> (current-column) pascal--extra-indent)
			(setq pascal--extra-indent (current-column)))
		    (goto-char (match-end 0))
		    (end-of-line)
		    ))))
      ;; In case no lineup was found
      (if (> pascal--extra-indent 0)
	  (1+ pascal--extra-indent)
	;; No lineup-string found
	(goto-char b)
	(end-of-line)
	(skip-chars-backward " \t")
	(1+ (current-column))))))