Function: pascal-beg-of-defun
pascal-beg-of-defun is an interactive and byte-compiled function
defined in pascal.el.gz.
Signature
(pascal-beg-of-defun)
Documentation
Move backward to the beginning of the current function or procedure.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/pascal.el.gz
(defun pascal-beg-of-defun ()
"Move backward to the beginning of the current function or procedure."
(interactive)
(catch 'found
(if (not (looking-at (concat "\\s \\|\\s)\\|" pascal-defun-re)))
(ignore-errors (forward-sexp 1)))
(let ((nest 0) (max -1) (func 0)
(reg (concat pascal-beg-block-re "\\|"
pascal-end-block-re "\\|"
pascal-defun-re)))
(while (re-search-backward reg nil 'move)
(cond ((let ((state (save-excursion
(parse-partial-sexp (point-min) (point)))))
(or (nth 3 state) (nth 4 state))) ; Inside string or comment
())
((match-end 1) ; begin|case|record|repeat
(if (and (looking-at "\\<record\\>") (>= max 0))
(setq func (1- func)))
(setq nest (1+ nest)
max (max nest max)))
((match-end 2) ; end|until
(if (and (= nest max) (>= max 0))
(setq func (1+ func)))
(setq nest (1- nest)))
((match-end 3) ; function|procedure
(if (= 0 func)
(throw 'found t)
(setq func (1- func)))))))
nil))