Function: checkdoc--error-bad-format-p

checkdoc--error-bad-format-p is a byte-compiled function defined in checkdoc.el.gz.

Signature

(checkdoc--error-bad-format-p)

Documentation

Return non-nil if the start of error message at point has the wrong format.

The correct format is "Foo" or "some-symbol: Foo". See also error and Info node (elisp) Documentation Tips.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/checkdoc.el.gz
(defun checkdoc--error-bad-format-p ()
  "Return non-nil if the start of error message at point has the wrong format.
The correct format is \"Foo\" or \"some-symbol: Foo\".  See also
`error' and Info node `(elisp) Documentation Tips'."
  (save-excursion
    ;; Skip the first quote character in string.
    (forward-char 1)
    ;; A capital letter is always okay.
    (unless (let ((case-fold-search nil))
              (looking-at (rx (or upper-case "%s"))))
      ;; A defined Lisp symbol is always okay.
      (unless (and (looking-at (rx (group lisp-mode-symbol)))
                   (or (fboundp (intern (match-string 1)))
                       (boundp (intern (match-string 1)))))
        ;; Other Lisp symbols are sometimes okay.
        (rx-let ((c (? "\\\n")))        ; `c' is for a continued line
          (let ((case-fold-search nil)
                (some-symbol (rx lisp-mode-symbol
                                 c ":" c (+ (any " \t\n"))))
                (lowercase-str (rx c (group (any "a-z") (+ wordchar)))))
            (if (looking-at some-symbol)
                (looking-at (concat some-symbol lowercase-str))
              (looking-at lowercase-str))))))))