Function: checkdoc-rogue-space-check-engine
checkdoc-rogue-space-check-engine is a byte-compiled function defined
in checkdoc.el.gz.
Signature
(checkdoc-rogue-space-check-engine &optional START END INTERACT)
Documentation
Return a message list if there is a line with white space at the end.
If checkdoc-autofix-flag permits, delete that whitespace instead.
If optional arguments START and END are non-nil, bound the check to
this region.
Optional argument INTERACT may permit the user to fix problems on the fly.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/checkdoc.el.gz
nil)))) ;; err
;;; Rogue space checking engine
;;
(defun checkdoc-rogue-space-check-engine (&optional start end interact)
"Return a message list if there is a line with white space at the end.
If `checkdoc-autofix-flag' permits, delete that whitespace instead.
If optional arguments START and END are non-nil, bound the check to
this region.
Optional argument INTERACT may permit the user to fix problems on the fly."
(let ((p (point))
(msg nil) s e (f nil))
(if (not start) (setq start (point-min)))
;; If end is nil, it means end of buffer to search anyway
(or
;; Check for an error if `? ' or `?\ ' is used at the end of a line.
;; (It's dangerous)
(progn
(goto-char start)
(while (and (not msg) (re-search-forward "\\?\\\\?[ \t][ \t]*$" end t))
(setq msg
"Don't use `? ' at the end of a line. \
News agents may remove it"
s (match-beginning 0) e (match-end 0) f t)
;; If interactive is passed down, give them a chance to fix things.
(if (and interact (y-or-n-p (concat msg ". Fix?")))
(progn
(checkdoc-recursive-edit msg)
(setq msg nil)
(goto-char s)
(beginning-of-line)))))
;; Check for, and potentially remove whitespace appearing at the
;; end of different lines.
(progn
(goto-char start)
;; There is no documentation in the Emacs Lisp manual about this check,
;; it is intended to help clean up messy code and reduce the file size.
(while (and (not msg) (re-search-forward "[^ \t\n;]\\([ \t]+\\)$" end t))
;; This is not a complex activity
(if (checkdoc-autofix-ask-replace
(match-beginning 1) (match-end 1)
"White space at end of line. Remove?" "")
nil
(setq msg "White space found at end of line"
s (match-beginning 1) e (match-end 1))))))
;; Return an error and leave the cursor at that spot, or restore
;; the cursor.
(if msg
(checkdoc-create-error msg s e f)
(goto-char p)
nil)))