diff options
author | Oleh Krehel <ohwoeowho@gmail.com> | 2015-06-08 08:30:32 +0200 |
---|---|---|
committer | Oleh Krehel <ohwoeowho@gmail.com> | 2015-06-08 08:33:21 +0200 |
commit | c941d479322f8cc267908f19118f8558ea034259 (patch) | |
tree | dc7c51dfbd8f76574cdb11bbd4614476073c0f0d /lisp/emacs-lisp/checkdoc.el | |
parent | c876b73a8f7a39fd59dea611fbd8c28a3b24bb64 (diff) | |
download | emacs-c941d479322f8cc267908f19118f8558ea034259.tar.gz emacs-c941d479322f8cc267908f19118f8558ea034259.tar.bz2 emacs-c941d479322f8cc267908f19118f8558ea034259.zip |
checkdoc.el (checkdoc-file): New function
* lisp/emacs-lisp/checkdoc.el (checkdoc-error): When
`checkdoc-diagnostic-buffer' is set to "*warn*", print the warning
to the standard output.
(bug#20754)
Diffstat (limited to 'lisp/emacs-lisp/checkdoc.el')
-rw-r--r-- | lisp/emacs-lisp/checkdoc.el | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 4761ac5e6fc..869ae431950 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -871,6 +871,13 @@ otherwise stop after the first error." (message "Checking buffer for style...Done.")))) ;;;###autoload +(defun checkdoc-file (file) + "Check FILE for document, comment, error style, and rogue spaces." + (with-current-buffer (find-file-noselect file) + (let ((checkdoc-diagnostic-buffer "*warn*")) + (checkdoc-current-buffer t)))) + +;;;###autoload (defun checkdoc-start (&optional take-notes) "Start scanning the current buffer for documentation string style errors. Only documentation strings are checked. @@ -2611,16 +2618,16 @@ function called to create the messages." "Store POINT and MSG as errors in the checkdoc diagnostic buffer." (setq checkdoc-pending-errors t) (let ((text (list "\n" (checkdoc-buffer-label) ":" - (int-to-string - (count-lines (point-min) (or point (point-min)))) - ": " msg))) - (with-current-buffer (get-buffer checkdoc-diagnostic-buffer) - (let ((inhibit-read-only t) - (pt (point-max))) - (goto-char pt) - (apply #'insert text) - (when noninteractive - (warn (buffer-substring pt (point-max)))))))) + (int-to-string + (count-lines (point-min) (or point (point-min)))) + ": " msg))) + (if (string= checkdoc-diagnostic-buffer "*warn*") + (warn (apply #'concat text)) + (with-current-buffer (get-buffer checkdoc-diagnostic-buffer) + (let ((inhibit-read-only t) + (pt (point-max))) + (goto-char pt) + (apply #'insert text)))))) (defun checkdoc-show-diagnostics () "Display the checkdoc diagnostic buffer in a temporary window." |