Function: checkdoc-in-sample-code-p
checkdoc-in-sample-code-p is a byte-compiled function defined in
checkdoc.el.gz.
Signature
(checkdoc-in-sample-code-p START LIMIT)
Documentation
Return non-nil if the current point is in a code fragment.
A code fragment is identified by an open parenthesis followed by a symbol which is a valid function or a word in all CAPS, or a parenthesis that is quoted with the ' character. Only the region from START to LIMIT is allowed while searching for the bounding parenthesis.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/checkdoc.el.gz
(defun checkdoc-in-sample-code-p (start limit)
"Return non-nil if the current point is in a code fragment.
A code fragment is identified by an open parenthesis followed by a
symbol which is a valid function or a word in all CAPS, or a parenthesis
that is quoted with the \\=' character. Only the region from START to LIMIT
is allowed while searching for the bounding parenthesis."
(save-match-data
(save-restriction
(narrow-to-region start limit)
(save-excursion
(and (condition-case nil (progn (up-list 1) t) (error nil))
(condition-case nil (progn (forward-list -1) t) (error nil))
(or (save-excursion (forward-char -1) (looking-at "'("))
(and (looking-at "(\\(\\(\\w\\|[-:_]\\)+\\)[ \t\n;]")
(let ((ms (buffer-substring-no-properties
(match-beginning 1) (match-end 1))))
;; if this string is function bound, we are in
;; sample code. If it has a - or : character in
;; the name, then it is probably supposed to be bound
;; but isn't yet.
(or (fboundp (intern-soft ms))
(let ((case-fold-search nil))
(string-match "^[A-Z-]+$" ms))
(string-match "\\w[-:_]+\\w" ms))))))))))