From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Reuben Thomas Newsgroups: gmane.emacs.bugs Subject: bug#13837: 24.2; Make it possible to turn whitespace-mode only when there are no existing problems Date: Thu, 29 May 2014 20:02:49 +0100 Message-ID: References: <878v69fn8q.fsf@sc3d.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c377b838d8e104fa8e93d4 X-Trace: ger.gmane.org 1401390205 17110 80.91.229.3 (29 May 2014 19:03:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 29 May 2014 19:03:25 +0000 (UTC) Cc: 13837@debbugs.gnu.org, Dmitry Gutov To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 29 21:03:18 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wq5bg-0007ko-Eb for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 May 2014 21:03:16 +0200 Original-Received: from localhost ([::1]:49785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wq5bf-0007hD-TA for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 May 2014 15:03:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wq5bX-0007bW-8x for bug-gnu-emacs@gnu.org; Thu, 29 May 2014 15:03:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wq5bS-00006a-Ap for bug-gnu-emacs@gnu.org; Thu, 29 May 2014 15:03:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37544) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wq5bS-00006S-8Q for bug-gnu-emacs@gnu.org; Thu, 29 May 2014 15:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Wq5bR-0006Ty-Lf for bug-gnu-emacs@gnu.org; Thu, 29 May 2014 15:03:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <878v69fn8q.fsf@sc3d.org> Resent-From: Reuben Thomas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 May 2014 19:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13837 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13837-submit@debbugs.gnu.org id=B13837.140139017924906 (code B ref 13837); Thu, 29 May 2014 19:03:01 +0000 Original-Received: (at 13837) by debbugs.gnu.org; 29 May 2014 19:02:59 +0000 Original-Received: from localhost ([127.0.0.1]:36421 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wq5bO-0006Tc-6E for submit@debbugs.gnu.org; Thu, 29 May 2014 15:02:58 -0400 Original-Received: from mail-lb0-f179.google.com ([209.85.217.179]:45780) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wq5bL-0006TI-Bq for 13837@debbugs.gnu.org; Thu, 29 May 2014 15:02:56 -0400 Original-Received: by mail-lb0-f179.google.com with SMTP id c11so433721lbj.38 for <13837@debbugs.gnu.org>; Thu, 29 May 2014 12:02:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=UXXUGCPSNjGlSf7Z99SDf/WfPT24brP18jcX1/0aoVI=; b=vQQpsPFH6B1DI2jVa7ZrMVlB6N1VAx1D0oPVjstI8GUMn22RmnnxVZOJB6O0eFO+eu s2d9JmTvWlYc1VrNzDC0QOtK+w3RRqPBeZQHki4Gsw42zQwUsjne7tMq6B7wRb/5U8Bu O3C/OMlM+14r3lkppl+A8KIRBghVeFhpV6f8U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc :content-type; bh=UXXUGCPSNjGlSf7Z99SDf/WfPT24brP18jcX1/0aoVI=; b=Sz0lEvJiC+vQg75j1B+BiDtufPsDNFq/sOnOHbCccOvn7TxKZ6NpkBQDYUu+ER87zN mgdDJ6fW1JBsaDEJ+2SaY6QEDTlT0U1SuI7H83R9/c3QSMGvISut+m3uliQjziNVrwln Lft8SSQIlA/1s4+s2rykKmX4kL0eL5T6ppyySCn4vJAd5VpNNM7fDe6tROQPj4AbSyrD VCkHhMeHWiwCVIbRl1JvIeTNyrD28jJeoW3R4nVUDB9DV3Zxfl5z9tyoU2QLwz+Urbjm q70F17Emod/3/SoqjLNpIBVy/2guP3xoZZ65gAKeCER+nyoA5bJy3+IBkjTWHPdF8fLj gSDA== X-Gm-Message-State: ALoCoQm2f0Z0iBPrDuwxsGS0A0DUik+1GUd4bLX8Zps8PSVkc0ZwKobUIe26EmrsnZoyDbgTszu/ X-Received: by 10.112.89.66 with SMTP id bm2mr3731470lbb.91.1401390169112; Thu, 29 May 2014 12:02:49 -0700 (PDT) Original-Received: by 10.152.166.103 with HTTP; Thu, 29 May 2014 12:02:49 -0700 (PDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:89715 Archived-At: --001a11c377b838d8e104fa8e93d4 Content-Type: text/plain; charset=UTF-8 Revised patch as promised. [Resent owing to addressing error the first time around.] === modified file 'lisp/whitespace.el' --- lisp/whitespace.el 2014-01-27 12:30:17 +0000 +++ lisp/whitespace.el 2014-01-28 00:41:32 +0000 @@ -1730,8 +1730,9 @@ space-before-tab 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: @@ -1776,26 +1777,20 @@ 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: -* If `indent-tabs-mode' is non-nil: - empty 1. empty lines at beginning of buffer. - empty 2. empty lines at end of buffer. - trailing 3. SPACEs or TABs at end of line. - indentation 4. 8 or more SPACEs at beginning of line. - space-before-tab 5. SPACEs before TAB. - space-after-tab 6. 8 or more SPACEs after TAB. - -* If `indent-tabs-mode' is nil: - empty 1. empty lines at beginning of buffer. - empty 2. empty lines at end of buffer. - trailing 3. SPACEs or TABs at end of line. - indentation 4. TABS at beginning of line. - space-before-tab 5. SPACEs before TAB. - space-after-tab 6. 8 or more SPACEs after TAB. + empty 1. empty lines at beginning of buffer. + empty 2. empty lines at end of buffer. + trailing 3. SPACEs or TABs at end of line. + space-before-tab 4. SPACEs before TAB. + space-after-tab 5. 8 or more SPACEs after TAB. + indentation 6. If `indent-tabs-mode': + 8 or more SPACEs at beginning of line + else: TABS at beginning of line. See `whitespace-style' for documentation. See also `whitespace-cleanup' and `whitespace-cleanup-region' for @@ -1832,7 +1827,7 @@ (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 -- http://rrt.sc3d.org/ -- http://rrt.sc3d.org --001a11c377b838d8e104fa8e93d4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Revised patch as promised. [Res= ent owing to addressing error the first time around.]

=3D=3D=3D modified file 'lisp/whitespace.el'
--- lisp/whitespace.el =C2=A02014-01-27 12:30:17 +0000
+++ lisp/whitespace.el =C2=A02014-01-28 00:41:32 +0000
@@ -1730,8 +1730,9 @@
=C2=A0 =C2=A0 space-before-tab
=C2=A0 =C2=A0 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.

=C2=A0Report if some of the following whitespace problems exist:

@@ -1776,26 +1777,20 @@
=C2=A0 =C2=A0 trailing
=C2=A0 =C2=A0 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.

=C2=A0Report if some of the following whitespace problems exist:

-* If `indent-tabs-mode' is non-nil:
- =C2=A0 empty =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1. empty li= nes at beginning of buffer.
- =C2=A0 empty =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 2. empty li= nes at end of buffer.
- =C2=A0 trailing =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A03. SPACEs or TAB= s at end of line.
- =C2=A0 indentation =C2=A0 =C2=A0 =C2=A0 =C2=A0 4. 8 or more SPACEs at beg= inning of line.
- =C2=A0 space-before-tab =C2=A0 =C2=A05. SPACEs before TAB.
- =C2=A0 space-after-tab =C2=A0 =C2=A0 6. 8 or more SPACEs after TAB.
-
-* If `indent-tabs-mode' is nil:
- =C2=A0 empty =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1. empty li= nes at beginning of buffer.
- =C2=A0 empty =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 2. empty li= nes at end of buffer.
- =C2=A0 trailing =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A03. SPACEs or TAB= s at end of line.
- =C2=A0 indentation =C2=A0 =C2=A0 =C2=A0 =C2=A0 4. TABS at beginning of li= ne.
- =C2=A0 space-before-tab =C2=A0 =C2=A05. SPACEs before TAB.
- =C2=A0 space-after-tab =C2=A0 =C2=A0 6. 8 or more SPACEs after TAB.
+ =C2=A0 empty =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1. empty li= nes at beginning of buffer.
+ =C2=A0 empty =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 2. empty li= nes at end of buffer.
+ =C2=A0 trailing =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A03. SPACEs or TAB= s at end of line.
+ =C2=A0 space-before-tab =C2=A0 =C2=A04. SPACEs before TAB.
+ =C2=A0 space-after-tab =C2=A0 =C2=A0 5. 8 or more SPACEs after TAB.
+ =C2=A0 indentation =C2=A0 =C2=A0 =C2=A0 =C2=A0 6. If `indent-tabs-mode= 9;:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 8 or more SPACEs at beginning of line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 else: TABS at beginning of line.

=C2=A0See `whitespace-style' for documentation.
=C2=A0See also `whitespace-cleanup' and `whitespace-cleanup-region'= for
@@ -1832,7 +1827,7 @@
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(and (re-search-forward regexp rend t)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (setq has-bogus t))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0whitespace-report-li= st)))
- =C2=A0 =C2=A0 =C2=A0 (when (if report-if-bogus has-bogus t)
+ =C2=A0 =C2=A0 =C2=A0 (when (pcase report-if-bogus (`nil t) (`never nil) (= _ has-bogus))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (whitespace-kill-buffer whitespace-repor= t-buffer-name)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; `whitespace-indent-tabs-mode' is = local to current buffer
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; `whitespace-tab-width' is local t= o current buffer

--
http://rrt.sc3d.org/=



--
http://rrt.sc3d.org
--001a11c377b838d8e104fa8e93d4--