[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Patch: Blunderbuss ".dir-locals.el" raises everything in its path!!
From: |
Alan Mackenzie |
Subject: |
Re: Patch: Blunderbuss ".dir-locals.el" raises everything in its path!! |
Date: |
Sat, 18 Jul 2009 12:51:16 +0000 |
User-agent: |
Mutt/1.5.9i |
Hi, Jan!
On Wed, Jul 15, 2009 at 09:55:43AM +0200, Jan Djärv wrote:
> >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!
> It works if I set c-cleanup-list with customize, but not if it is set in
> the c-common-mode-hook (using add-to-list).
Here's a better patch, incorporating Yidong's amendments to the
manipulations of `file-local-variables-alist'. Please try this out!
> Jan D.
Index: files.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/files.el,v
retrieving revision 1.1055
diff -c -r1.1055 files.el
*** files.el 5 Jul 2009 22:15:37 -0000 1.1055
--- files.el 18 Jul 2009 12:43:40 -0000
***************
*** 2960,2966 ****
(dolist (elt variables)
(unless (or (member elt unsafe-vars)
(member elt risky-vars))
! (push elt file-local-variables-alist)))
;; Query, unless all are known safe or the user wants no
;; querying.
(if (or (and (eq enable-local-variables t)
--- 2960,2970 ----
(dolist (elt variables)
(unless (or (member elt unsafe-vars)
(member elt risky-vars))
! (let ((var (car elt)))
! (unless (eq var 'eval)
! (setq file-local-variables-alist
! (assq-delete-all var file-local-variables-alist)))
! (push elt file-local-variables-alist))))
;; Query, unless all are known safe or the user wants no
;; querying.
(if (or (and (eq enable-local-variables t)
***************
*** 2970,2976 ****
(hack-local-variables-confirm
variables unsafe-vars risky-vars dir-name))
(dolist (elt variables)
! (push elt file-local-variables-alist)))))))
(defun hack-local-variables (&optional mode-only)
"Parse and put into effect this buffer's local variables spec.
--- 2974,2985 ----
(hack-local-variables-confirm
variables unsafe-vars risky-vars dir-name))
(dolist (elt variables)
! (let ((var (car elt)))
! (unless (eq var 'eval)
! (setq file-local-variables-alist
! (assq-delete-all var file-local-variables-alist)))
! (push elt file-local-variables-alist))))))))
!
(defun hack-local-variables (&optional mode-only)
"Parse and put into effect this buffer's local variables spec.
***************
*** 3073,3078 ****
--- 3082,3088 ----
(enable-local-variables
(hack-local-variables-filter result nil)
(when file-local-variables-alist
+ ;; Any 'evals must run in the Right sequence.
(setq file-local-variables-alist
(nreverse file-local-variables-alist))
(run-hooks 'before-hack-local-variables-hook)
Index: progmodes/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
*** progmodes/cc-mode.el 19 May 2009 22:35:07 -0000 1.84
--- progmodes/cc-mode.el 18 Jul 2009 12:43:41 -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 t))
(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 t))
(and c-file-offsets
(mapc
--
Alan Mackenzie (Nuremberg, Germany).
- Re: Blunderbuss ".dir-locals.el" raises everything in its path!!, (continued)
- Re: Blunderbuss ".dir-locals.el" raises everything in its path!!, Dan Nicolaescu, 2009/07/12
- Re: Blunderbuss ".dir-locals.el" raises everything in its path!!, Jason Rumney, 2009/07/13
- Re: Blunderbuss ".dir-locals.el" raises everything in its path!!, Alan Mackenzie, 2009/07/13
- Re: Blunderbuss ".dir-locals.el" raises everything in its path!!, Alan Mackenzie, 2009/07/14
- Re: Blunderbuss ".dir-locals.el" raises everything in its path!!, Stefan Monnier, 2009/07/14
- Patch: Blunderbuss ".dir-locals.el" raises everything in its path!!, Alan Mackenzie, 2009/07/14
- Re: Patch: Blunderbuss ".dir-locals.el" raises everything in its path!!, Jan Djärv, 2009/07/15
- Re: Patch: Blunderbuss ".dir-locals.el" raises everything in its path!!, Alan Mackenzie, 2009/07/15
- Re: Patch: Blunderbuss ".dir-locals.el" raises everything in its path!!, Stefan Monnier, 2009/07/15
- Re: Patch: Blunderbuss ".dir-locals.el" raises everything in its path!!, Chong Yidong, 2009/07/15
- Re: Patch: Blunderbuss ".dir-locals.el" raises everything in its path!!,
Alan Mackenzie <=
- Re: Patch: Blunderbuss ".dir-locals.el" raises everything in its path!!, Jan Djärv, 2009/07/20
- Re: Patch: Blunderbuss ".dir-locals.el" raises everything in its path!!, Alan Mackenzie, 2009/07/20
- Re: Patch: Blunderbuss ".dir-locals.el" raises everything in its path!!, Jan Djärv, 2009/07/20
- Re: Blunderbuss ".dir-locals.el" raises everything in its path!!, Stefan Monnier, 2009/07/13
- Re: Blunderbuss ".dir-locals.el" raises everything in its path!!, Stephen J. Turnbull, 2009/07/14
- Re: Blunderbuss ".dir-locals.el" raises everything in its path!!, Jan Djärv, 2009/07/14
- Re: Blunderbuss ".dir-locals.el" raises everything in its path!!, Davis Herring, 2009/07/14
- Re: Blunderbuss ".dir-locals.el" raises everything in its path!!, Alan Mackenzie, 2009/07/14
- Re: Blunderbuss ".dir-locals.el" raises everything in its path!!, Davis Herring, 2009/07/14
- Re: Blunderbuss ".dir-locals.el" raises everything in its path!!, Miles Bader, 2009/07/14