From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: electric-indent-mode: abolition of `newline' function is not the Right Thing. Date: Wed, 16 Oct 2013 18:46:31 +0000 Message-ID: <20131016184631.GB3125@acm.acm> References: <20131013101325.GA2621@acm.acm> <20131013140931.GC2621@acm.acm> <20131013172841.GA2498@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1381949326 19699 80.91.229.3 (16 Oct 2013 18:48:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Oct 2013 18:48:46 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 16 20:48:48 2013 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 1VWW9H-0000Wp-Cv for ged-emacs-devel@m.gmane.org; Wed, 16 Oct 2013 20:48:47 +0200 Original-Received: from localhost ([::1]:48941 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWW9H-0006tH-1u for ged-emacs-devel@m.gmane.org; Wed, 16 Oct 2013 14:48:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWW96-0006sj-Kp for emacs-devel@gnu.org; Wed, 16 Oct 2013 14:48:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWW8z-0000wQ-8V for emacs-devel@gnu.org; Wed, 16 Oct 2013 14:48:36 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:37980 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWW8y-0000tJ-V0 for emacs-devel@gnu.org; Wed, 16 Oct 2013 14:48:29 -0400 Original-Received: (qmail 64126 invoked by uid 3782); 16 Oct 2013 18:48:26 -0000 Original-Received: from acm.muc.de (pD951A2A4.dip0.t-ipconnect.de [217.81.162.164]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 16 Oct 2013 20:48:25 +0200 Original-Received: (qmail 3720 invoked by uid 1000); 16 Oct 2013 18:46:31 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 193.149.48.1 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:164246 Archived-At: Hello, Stefan. On Mon, Oct 14, 2013 at 08:56:25AM -0400, Stefan Monnier wrote: > > And people calling `newline' do not simply want a \n. They want > > abbreviations to be processed, they want auto-fill to be run, trailing > > space to be removed from otherwise blank lines, and so on. What they > > _don't_ want is indentation inserted on the new line. > Not sure who is your "they". The people who have written Emacs Lisp code which calls `newline' (as contrasted with `newline-and-indent'). > In my experience, what I've seen users want is "auto-indentation" and > by that they mean that the text should be kept indented when they hit > RET and a few other keys. That is a different topic from this thread's. The question which should be asked, should have been asked some while ago, is what is the best way of giving these users what they want. The answer is not, and can not be, to have an Emacs without the traditional functionality of `newline'. [ .... ] > But so far, you're the only person who's complained about ?\n being in > the default value of electric-indent-chars, so I see no evidence that > your preference in this regard is representative. Have I complained about \n being in electric-indent-chars? I don't think I have, but might be mistaken. My complaint, and I've been perfectly clear about it, is the abolition of the traditional functionality of the `newline' function whenever electric-indent-mode is enabled. You haven't really addressed this issue in your past few posts. > > Please take this indent-newline functionality out of > > e-i-post-s-i-function (or let me do it). > Very easy: remove ?\n from electric-indent-chars. > IOW (setq-default electric-indent-chars nil) should do that for you. Is that your solution to the ~198 uses of `newline' in Emacs and countless others in other code and users' .emacsen? Each caller of `newline' should first ensure that \n is not in electric-indent-chars? > > Incidentally, each call of e-i-post-s-i-function creates a new marker, > > bound to the let variable `before'. This is not set to point nowhere > > before `before' becomes unbound. I think it probably should. > Let's see if/when this leads to a concrete performance problem, and at > that point we'll see how to fix it. Making a marker point nowhere is an > annoyance and is itself a costly operation (O(N) for N markers), so > I don't much like using the workaround you suggest. Well, it's not really my suggestion, it's standard advice in the Elisp manual on page "Overview of Markers". Without doing this, a buffer's performance is gradually going to worsen as a heap of useless markers accumulates, until such time as garbage collection eventually gets rid of them. The cost of making a marker point nowhere, less than once per keystroke, is hardly high. > Stefan -- Alan Mackenzie (Nuremberg, Germany).