emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-25 71ecd62 2/2: * lisp/dired-x.el (dired-omit-here-a


From: Artur Malabarba
Subject: [Emacs-diffs] emacs-25 71ecd62 2/2: * lisp/dired-x.el (dired-omit-here-always): Use add-dir-local-variable
Date: Sat, 16 Jan 2016 10:53:50 +0000

branch: emacs-25
commit 71ecd62937b4645504a75043205c70ae020e6cb8
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    * lisp/dired-x.el (dired-omit-here-always): Use add-dir-local-variable
    
    instead of manually writing a dir-locals file.
---
 lisp/dired-x.el |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index fd8290e..dccaa9e 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -816,16 +816,14 @@ If in a Dired buffer, reverts it."
   (interactive)
   (if (file-exists-p dired-local-variables-file)
       (error "Old-style dired-local-variables-file `./%s' found;
-replace it with a dir-locals-file `./%s'"
+replace it with a dir-locals-file `./%s.el'"
              dired-local-variables-file
              dir-locals-file))
-  (if (file-exists-p dir-locals-file)
-      (message "File `./%s' already exists." dir-locals-file)
-    (with-temp-buffer
-      (insert "\
-\((dired-mode . ((subdirs . nil)
-                (dired-omit-mode . t))))\n")
-      (write-file dir-locals-file))
+  (if (dir-locals--all-files default-directory)
+      (message "File `./%s' already exists."
+               (car (dir-locals--all-files default-directory)))
+    (add-dir-local-variable 'dired-mode 'subdirs nil)
+    (add-dir-local-variable 'dired-mode 'dired-omit-mode t)
     ;; Run extra-hooks and revert directory.
     (when (derived-mode-p 'dired-mode)
       (hack-dir-local-variables-non-file-buffer)



reply via email to

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