emacs-devel
[Top][All Lists]
Advanced

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

Re: files.el: Once again impossible to turn off dir-settings


From: Juri Linkov
Subject: Re: files.el: Once again impossible to turn off dir-settings
Date: Thu, 27 Nov 2008 02:00:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu)

> Yes, please introduce a customization option that disables
> dir-local settings.

This is implemented in the following patch:

Index: lisp/files.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/files.el,v
retrieving revision 1.1019
diff -c -r1.1019 files.el
*** lisp/files.el       24 Nov 2008 19:13:58 -0000      1.1019
--- lisp/files.el       27 Nov 2008 00:00:27 -0000
***************
*** 3290,3302 ****
  
  (declare-function c-postprocess-file-styles "cc-mode" ())
  
  (defun hack-dir-local-variables ()
    "Read per-directory local variables for the current buffer.
  Store the directory-local variables in `file-local-variables-alist',
  without applying them."
    (when (and enable-local-variables
             (buffer-file-name)
!            (not (file-remote-p (buffer-file-name))))
      ;; Find the variables file.
      (let ((variables-file (dir-locals-find-file (buffer-file-name)))
          (class nil)
--- 3290,3318 ----
  
  (declare-function c-postprocess-file-styles "cc-mode" ())
  
+ (defcustom enable-dir-local-variables t
+   "Control use of directory-local variables in files you visit.
+ A value of nil means always ignore directory-local variables.  A value
+ of t means obey directory-local variables except when they are on
+ a remote system.  `remote' means search directory-local variables
+ in remote files as well.
+ 
+ File-local customization in variables like `enable-local-variables'
+ is checked in addition to this variable."
+   :type '(choice (const :tag "Enable" t)
+                (const :tag "Remote" remote)
+                (const :tag "Disable" nil))
+   :group 'find-file)
+ 
  (defun hack-dir-local-variables ()
    "Read per-directory local variables for the current buffer.
  Store the directory-local variables in `file-local-variables-alist',
  without applying them."
    (when (and enable-local-variables
+            enable-dir-local-variables
             (buffer-file-name)
!            (or (eq enable-dir-local-variables 'remote)
!                (not (file-remote-p (buffer-file-name)))))
      ;; Find the variables file.
      (let ((variables-file (dir-locals-find-file (buffer-file-name)))
          (class nil)

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

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