]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve non-interactive use of whitespace reporting
authorReuben Thomas <rrt@sc3d.org>
Thu, 29 May 2014 22:51:47 +0000 (23:51 +0100)
committerReuben Thomas <rrt@sc3d.org>
Thu, 29 May 2014 22:51:47 +0000 (23:51 +0100)
  whitespace.el (whitespace-report-region): Allow report-if-bogus to take
  the value `never', for non-interactive use.

lisp/ChangeLog
lisp/whitespace.el

index 12b194483ffb13dc17db2727662e5e13304cc534..a94f977e75521ccf6ec2f2075f0a6123462d27db 100644 (file)
@@ -2,6 +2,8 @@
 
        * whitespace.el (whitespace-report-region): Simplify
        documentation.
+       (whitespace-report-region): Allow report-if-bogus to take the
+       value `never', for non-interactive use.
        (whitespace-report): Refer to whitespace-report-region's
        documentation.
 
index c67733623dcfa8413b5b75b72066fec00444ac7a..917f0432ef2b11475c9b99affc54d67916392461 100644 (file)
@@ -1737,13 +1737,14 @@ before calling `whitespace-report-region' interactively, it
 forces `whitespace-style' to have:
 
    empty
+   trailing
    indentation
    space-before-tab
-   trailing
    space-after-tab
 
-If REPORT-IF-BOGUS is non-nil, it reports only when there are any
-whitespace problems in buffer.
+If REPORT-IF-BOGUS is t, it reports only when there are any
+whitespace problems in buffer; if it is `never', it does not
+report problems.
 
 Report if some of the following whitespace problems exist:
 
@@ -1798,7 +1799,7 @@ cleaning up these problems."
                     (and (re-search-forward regexp rend t)
                          (setq has-bogus t))))
               whitespace-report-list)))
-       (when (if report-if-bogus has-bogus t)
+       (when (pcase report-if-bogus (`nil t) (`never nil) (_ has-bogus))
          (whitespace-kill-buffer whitespace-report-buffer-name)
          ;; `whitespace-indent-tabs-mode' is local to current buffer
          ;; `whitespace-tab-width' is local to current buffer