[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH] setting indentation styles via `c-file-style' fails to a
From: |
Alan Mackenzie |
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 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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).