Function: fortran-check-for-matching-do

fortran-check-for-matching-do is a byte-compiled function defined in fortran.el.gz.

Signature

(fortran-check-for-matching-do)

Documentation

When called from a numbered statement, return t if matching DO is found.

Otherwise return nil.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/fortran.el.gz
(defun fortran-check-for-matching-do ()
  "When called from a numbered statement, return t if matching DO is found.
Otherwise return nil."
  (let ((case-fold-search t)
        charnum)
    (save-excursion
      (beginning-of-line)
      (when (looking-at "[ \t]*[0-9]+")
        (skip-chars-forward " \t")
        (skip-chars-forward "0")        ; skip past leading zeros
        (setq charnum
              (buffer-substring (point) (progn
                                          (skip-chars-forward "0-9")
                                          (point))))
        (beginning-of-line)
        (save-restriction
          (save-excursion
            (narrow-to-defun)
            (and (re-search-backward
                  (concat
                   "\\(^[ \t0-9]*do[ \t]*0*"
                   charnum "\\b\\)\\|" "\\(^[ \t]*0*"
                   charnum "\\b\\)")
                  nil t)
                 (looking-at
                  (concat "^[ \t0-9]*do[ \t]*0*"
                          charnum)))))))))