]> git.eshelyaron.com Git - emacs.git/commitdiff
Make dired-directory and dired-subdir-alist buffer-local
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 7 Feb 2022 00:31:15 +0000 (01:31 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 7 Feb 2022 00:31:53 +0000 (01:31 +0100)
* lisp/dired.el (dired-directory):
(dired-subdir-alist): Make buffer-local (bug#7118)
(dired-readin):
(dired-mode):
* lisp/dired-x.el (dired-virtual): Adjust usage.
* lisp/locate.el (locate-mode):
* lisp/find-lisp.el (find-lisp-find-dired-internal):
* lisp/find-dired.el (find-dired): Adjust usage.

lisp/dired-x.el
lisp/dired.el
lisp/find-dired.el
lisp/find-lisp.el
lisp/locate.el

index bdf416b3edcbeb87a49bf12515cbedf7d965792b..56036b6c16670a28165081886005e9ef069510b2 100644 (file)
@@ -639,8 +639,8 @@ you can relist single subdirs using \\[dired-do-redisplay]."
              ":\n"))
   (dired-mode dirname (or switches dired-listing-switches))
   (setq mode-name "Virtual Dired"
-        revert-buffer-function 'dired-virtual-revert)
-  (setq-local dired-subdir-alist nil)
+        revert-buffer-function 'dired-virtual-revert
+        dired-subdir-alist nil)
   (dired-build-subdir-alist)
   (goto-char (point-min))
   (dired-initial-position dirname))
index 5f1bfef12c56e1f5dde96f25edea064bac400759..bca30189230184967e2b48847fbe6b3653c38fc0 100644 (file)
@@ -408,7 +408,7 @@ action argument symbol is `window-height' and its value is nil." "24.3")
 (defvar dired-file-version-alist)
 
 ;;;###autoload
-(defvar dired-directory nil
+(defvar-local dired-directory nil
   "The directory name or wildcard spec that this Dired directory lists.
 Local to each Dired buffer.  May be a list, in which case the car is the
 directory name and the cdr is the list of files to mention.
@@ -455,7 +455,7 @@ The directory name must be absolute, but need not be fully expanded.")
 (defvar dired-re-dot "^.* \\.\\.?/?$")
 
 ;; The subdirectory names in the next two lists are expanded.
-(defvar dired-subdir-alist nil
+(defvar-local dired-subdir-alist nil
   "Alist of listed directories and their buffer positions.
 Alist elements have the form (DIRNAME . STARTMARKER), where
 DIRNAME is the absolute name of the directory and STARTMARKER is
@@ -1336,7 +1336,7 @@ wildcards, erases the buffer, and builds the subdir-alist anew
        (goto-char (point-min))
        ;; Must first make alist buffer local and set it to nil because
        ;; dired-build-subdir-alist will call dired-clear-alist first
-       (setq-local dired-subdir-alist nil)
+       (setq dired-subdir-alist nil)
        (dired-build-subdir-alist))
       (let ((attributes (file-attributes dirname)))
        (if (eq (car attributes) t)
@@ -2365,7 +2365,7 @@ Keybindings:
   (setq-local buffer-stale-function #'dired-buffer-stale-p)
   (setq-local buffer-auto-revert-by-notification t)
   (setq-local page-delimiter "\n\n")
-  (setq-local dired-directory (or dirname default-directory))
+  (setq dired-directory (or dirname default-directory))
   ;; list-buffers uses this to display the dir being edited in this buffer.
   (setq list-buffers-directory
        (expand-file-name (if (listp dired-directory)
index c67138a80066c5f2213bd23c6a6bc615ff7c57bb..c04545e44e9f0906676ec5d89474025e279130a6 100644 (file)
@@ -234,8 +234,8 @@ it finishes, type \\[kill-find]."
        (dired-simple-subdir-alist)
       ;; else we have an ancient tree dired (or classic dired, where
       ;; this does no harm)
-      (setq-local dired-subdir-alist
-                  (list (cons default-directory (point-min-marker)))))
+      (setq dired-subdir-alist
+            (list (cons default-directory (point-min-marker)))))
     (setq-local dired-subdir-switches find-ls-subdir-switches)
     (setq buffer-read-only nil)
     ;; Subdir headlerline must come first because the first marker in
index d4d899aced7b46fc694a85d7ba67674f5631b126..0a712c0b811dad0e97a0f7ffe039868204a3ac6a 100644 (file)
@@ -231,8 +231,8 @@ It is a function which takes two arguments, the directory and its parent."
        (dired-simple-subdir-alist)
       ;; else we have an ancient tree dired (or classic dired, where
       ;; this does no harm)
-      (setq-local dired-subdir-alist
-                  (list (cons default-directory (point-min-marker)))))
+      (setq dired-subdir-alist
+            (list (cons default-directory (point-min-marker)))))
     (find-lisp-insert-directory
      dir file-predicate directory-predicate 'ignore)
     (goto-char (point-min))
index 95b66f275a1d121c21ac7b145aeabde2736b36c4..d4847b9c05082c5fc33c11c6fb4883f0dec1171b 100644 (file)
@@ -461,13 +461,11 @@ Specific `locate-mode' commands, such as \\[locate-find-directory],
 do not work in subdirectories.
 
 \\{locate-mode-map}"
-  ;; Avoid clobbering this variable
-  (make-local-variable 'dired-subdir-alist)
   (setq default-directory   "/"
        buffer-read-only    t)
   (add-to-invisibility-spec '(dired . t))
   (dired-alist-add-1 default-directory (point-min-marker))
-  (setq-local dired-directory "/")
+  (setq dired-directory "/")
   (setq-local dired-subdir-switches locate-ls-subdir-switches)
   (setq dired-switches-alist nil)
   ;; This should support both Unix and Windoze style names