Function: beginning-of-defun-comments
beginning-of-defun-comments is an interactive and byte-compiled
function defined in lisp.el.gz.
Signature
(beginning-of-defun-comments &optional ARG)
Documentation
Move to the beginning of ARGth defun, including comments.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/lisp.el.gz
(defun beginning-of-defun-comments (&optional arg)
"Move to the beginning of ARGth defun, including comments."
(interactive "^p")
(unless arg (setq arg 1))
(beginning-of-defun arg)
(let (first-line-p)
(while (let ((ppss (progn (setq first-line-p (= (forward-line -1) -1))
(syntax-ppss (line-end-position)))))
(while (and (nth 4 ppss) ; If eol is in a line-spanning comment,
(< (nth 8 ppss) (line-beginning-position)))
(goto-char (nth 8 ppss)) ; skip to comment start.
(setq ppss (syntax-ppss (line-end-position))))
(and (not first-line-p)
(progn (skip-syntax-backward
"-" (line-beginning-position))
(not (bolp))) ; Check for blank line.
(beginning-of-defun--in-emptyish-line-p)))) ; Check for non-comment text.
(forward-line (if first-line-p 0 1))))