]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/dired-x.el (dired-omit-here-always): Use add-dir-local-variable
authorArtur Malabarba <bruce.connor.am@gmail.com>
Sat, 16 Jan 2016 08:52:14 +0000 (08:52 +0000)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Sat, 16 Jan 2016 08:53:33 +0000 (08:53 +0000)
instead of manually writing a dir-locals file.

lisp/dired-x.el

index fd8290ee65c61cfeac57e709169571b74a14ae0c..dccaa9e96ca0d6ceea92bcd1df3b3540a77f4e86 100644 (file)
@@ -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)