Function: f90-match-end
f90-match-end is an interactive and byte-compiled function defined in
f90.el.gz.
Signature
(f90-match-end)
Documentation
From an end block statement, find the corresponding block and name.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/f90.el.gz
(defun f90-match-end ()
"From an end block statement, find the corresponding block and name."
(interactive)
(let ((count 1)
(top-of-window (window-start))
(end-point (point))
(case-fold-search t)
matching-beg beg-name end-name beg-block end-block end-struct)
;; Check if in string in case using non-standard feature where
;; continued strings do not need "&" at start of continuations.
(when (save-excursion (beginning-of-line) (skip-chars-forward " \t0-9")
(unless (f90-in-string)
(setq end-struct
(f90-looking-at-program-block-end))))
(setq end-block (car end-struct)
end-name (cadr end-struct))
(save-excursion
(beginning-of-line)
(while (and (> count 0)
(not (= (line-beginning-position) (point-min))))
(re-search-backward f90-blocks-re nil 'move)
(beginning-of-line)
;; GM not a line number if continued line.
;;; (skip-chars-forward " \t")
;;; (skip-chars-forward "0-9")
(skip-chars-forward " \t0-9")
(cond ((or (f90-in-string) (f90-in-comment)))
((setq matching-beg
(or
(f90-looking-at-do)
(f90-looking-at-if-then)
(f90-looking-at-where-or-forall)
(f90-looking-at-select-case)
(f90-looking-at-type-like)
(f90-looking-at-associate)
(f90-looking-at-critical)
(f90-looking-at-program-block-start)
;; Interpret a single END without a block
;; start to be the END of a program block
;; without an initial PROGRAM line.
(if (= (line-beginning-position) (point-min))
'("program" nil))))
(setq count (1- count)))
((looking-at (concat "end[ \t]*" f90-blocks-re))
(setq count (1+ count)))))
(if (> count 0)
(message "No matching beginning.")
(f90-update-line)
(if (eq f90-smart-end 'blink)
(if (< (point) top-of-window)
(message "Matches %s: %s"
(what-line)
(buffer-substring
(line-beginning-position)
(line-end-position)))
(sit-for blink-matching-delay)))
(setq beg-block (car matching-beg)
beg-name (cadr matching-beg))
(goto-char end-point)
(beginning-of-line)
(f90-block-match beg-block beg-name end-block end-name))))))