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: Mon, 27 Jan 2014 13:25:01 +0000 Message-ID: References: <878v69fn8q.fsf@sc3d.org> <87mwiiz5im.fsf@yandex.ru> <52E5A807.1040804@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c131b88aaa7204f0f3a284 X-Trace: ger.gmane.org 1390829170 32766 80.91.229.3 (27 Jan 2014 13:26:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Jan 2014 13:26:10 +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 Mon Jan 27 14:26:17 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 1W7mCd-00084h-BZ for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Jan 2014 14:26:15 +0100 Original-Received: from localhost ([::1]:59566 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7mCc-0008IO-RC for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Jan 2014 08:26:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7mCW-0008II-3u for bug-gnu-emacs@gnu.org; Mon, 27 Jan 2014 08:26:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W7mCQ-0006TD-G9 for bug-gnu-emacs@gnu.org; Mon, 27 Jan 2014 08:26:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51719) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7mCQ-0006T7-0f for bug-gnu-emacs@gnu.org; Mon, 27 Jan 2014 08:26:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W7mCP-00084s-Jh for bug-gnu-emacs@gnu.org; Mon, 27 Jan 2014 08:26:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Reuben Thomas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Jan 2014 13:26: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.139082910730979 (code B ref 13837); Mon, 27 Jan 2014 13:26:01 +0000 Original-Received: (at 13837) by debbugs.gnu.org; 27 Jan 2014 13:25:07 +0000 Original-Received: from localhost ([127.0.0.1]:37505 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W7mBV-00083Z-Rw for submit@debbugs.gnu.org; Mon, 27 Jan 2014 08:25:06 -0500 Original-Received: from mail-qc0-f170.google.com ([209.85.216.170]:44039) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W7mBS-00083D-99 for 13837@debbugs.gnu.org; Mon, 27 Jan 2014 08:25:03 -0500 Original-Received: by mail-qc0-f170.google.com with SMTP id e9so8124052qcy.29 for <13837@debbugs.gnu.org>; Mon, 27 Jan 2014 05:25:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=FrwKs/iZKTpa9asxSA9keYUXQK7le105wE/UGQwbZIY=; b=VdTppF9IVpeuGqRT7WXIQpYrsBl/oBA/qNKWvRlQRayb05w0Zu9w0GgvfcFw8S0NeY 21VVRCRq2Rb/vqIeqdeZSNlWeSJC3EqXjPdn6H/nX+oCGoXM5bC9UcLIXpXIL1R2QF8c uCKhvC1gQcfpjVNyBwpua6X38asJSQTB7YDVs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=FrwKs/iZKTpa9asxSA9keYUXQK7le105wE/UGQwbZIY=; b=h0y8mLodWDXO/53SuVErUEqkY5ngxIgWD0pyBP17SLcovkXsaWqIMMYVRVfhnyby14 INkVKkGMWZw+1HDPfduuctbSXvSG34ahbsbUbWEmUlKXz1MRrU+7MjEyu+z3pqHtIVQm /ZF+lGgpWXKKWbc2MLUpScZdvKo5w4HEVwnHM7tBbEdqZUDw6ECHgSzDlaFdbBnQutQe nQESUm8rwvp0quEU216UmBJqKkQx9YN4ojfxYpIfPBUrCYNt3olfI1i3fLDZdozViNsQ RBG2DO/HPc3eUQ7CGFSStM0YkHUaRGCI1b3MAUCoJeAj6LJd4xULMUCocAXi1NhcTX77 ArzQ== X-Gm-Message-State: ALoCoQlKs0ehV5RxdgPtv/5lT+td5ZdcieER2sUGZ3BluodHKvNFHW6mWPmP84U3psGymzRuyikN X-Received: by 10.140.86.202 with SMTP id p68mr40108498qgd.81.1390829101553; Mon, 27 Jan 2014 05:25:01 -0800 (PST) Original-Received: by 10.229.71.66 with HTTP; Mon, 27 Jan 2014 05:25:01 -0800 (PST) In-Reply-To: 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:84109 Archived-At: --001a11c131b88aaa7204f0f3a284 Content-Type: text/plain; charset=ISO-8859-1 On 27 January 2014 01:52, Stefan Monnier wrote: > > I could be convinced to install it if it's "obviously safe". > The patch as sent is a large chunk of "new" code plus a large chunk of > "removed" code, so it's not very appealing. Diffing while ignoring > whitespace indicates it's more of a "refactoring", and by introducing an > "artificial" new function while helps keep the text lines in the > original order (and hence helps reduce the size of the diff), I get the > patch below. > Thanks very much for trying. > But it's not obviously safe to me. Two non-obvious parts are: > - the removal of "(add-to-list 'whitespace-style (car option))". > The removal looks wrong to me too: without that code, the force argument has no effect. On the other hand, the way it's implemented also seems wrong, as it permanently changes whitespace-style. > - the change from has-bogus to bogus-list, where bogus-list will > (initially) only be nil if whitespace-report-list is nil. > As far as I can see, has-bogus was set whenever an element was added to bogus-list. Hence, bogus-list is nil when has-bogus was nil. bogus-list is a list of whichever elements of whitespace-report-list problems are found, so if no problem is found, it will be nil. > Another problem is that the docstring of whitespace-test-region does not > accurately describe its return value. > So the return value is currently a list of flags corresponding to elements of whitespace-report-list. Two more things: 1. I would like to refactor the description of whitespace problems in whitespace-report-region to move those which are the same regardless of the value of indent-tabs-mode into a separate list. 2. Since we're no longer going for getting this into 24.4, can we fold your "artificial" whitespace--report-report-region back into whitespace-report-region, which both simplifies the end result slightly, and avoids the question of whether the new function should be moved down into "internal functions"? --001a11c131b88aaa7204f0f3a284 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On 2= 7 January 2014 01:52, Stefan Monnier <monnier@iro.umontreal.ca&= gt; wrote:

I could be convinced to install it if it's "obviously safe&q= uot;.
The patch as sent is a large chunk of "new" code plus a large chu= nk of
"removed" code, so it's not very appealing. =A0Diffing while = ignoring
whitespace indicates it's more of a "refactoring", and by int= roducing an
"artificial" new function while helps keep the text lines in the<= br> original order (and hence helps reduce the size of the diff), I get the
patch below.

Thanks very much for tryin= g.
=A0
But it's not obviously safe to me. =A0Two non-obvious parts are:
- the removal of "(add-to-list 'whitespace-style (car option))&quo= t;.

The removal looks wrong to me too: = without that code, the force argument has no effect. On the other hand, the= way it's implemented also seems wrong, as it permanently changes white= space-style.
=A0
- the change from has-bogus to bogus-list, where bogus-list will
=A0 (initially) only be nil if whitespace-report-list is nil.

As far as I can see, has-bogus was set whenever an e= lement was added to bogus-list. Hence, bogus-list is nil when has-bogus was= nil. bogus-list is a list of whichever elements of whitespace-report-list = problems are found, so if no problem is found, it will be nil.
=A0
Another problem is that the docstring of whitespace-test-region does not accurately describe its return value.

So the return value is currently a list of flags correspon= ding to elements of whitespace-report-list.

Two more things:

1. I would like to refactor the description of whit= espace problems in whitespace-report-region to move those which are the sam= e regardless of the value of indent-tabs-mode into a separate list.

2. Since we're no longer going for getting this into 24.4, can we f= old your "artificial" whitespace--report-report-region back into = whitespace-report-region, which both simplifies the end result slightly, an= d avoids the question of whether the new function should be moved down into= "internal functions"?
--001a11c131b88aaa7204f0f3a284--