[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

c-file-style in .dir-locals.el was ignored

From: Kan-Ru Chen
Subject: c-file-style in .dir-locals.el was ignored
Date: Fri, 26 Nov 2010 16:54:25 +0800
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

Sort of.  I found the commit to `c-before-hack-hook' in Jul 18, 2010
added check against `dir-local-variables-alist' and "call `c-set-style'
differently according to whether c-file-style was set in file or
directory local variables."  Which is not clear why directory local
variables should be treated differently.

The following implementation

(if (boundp 'dir-local-variables-alist)
    ;; Determine whether `c-file-style' was set in the file's local
    ;; variables or in a .dir-locals.el (a directory setting).
    (let ((cfs-in-file-and-dir-count
           (c-count-cfss file-local-variables-alist))
          (cfs-in-dir-count (c-count-cfss dir-local-variables-alist)))
      (c-set-style stile
                   (= cfs-in-file-and-dir-count cfs-in-dir-count)))
  (c-set-style stile)))

eventually calls (c-set-style "linux" t) if `c-file-style' was only set
in .dir-locals.el.  Since the style is set default to "gnu" and
DONT-OVERRIDE is t, most style from "linux" will not apply.

Is this intended or a bug?


A badly written book is only a blunder. A bad translation of a good
book is a crime.
                -- Gilbert Highet

reply via email to

[Prev in Thread] Current Thread [Next in Thread]