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: [RFC PATCH] setting indentation styles via `c-file-style' fails to actually change indentation Date: Thu, 2 Jun 2011 21:15:29 +0000 Message-ID: <20110602211529.GA4904@acm.acm> References: <87pqngewwp.fsf@spindle.srvr.nix> <87wrh5tyh7.fsf@spindle.srvr.nix> <20110602122412.GA2448@acm.acm> <87fwnstc2z.fsf@spindle.srvr.nix> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1307049709 11397 80.91.229.12 (2 Jun 2011 21:21:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 2 Jun 2011 21:21:49 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Nix Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 02 23:21:45 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QSFKo-00051N-M4 for ged-emacs-devel@m.gmane.org; Thu, 02 Jun 2011 23:21:42 +0200 Original-Received: from localhost ([::1]:44839 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QSFKn-000054-MV for ged-emacs-devel@m.gmane.org; Thu, 02 Jun 2011 17:21:41 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:54763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QSFFv-0007ur-UN for emacs-devel@gnu.org; Thu, 02 Jun 2011 17:16:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QSFFu-0007q3-Ax for emacs-devel@gnu.org; Thu, 02 Jun 2011 17:16:39 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:1684 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QSFFt-0007pj-QC for emacs-devel@gnu.org; Thu, 02 Jun 2011 17:16:38 -0400 Original-Received: (qmail 1705 invoked by uid 3782); 2 Jun 2011 21:16:35 -0000 Original-Received: from acm.muc.de (pD951AAAA.dip.t-dialin.net [217.81.170.170]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Thu, 02 Jun 2011 23:16:34 +0200 Original-Received: (qmail 5078 invoked by uid 1000); 2 Jun 2011 21:15:29 -0000 Content-Disposition: inline In-Reply-To: <87fwnstc2z.fsf@spindle.srvr.nix> User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 4.6-4.9 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:140102 Archived-At: Hi, Nix. On Thu, Jun 02, 2011 at 05:47:16PM +0100, Nix wrote: > On 2 Jun 2011, Alan Mackenzie told this: > > At a guess, the bug is caused by calling c-file-style with a setting of > > `dont-override' which causes it to choke on the above hacks. > Er, yes. Did you miss my original post? 'cos I came to that conclusion, Sorry, I got a bit confused by the length of your post. > and have a patch, which works for me, at least... but it's rather ugly, > so if there is a better way which would still allow setting of styles on > file-by-file and directory-(class)-by-directory-(class) basis, then I'm > glad to try that instead! I'm concerned that adding the extra value 'default to dont-override, and also the two extra variables, might be an unwarranted increase in complexity. But first, I'd like to understand exactly what the bug is. For a start, _please_ tell me which version of Emacs you're testing with. Anyhow, ... > Now. Add that same c-file-style as a file-local or directory-local > variable to that other style. Reopen it. 'c-basic-offset' hasn't > changed from the 'gnu' default, but 'c-indentation-style' proclaims > that the style has in fact been set. In fact, 'c-basic-offset' is > permanently stuck at the value specified for 'gnu', no matter what > style you asked for. And this is true for every single variable that > is set by the 'gnu' style, and for the pieces of 'c-offsets-alist' as > well. I think what you're saying is that in a file like this, int main (int argc, char *argv[]) { printf ("Hello, world!\n") ; } /* Local Variables: */ /* c-file-style : "linux" */ /* End: */ , c-basic-offset remains 4, when it ought to become 8. Is this in fact the bug you have found? Just one thing: are you absolutely sure you got the syntax of your Local Variables: section correct? If not, I think Emacs just fails to recognise it without giving an error message. [ ... ] > DONT-OVERRIDE is clearly doing what it is specified to do. However, > since 'c-set-style' may be called more than once when initializing a > buffer, ..... Critical here is what value of `dont-override' is used in each of these calls. > ... the net effect of these semantics is to set variables which are > defined in the 'c-default-style' as well as in the 'c-file-style' to > their values in the 'c-default-style', which is surely wrong: the > 'c-default-style' is a global fallback, and should not take precedence > over per-file or per-directory indentation styles. That is true. The question is why is the c-set-style for the `c-file-style' not doing its job?. Normally it would override the default style just set up. Anyhow, first I need to be able to reproduce the bug. Any help you can give me with this will be most appreciated. > -- > NULL && (void) -- Alan Mackenzie (Nuremberg, Germany).