From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#15478: cc-mode does not obey electric-indent-mode Date: Mon, 7 Oct 2013 09:39:00 +0000 Message-ID: <20131007093859.GA3859__12225.1544300982$1381138998$gmane$org@acm.acm> References: <20131002200737.GA3895@acm.acm> <524CDA92.1030107@dancol.org> <20131003094543.GA3211@acm.acm> <83zjqn5cri.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1381138988 882 80.91.229.3 (7 Oct 2013 09:43:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Oct 2013 09:43:08 +0000 (UTC) Cc: gnu-emacs-bug@moderators.isc.org To: Josh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 07 11:43:11 2013 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 1VT7LJ-0005lt-Q0 for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Oct 2013 11:43:10 +0200 Original-Received: from localhost ([::1]:58368 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT7LJ-0008Kw-DQ for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Oct 2013 05:43:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT7KR-00072H-1L for bug-gnu-emacs@gnu.org; Mon, 07 Oct 2013 05:42:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VT7KL-0003zU-AL for bug-gnu-emacs@gnu.org; Mon, 07 Oct 2013 05:42:14 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51082) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT7KE-0003xq-BN; Mon, 07 Oct 2013 05:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VT7KD-0002Bp-V2; Mon, 07 Oct 2013 05:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Mon, 07 Oct 2013 09:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15478 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by submit@debbugs.gnu.org id=B.13811388728354 (code B ref -1); Mon, 07 Oct 2013 09:42:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Oct 2013 09:41:12 +0000 Original-Received: from localhost ([127.0.0.1]:59375 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VT7JP-0002Ag-DT for submit@debbugs.gnu.org; Mon, 07 Oct 2013 05:41:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:44495) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VT7JO-0002AY-5Z for submit@debbugs.gnu.org; Mon, 07 Oct 2013 05:41:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VT7JI-0003VI-3i for submit@debbugs.gnu.org; Mon, 07 Oct 2013 05:41:09 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:49531) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT7JI-0003VD-0w for submit@debbugs.gnu.org; Mon, 07 Oct 2013 05:41:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT7JC-00059x-Mj for bug-gnu-emacs@gnu.org; Mon, 07 Oct 2013 05:41:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VT7J7-0003Tn-C5 for bug-gnu-emacs@gnu.org; Mon, 07 Oct 2013 05:40:58 -0400 Original-Received: from moderators.individual.net ([130.133.4.7]:60555) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT7J6-0003Tg-WC for bug-gnu-emacs@gnu.org; Mon, 07 Oct 2013 05:40:53 -0400 Original-Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de) by moderators.individual.net (Exim 4.80.1) for gnu-emacs-bug@moderators.isc.org with esmtp (envelope-from ) id <1VT7J5-002DAG-PB>; Mon, 07 Oct 2013 11:40:51 +0200 Original-Received: (qmail 34119 invoked by uid 3782); 7 Oct 2013 09:40:48 -0000 Original-Received: from acm.muc.de (pD951B381.dip0.t-ipconnect.de [217.81.179.129]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 07 Oct 2013 11:40:47 +0200 Original-Received: (qmail 3898 invoked by uid 1000); 7 Oct 2013 09:39:00 -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: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). 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:78980 Archived-At: Hi, Josh. On Sat, Oct 05, 2013 at 10:04:00PM -0700, Josh wrote: > On Sat, Oct 5, 2013 at 7:55 PM, Eli Zaretskii wrote: > > > From: Stefan Monnier > > > Date: Sat, 05 Oct 2013 21:10:01 -0400 > > > Cc: gnu-emacs-bug@moderators.isc.org > > > For people who don't like electric-indent-mode, CC-mode's > > > c-electric-flag sucks just as much. > > Who are they, except for you? Why don't we hear any complaints about > > that, except from you? > c-electric-flag is a variable defined in `cc-engine.el'. > Its value is t > Automatically becomes buffer-local when set. > Documentation: > Not documented as a variable. > Do you hear many complaints about other undocumented variables? Here, the variable need only be accessed through the function below. The emphasis on this variable is only in discussions like this one, not in user facilities. > C-c C-l runs the command c-toggle-electric-state, which is an > interactive compiled Lisp function in `cc-cmds.el'. > It is bound to C-c C-l, . > (c-toggle-electric-state &optional ARG) > Toggle the electric indentation feature. > Optional numeric ARG, if supplied, turns on electric indentation when > positive, turns it off when negative, and just toggles it when zero or > left out. > This is the command that Alan has claimed solved the problem back in > 2005 and makes it easy for newbies to easily disable electricity. I > don't believe that is so. Neglecting the fact that newbies are > unlikely to be familiar with Emacs' "electric" term of art and thus > unlikely to even make the connection between "c-toggle-electric-state" > and the behavior they're trying to disable, this docstring makes no > mention whatsoever of `c-electric-flag', nor does it describe how to > disable electric behavior permanently. (One might reasonably assume > that the global setting would govern here, but as we know it does > not.) Perhaps the newbie would have enough Lisp to make the leap from > that docstring to adding > (c-toggle-electric-state -1) > to her init file, but since that function is not autoloaded it would > likely only result in a cryptic error message. She could overcome > this with an appropriate (require ...) or (eval-after-load ...) form, > but of what feature? Should she read the CC Mode source to untangle > the dependencies in order to find the appropriate top-level feature > (and maybe go down the rabbit hole of investigating how the unfamiliar > `cc-require' differs from `require')? I could only manage to disable > this feature permanently by reading the source and setq-default'ing > (because it's not customizable either) an undocumented variable. Discoverability is a difficulty with lots of things in Emacs. `c-toggle-electric-state' is fully documented in the CC Mode manual on the page "Getting Started" (which defines the term "electric indentation" and indicates how to disable it for all CC Mode buffers), and there is a link to this from the "FAQ" page. Read it! > I suspect that if you don't hear many complaints about this behavior > it's because the procedure to disable it is beyond the ability of most > newbies who might wish to do so--perhaps they don't even realize that > it's possible--and that a good number of them move on to some other > editor as a result. When I first started using Emacs (~1996), not only was electric indentation enabled, but also auto-newline, too. I found out soon enough how to disable the latter (which irritated me). > Others of us read the source code and find the right magic undocumented > variable to nilify to make editing C stop being annoying without > complaining to anybody. Indeed. Other people ask on help-gnu-emacs. It's a problem. -- Alan Mackenzie (Nuremberg, Germany).