Function: lisp-string-in-doc-position-p

lisp-string-in-doc-position-p is a byte-compiled function defined in lisp-mode.el.gz.

Signature

(lisp-string-in-doc-position-p LISTBEG STARTPOS)

Documentation

Return non-nil if a doc string may occur at STARTPOS inside a list.

LISTBEG is the position of the start of the innermost list containing STARTPOS.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/lisp-mode.el.gz
(defun lisp-string-in-doc-position-p (listbeg startpos)
   "Return non-nil if a doc string may occur at STARTPOS inside a list.
LISTBEG is the position of the start of the innermost list
containing STARTPOS."
  (let* ((firstsym (and listbeg
                        (save-excursion
                          (goto-char listbeg)
                          (and (looking-at
                                (eval-when-compile
                                  (concat "([ \t\n]*\\("
                                          lisp-mode-symbol-regexp "\\)")))
                               (match-string 1)))))
         (docelt (and firstsym
                      (function-get (intern-soft firstsym)
                                    lisp-doc-string-elt-property))))
    (and docelt
         ;; It's a string in a form that can have a docstring.
         ;; Check whether it's in docstring position.
         (save-excursion
           (when (functionp docelt)
             (goto-char (match-end 1))
             (setq docelt (funcall docelt)))
           (goto-char listbeg)
           (forward-char 1)
           (condition-case nil
               (while (and (> docelt 0) (< (point) startpos)
                           (progn (forward-sexp 1) t))
                 (setq docelt (1- docelt)))
             (error nil))
           (and (zerop docelt) (<= (point) startpos)
                (progn (forward-comment (point-max)) t)
                (= (point) startpos))))))