Function: f90-beginning-of-block
f90-beginning-of-block is an interactive and byte-compiled function
defined in f90.el.gz.
Signature
(f90-beginning-of-block &optional NUM)
Documentation
Move point backwards to the start of the current code block.
With optional argument NUM, go backward that many balanced blocks. If NUM is negative, go forward to the end of a block. Checks for consistency of block types and labels (if present). Does not check the outermost block, because it may be incomplete. Interactively, pushes mark before moving point.
Probably introduced at or before Emacs version 22.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/f90.el.gz
(defun f90-beginning-of-block (&optional num)
"Move point backwards to the start of the current code block.
With optional argument NUM, go backward that many balanced blocks.
If NUM is negative, go forward to the end of a block.
Checks for consistency of block types and labels (if present).
Does not check the outermost block, because it may be incomplete.
Interactively, pushes mark before moving point."
(interactive "p")
(if (called-interactively-p 'any) (push-mark (point) t))
(and num (< num 0) (f90-end-of-block (- num)))
(let ((case-fold-search t)
(count (or num 1))
end-list end-this end-type end-label
start-this start-type start-label)
(beginning-of-line) ; probably want this
(while (and (> count 0) (re-search-backward f90-blocks-re nil 'move))
(beginning-of-line)
(skip-chars-forward " \t0-9")
(cond ((or (f90-in-string) (f90-in-comment)))
((looking-at (concat "end[ \t]*" f90-blocks-re
"[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?"))
(setq end-list (cons (list (match-string 1) (match-string 2))
end-list)
count (1+ count)))
((setq start-this
(or
(f90-looking-at-do)
(f90-looking-at-select-case)
(f90-looking-at-type-like)
(f90-looking-at-associate)
(f90-looking-at-critical)
(f90-looking-at-program-block-start)
(f90-looking-at-if-then)
(f90-looking-at-where-or-forall)))
(setq start-type (car start-this)
start-label (cadr start-this)
count (1- count))
;; Check any internal blocks.
(when end-list
(setq end-this (car end-list)
end-list (cdr end-list)
end-type (car end-this)
end-label (cadr end-this))
(or (f90-equal-symbols start-type end-type)
(error "Start type `%s' does not match end type `%s'"
start-type end-type))
(or (f90-equal-symbols start-label end-label)
(error "Start label `%s' does not match end label `%s'"
start-label end-label))))))
;; Includes an un-named main program block.
(if (> count 0) (error "Missing block start"))))