Function: f90-get-correct-indent

f90-get-correct-indent is a byte-compiled function defined in f90.el.gz.

Signature

(f90-get-correct-indent)

Documentation

Get correct indent for a line starting with line number.

Does not check type and subprogram indentation.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/f90.el.gz
(defun f90-get-correct-indent ()
  "Get correct indent for a line starting with line number.
Does not check type and subprogram indentation."
  (let ((epnt (line-end-position)) icol)
    (save-excursion
      (while (and (f90-previous-statement)
                  (or (memq (f90-present-statement-cont) '(middle end))
                      (looking-at "[ \t]*[0-9]"))))
      (setq icol (current-indentation))
      (beginning-of-line)
      (when (re-search-forward "\\(if\\|do\\|select\\|where\\|forall\\)"
                               (line-end-position) t)
        (beginning-of-line)
        (skip-chars-forward " \t")
        (cond ((f90-looking-at-do)
               (setq icol (+ icol f90-do-indent)))
              ((or (f90-looking-at-if-then)
                   (f90-looking-at-where-or-forall)
                   (f90-looking-at-select-case))
               (setq icol (+ icol f90-if-indent)))
              ;; FIXME this makes no sense, because this section/function is
              ;; only for if/do/select/where/forall ?
              ((f90-looking-at-associate)
               (setq icol (+ icol f90-associate-indent))))
        (end-of-line))
      (while (re-search-forward
              "\\(if\\|do\\|select\\|where\\|forall\\)" epnt t)
        (beginning-of-line)
        (skip-chars-forward " \t0-9")
        (cond ((f90-looking-at-do)
               (setq icol (+ icol f90-do-indent)))
              ((or (f90-looking-at-if-then)
                   (f90-looking-at-where-or-forall)
                   (f90-looking-at-select-case))
               (setq icol (+ icol f90-if-indent)))
              ;; FIXME this makes no sense, because this section/function is
              ;; only for if/do/select/where/forall ?
              ((f90-looking-at-associate)
               (setq icol (+ icol f90-associate-indent)))
              ((looking-at f90-end-if-re)
               (setq icol (- icol f90-if-indent)))
              ((looking-at f90-end-associate-re)
               (setq icol (- icol f90-associate-indent)))
              ((f90-looking-at-end-critical)
               (setq icol (- icol f90-critical-indent)))
              ((looking-at "end[ \t]*do\\_>")
               (setq icol (- icol f90-do-indent))))
        (end-of-line))
      icol)))