emacs-devel
[Top][All Lists]
Advanced

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

Patch: Blunderbuss ".dir-locals.el" raises everything in its path!!


From: Alan Mackenzie
Subject: Patch: Blunderbuss ".dir-locals.el" raises everything in its path!!
Date: Tue, 14 Jul 2009 20:11:50 +0000
User-agent: Mutt/1.5.9i

Hi, Jan, Jason, Stefan!

On Tue, Jul 14, 2009 at 04:22:06PM +0000, Alan Mackenzie wrote:
> Hi, Jason, Jan, Stefan!

> On Mon, Jul 13, 2009 at 01:09:24PM +0800, Jason Rumney wrote:

> > I think it points to a bug in the handling of c-file-style.  The
> > documentation of c-cleanup-list (which is the variable that Jan was
> > surprised about) says that it should only be affected by the style
> > when it is set to set-from-style.

> I think you're right here, and that the bug is that the function
> handling c-file-style forgets to check that its value is
> 'set-from-style.

Here's a preliminary patch which I think fixes the code, though I've only
tested it briefly.  It seems to work for the case you (Jan) were hit by.

Now, any CC Mode style set by `c-file-style' will leave unchanged those
style variables (e.g. `c-cleanup-list') which have already been given
real values.

I expect and intend that if the `c-file-style' mechanism is used twice,
the second one (in the file's Local Variable section) will prevail over
the first one (in some .dir-locals.el), whilst respecting the non-default
value of `c-cleanup-list'.

Jan, please try it out!

Thanks!


Index: cc-mode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/cc-mode.el,v
retrieving revision 1.84
diff -c -r1.84 cc-mode.el
*** cc-mode.el  19 May 2009 22:35:07 -0000      1.84
--- cc-mode.el  14 Jul 2009 19:53:20 -0000
***************
*** 670,676 ****
          (offsets (cdr (assq 'c-file-offsets file-local-variables-alist))))
        (when stile
        (or (stringp stile) (error "c-file-style is not a string"))
!       (c-set-style stile))
        (when offsets
        (mapc
         (lambda (langentry)
--- 670,676 ----
          (offsets (cdr (assq 'c-file-offsets file-local-variables-alist))))
        (when stile
        (or (stringp stile) (error "c-file-style is not a string"))
!       (c-set-style stile 'respect-defaults))
        (when offsets
        (mapc
         (lambda (langentry)
***************
*** 741,747 ****
      (when c-file-style
        (or (stringp c-file-style)
          (error "c-file-style is not a string"))
!       (c-set-style c-file-style))
  
      (and c-file-offsets
         (mapc
--- 741,747 ----
      (when c-file-style
        (or (stringp c-file-style)
          (error "c-file-style is not a string"))
!       (c-set-style c-file-style 'respect-defaults))
  
      (and c-file-offsets
         (mapc

-- 
Alan Mackenzie (Nuremberg, Germany).




reply via email to

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