]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow checkdoc to be called in batch
authorOleh Krehel <ohwoeowho@gmail.com>
Mon, 18 May 2015 08:07:03 +0000 (10:07 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Mon, 18 May 2015 08:07:03 +0000 (10:07 +0200)
* lisp/emacs-lisp/checkdoc.el (checkdoc-error): When `noninteractive'
  is non-nil, echo the error with `warn'.

How it can be used in -batch:

(with-current-buffer (find-file "checkdoc.el")
  (checkdoc-current-buffer t))

lisp/emacs-lisp/checkdoc.el

index 777fed082d9b7b04ce5e6232de0ba8f1863a9e2b..b3ef44a5a1cd33b43bef27d1af30377fcae1a7fb 100644 (file)
@@ -2613,9 +2613,12 @@ function called to create the messages."
                     (count-lines (point-min) (or point (point-min))))
                    ": " msg)))
     (with-current-buffer (get-buffer checkdoc-diagnostic-buffer)
-      (goto-char (point-max))
-      (let ((inhibit-read-only t))
-        (apply #'insert text)))))
+      (let ((inhibit-read-only t)
+            (pt (point-max)))
+        (goto-char pt)
+        (apply #'insert text)
+        (when noninteractive
+          (warn (buffer-substring pt (point-max))))))))
 
 (defun checkdoc-show-diagnostics ()
   "Display the checkdoc diagnostic buffer in a temporary window."