aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleh Krehel2015-06-08 08:30:32 +0200
committerOleh Krehel2015-06-08 08:33:21 +0200
commitc941d479322f8cc267908f19118f8558ea034259 (patch)
treedc7c51dfbd8f76574cdb11bbd4614476073c0f0d
parentc876b73a8f7a39fd59dea611fbd8c28a3b24bb64 (diff)
downloademacs-c941d479322f8cc267908f19118f8558ea034259.tar.gz
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)
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/emacs-lisp/checkdoc.el27
2 files changed, 21 insertions, 10 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 89528690e40..51d0a5f4fec 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -84,6 +84,10 @@ command line when `initial-buffer-choice' is non-nil.
84 84
85* Changes in Emacs 25.1 85* Changes in Emacs 25.1
86 86
87** New function `checkdoc-file' checks for style errors.
88It's meant for use together with `compile':
89emacs -batch --eval "(checkdoc-file \"subr.el\")"
90
87** New command `comment-line' bound to `C-x C-;'. 91** New command `comment-line' bound to `C-x C-;'.
88 92
89** New function `custom-prompt-customize-unsaved-options' checks for 93** New function `custom-prompt-customize-unsaved-options' checks for
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."
871 (message "Checking buffer for style...Done.")))) 871 (message "Checking buffer for style...Done."))))
872 872
873;;;###autoload 873;;;###autoload
874(defun checkdoc-file (file)
875 "Check FILE for document, comment, error style, and rogue spaces."
876 (with-current-buffer (find-file-noselect file)
877 (let ((checkdoc-diagnostic-buffer "*warn*"))
878 (checkdoc-current-buffer t))))
879
880;;;###autoload
874(defun checkdoc-start (&optional take-notes) 881(defun checkdoc-start (&optional take-notes)
875 "Start scanning the current buffer for documentation string style errors. 882 "Start scanning the current buffer for documentation string style errors.
876Only documentation strings are checked. 883Only documentation strings are checked.
@@ -2611,16 +2618,16 @@ function called to create the messages."
2611 "Store POINT and MSG as errors in the checkdoc diagnostic buffer." 2618 "Store POINT and MSG as errors in the checkdoc diagnostic buffer."
2612 (setq checkdoc-pending-errors t) 2619 (setq checkdoc-pending-errors t)
2613 (let ((text (list "\n" (checkdoc-buffer-label) ":" 2620 (let ((text (list "\n" (checkdoc-buffer-label) ":"
2614 (int-to-string 2621 (int-to-string
2615 (count-lines (point-min) (or point (point-min)))) 2622 (count-lines (point-min) (or point (point-min))))
2616 ": " msg))) 2623 ": " msg)))
2617 (with-current-buffer (get-buffer checkdoc-diagnostic-buffer) 2624 (if (string= checkdoc-diagnostic-buffer "*warn*")
2618 (let ((inhibit-read-only t) 2625 (warn (apply #'concat text))
2619 (pt (point-max))) 2626 (with-current-buffer (get-buffer checkdoc-diagnostic-buffer)
2620 (goto-char pt) 2627 (let ((inhibit-read-only t)
2621 (apply #'insert text) 2628 (pt (point-max)))
2622 (when noninteractive 2629 (goto-char pt)
2623 (warn (buffer-substring pt (point-max)))))))) 2630 (apply #'insert text))))))
2624 2631
2625(defun checkdoc-show-diagnostics () 2632(defun checkdoc-show-diagnostics ()
2626 "Display the checkdoc diagnostic buffer in a temporary window." 2633 "Display the checkdoc diagnostic buffer in a temporary window."