GNU bug report logs - #8251
c-default-style vs. .dir-locals

Previous Next

Packages: emacs, cc-mode;

Reported by: Juanma Barranquero <lekktu <at> gmail.com>

Date: Mon, 14 Mar 2011 20:52:02 UTC

Severity: normal

Merged with 7570

Found in version 24.0.50

Done: Kan-Ru Chen <kanru <at> kanru.info>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juanma Barranquero <lekktu <at> gmail.com>
To: 8251 <at> debbugs.gnu.org
Subject: bug#8251: c-default-style vs. .dir-locals
Date: Mon, 14 Mar 2011 21:50:25 +0100
Package: emacs
Version: 24.0.50


The test file contains just three lines:

{
  x;
}

(there are two spaces before "x;", as per the GNU style)

and .dir-locals.el is a one-liner:

((c-mode . ((c-file-style . "GNU"))))

Cases:

1.- No .dir-locals.el, no c-default-style

    rm .dir-locals.el
    emacs -Q test.c

    then c-indentation-style == "gnu", c-basic-offset == 2 (original
value was set-from-style; local in buffer test.c; global value is
set-from-style). And indeed, C-n <TAB> does not change anything.

2.- No .dir-locals, set c-default-style

    rm .dir-locals.el
    emacs -Q --eval '(setq c-default-style '((other . "stroustrup")))' test.c

    then c-indentation-style == "stroustrup", c-basic-offset == 4, and
C-n <TAB> reindents the x; line.

3.- .dir-locals.el, set c-default-style

    echo ((c-mode . ((c-file-style . "GNU"))))> .dir-locals.el
    emacs -Q --eval '(setq c-default-style '((other . "stroustrup")))' test.c

    then c-indentation-style == "gnu", c-basic-offset == 4, and C-n
<TAB> reindents.

4.- Like 3, but manually setting the style

    echo ((c-mode . ((c-file-style . "GNU"))))> .dir-locals.el
    emacs -Q --eval '(setq c-default-style '((other . "stroustrup")))' test.c
    C-c . gnu <RET>

    then c-indentation-style == "gnu", c-basic-offset == 2, and C-n
<TAB> does nothing (as expected).


Shouldn't case 3 work as 4? Or am I misunderstanding something obvious?

    Juanma




This bug report was last modified 13 years and 309 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.