From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kan-Ru Chen Newsgroups: gmane.emacs.devel Subject: c-file-style in .dir-locals.el was ignored Date: Fri, 26 Nov 2010 16:54:25 +0800 Message-ID: <87hbf4fose.fsf@anar.kanru.info> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1290761701 27516 80.91.229.12 (26 Nov 2010 08:55:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 26 Nov 2010 08:55:01 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 26 09:54:55 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PLu50-0002EW-U5 for ged-emacs-devel@m.gmane.org; Fri, 26 Nov 2010 09:54:55 +0100 Original-Received: from localhost ([127.0.0.1]:58376 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLu50-0004zL-Ge for ged-emacs-devel@m.gmane.org; Fri, 26 Nov 2010 03:54:54 -0500 Original-Received: from [140.186.70.92] (port=40366 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLu4r-0004y2-Ab for emacs-devel@gnu.org; Fri, 26 Nov 2010 03:54:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PLu4n-0006mi-7e for emacs-devel@gnu.org; Fri, 26 Nov 2010 03:54:45 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:41834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PLu4n-0006mH-1u for emacs-devel@gnu.org; Fri, 26 Nov 2010 03:54:41 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PLu4l-00026H-EK for emacs-devel@gnu.org; Fri, 26 Nov 2010 09:54:39 +0100 Original-Received: from 61-30-10-70.static.tfn.net.tw ([61.30.10.70]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 26 Nov 2010 09:54:39 +0100 Original-Received: from kanru by 61-30-10-70.static.tfn.net.tw with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 26 Nov 2010 09:54:39 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 35 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 61-30-10-70.static.tfn.net.tw User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:zs+nbl95U0wAInYVYei6SZsH4CE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:133148 Archived-At: 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 #v+ (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))) #v- 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? Cheers, Kanru -- A badly written book is only a blunder. A bad translation of a good book is a crime. -- Gilbert Highet