From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] trunk r116461: Connect electric-indent-mode up with CC Mode. Bug #15478. Date: Sun, 09 Mar 2014 23:37:36 -0400 Message-ID: References: <20140222182704.GA2639@acm.acm> <20140228195051.GA3446@acm.acm> <20140302115118.GA3768@acm.acm> <20140308225820.GB2726@acm.acm> <20140309123711.GA2615@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1394422671 18914 80.91.229.3 (10 Mar 2014 03:37:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 10 Mar 2014 03:37:51 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 10 04:37:59 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 1WMr2M-00020E-JT for ged-emacs-devel@m.gmane.org; Mon, 10 Mar 2014 04:37:58 +0100 Original-Received: from localhost ([::1]:46558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMr2M-0008Iv-3a for ged-emacs-devel@m.gmane.org; Sun, 09 Mar 2014 23:37:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMr2C-0008In-GK for emacs-devel@gnu.org; Sun, 09 Mar 2014 23:37:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WMr22-00072y-AI for emacs-devel@gnu.org; Sun, 09 Mar 2014 23:37:48 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:10891) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMr22-00072m-5O for emacs-devel@gnu.org; Sun, 09 Mar 2014 23:37:38 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFMCppy/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtjQ+DewOkeoFegxOBUw X-IPAS-Result: Av4EABK/CFFMCppy/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtjQ+DewOkeoFegxOBUw X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="50964351" Original-Received: from 76-10-154-114.dsl.teksavvy.com (HELO ceviche.home) ([76.10.154.114]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 09 Mar 2014 23:37:36 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 8BAF9660A5; Sun, 9 Mar 2014 23:37:36 -0400 (EDT) In-Reply-To: <20140309123711.GA2615@acm.acm> (Alan Mackenzie's message of "Sun, 9 Mar 2014 12:37:11 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:170240 Archived-At: > Thanks for ignoring practically all of my last email. > That really made my day. OK, since you insist, see detailed answers below. >> And as you probably remember, I disagree. > Yes, I remember well. Your disagreement consisted of noting that you > personally like typing tab all the time, rather than having lines of code > indent automatically. No, my personal preference has nothing to do with it. That would affect my ~/.emacs, not Emacs's own defaults. >> What is essential for me is that C-mode have the same behavior as other >> modes. I.e. obey electric-indent-mode. > Major modes provide different behaviours, behaviours appropriate to the > type of text being edited. That's why we have major modes. Right. But I don't see what is so special about the C language that makes c-electric-flag (aka electric-indent-mode) indispensable in c-mode. Better don't bother answering: electric-indent-mode is enabled by default anyway, so there's really no problem here. The question is really: why do you need to know if electric-indent-mode was called (and even how many times)? From what I understand of your previous answers it is because you want to only obey electric-indent-mode if the user changed the default. If so, what is wrong about testing Emacs's version instead? AFAIK your only worry is when electric-indent-mode is nil to make sure that the user really meant it. But if you test Emacs's version to make sure it's >24.3, then electric-indent-mode can only be nil if the user decided so. So you don't need to know if electric-indent-mode has been called nor how many times. Stefan > > No, we should only care about "enabled" and "disabled". > That's a fairly contentious opinion, not backed up by any reasoning. > Would you care to give your reasons why "default state" is not to be > cared about? You know very well: some major modes have historically setup some keys to electrically reindent the current line. And some haven't. This just reflects the personal preference of the major mode's author(s). It also means that a user who doesn't like this behavior needs to disable it separately for each and every such major mode (which includes figuring out how to disable it, which is not standardized either). And it also means that a user who does like this behavior will have to tweak the other major modes. Hence my introducing electric-indent-mode to standardize the behavior across modes. As is too often the case, CC-mode is the only one that doesn't want to get in line. > As we have discussed before, it is essential that c-electric-flag be > enabled by default for CC Mode buffers. Without it, indentation would > need to be done manually, e.g. by continual use of the tab key. Right: when electric-indent-mode is nil, it means that the user wants to have control over when auto-indentation is performed. That's not a bug. On the contrary: it is crucial to stay sane when you're editing code using an indentation convention that's different from the one supported by the major mode. But indeed, electric-indent-mode is enabled by default, because we recognize that it is overall better to try and maintain indentation without forcing the user to constantly use TAB. > Yet c-electric-flag, a buffer local flag, is now inextricably coupled > to electric-indent-mode, a crude global flag. A user wishing to > disable electric-indent-mode for some random buffer will find > automatic indentation broken in her C Mode buffers. No, she will find it correctly disabled, according to her wish expressed by the fact that she disabled electric-indent-mode. > There is no mechanism provided to users by electric-indent-mode to enable > it selectively in a buffer. Alan, please be constructive: you know full well this is untrue. > Even the undocumented electric-indent-local-mode The fact that it's not yet documented is irrelevant, since that's a problem that needs to be addressed anyway (and rather sooner than later since it's one of the hurdles remaining for the trunk to re-open). > doesn't work properly, as you admitted recently. Right, it has some bugs open, and we'll have to fix them for 24.4. > In the massive confusion and possible protest that will follow in the > wake of the release of electric-indent-mode, one of your options will be > to disable the mode by default. Come on, Alan. You know me better than that. And FWIW you've been the strongest voice *against* enabling electric-indent-mode, oddly enough. > Would you please give your word, as a gentleman, that whatever > transpires, after the sequence emacs -Q, C-x C-f foo.c, foo.c's copy > of c-electric-flag will always be t. No, I can't, sorry: if it were up to me, c-electric-flag would not even exist any more. But I can give you my word that "automatic indentation as a side effect of normal editing" will be enabled by default in programming modes, including C-like modes, yes. Stefan