emacs-devel
[Top][All Lists]
Advanced

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

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


From: Chong Yidong
Subject: Re: Patch: Blunderbuss ".dir-locals.el" raises everything in its path!!
Date: Wed, 15 Jul 2009 16:49:03 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.96 (gnu/linux)

Alan Mackenzie <address@hidden> writes:

> In particular, there's no great care taken about how the local variable
> settings from the two sources get combined.

This has little to do with directory-local variables; if you specify a
file-local variable more than once in the file, the same thing occurs.

> How about the following idea: when a setting from the Local Variables:
> section is to be pushed onto file-local-variables-alist, any exisiting
> element for the same variable is first removed?

This sounds reasonable.  Something like this should work:

*** trunk/lisp/files.el.~1.1055.~       2009-07-12 13:32:43.000000000 -0400
--- trunk/lisp/files.el 2009-07-15 16:43:59.000000000 -0400
***************
*** 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.




reply via email to

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