Function: checkdoc--fix-y-or-n-p

checkdoc--fix-y-or-n-p is a byte-compiled function defined in checkdoc.el.gz.

Signature

(checkdoc--fix-y-or-n-p)

Documentation

Fix y-or-n-p prompt to end with "?" or "? ".

The space is technically redundant, but also more compatible with Emacs versions before Emacs 24.1. In the future, we might treat a space as a style error.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/checkdoc.el.gz
(defun checkdoc--fix-y-or-n-p ()
  "Fix `y-or-n-p' prompt to end with \"?\" or \"? \".
The space is technically redundant, but also more compatible with
Emacs versions before Emacs 24.1.  In the future, we might treat
a space as a style error."
  (when (and (save-excursion (forward-sexp 1)
                             (forward-char -3)
                             (not (looking-at "\\? ")))
             (save-excursion (forward-sexp 1)
                             (forward-char -2)
                             (not (looking-at "\\?"))))
    (if (and
         (save-excursion (forward-sexp 1)
                         (forward-char -1)
                         (looking-at "\""))
         (checkdoc-autofix-ask-replace
          (match-beginning 0) (match-end 0)
          (format-message
           "`y-or-n-p' argument should end with \"?\".  Fix?")
          "?\"" t))
        nil
      (checkdoc-create-error
       "`y-or-n-p' argument should end with \"?\""
       (match-beginning 0) (match-end 0)))))