From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?Q?=C3=93scar_Fuentes?= Newsgroups: gmane.emacs.devel Subject: Re: Electric indentation sub-optimality and resolution Date: Fri, 19 Dec 2014 02:08:34 +0100 Message-ID: <87oar0v431.fsf@wanadoo.es> References: <87wq5ovmbb.fsf@wanadoo.es> <86388chgci.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1418951348 18299 80.91.229.3 (19 Dec 2014 01:09:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Dec 2014 01:09:08 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 19 02:09:02 2014 Return-path: Envelope-to: ged-emacs-devel@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 1Y1m3y-00032j-3u for ged-emacs-devel@m.gmane.org; Fri, 19 Dec 2014 02:09:02 +0100 Original-Received: from localhost ([::1]:56179 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1m3x-0003Zd-EG for ged-emacs-devel@m.gmane.org; Thu, 18 Dec 2014 20:09:01 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1m3o-0003Tp-VZ for emacs-devel@gnu.org; Thu, 18 Dec 2014 20:08:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y1m3j-000679-68 for emacs-devel@gnu.org; Thu, 18 Dec 2014 20:08:52 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:57721) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1m3i-00066P-Vn for emacs-devel@gnu.org; Thu, 18 Dec 2014 20:08:47 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Y1m3h-0002vL-Ow for emacs-devel@gnu.org; Fri, 19 Dec 2014 02:08:45 +0100 Original-Received: from 129.red-88-10-128.dynamicip.rima-tde.net ([88.10.128.129]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 19 Dec 2014 02:08:45 +0100 Original-Received: from ofv by 129.red-88-10-128.dynamicip.rima-tde.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 19 Dec 2014 02:08:45 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 44 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 129.red-88-10-128.dynamicip.rima-tde.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:kbyWWOgHMfjQFONVcTynRIlZ4ew= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:180303 Archived-At: John Yates writes: > On Thu, Dec 18, 2014 at 3:07 PM, Dmitry Gutov wrote: >> >> Personally, I like this lighter-weight approach: >> >> https://github.com/purcell/whitespace-cleanup-mode > > > In my case I have show-trailing-whitespace set and my trailing-whitespace > face is "red3". That made it very painful to insert blank lines in the > presence of cc-mode's new electric indentation, even when some other > mechanism / package / mode ultimately was going to clean things up > (assuming I saved the file). Until I did a save my new electric whitespace > messes were "in my face". I had a similar setup here, but after using ws-butler it made no sense anymore, since that package ensures that the file does not end with newly added trailing whitespace. > Steve Purcell's approach works only if one's file is pristine. Yes, that disqualifies his package for me. > Prior to > the introduction of electric indentation I had no need of such a package: I > was careful not to introduce inappropriate whitespace. But since I > regularly have to work on files where other people have been less > fastidious Steve's package would not clean these electric whitespace messes. > > I actually really like the behavior of the code I posted. It has an added > small bonus. Normally it does not cleanup pre-existing whitespace. When I > modify a line with trailing whitespace it does cleanup that one line, > something my projects' guidelines allow. That's what ws-butler does. OTOH, your code is ok for adding it to the user's personal .emacs, but not for incorporation into Emacs. The code should be made into a minor mode or an optional feature of electric-indent-mode. Creating a new minor mode makes more sense, IMO. Anyways, we need to hear the opinion of the author of ws-butler package. AFAIK he tried a similar approach to yours and found problems with it.