1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-23 10:34:07 +00:00

Make dired-directory and dired-subdir-alist buffer-local

* 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.
This commit is contained in:
Lars Ingebrigtsen 2022-02-07 01:31:15 +01:00
parent 69efc36c6b
commit 838da4aef8
5 changed files with 11 additions and 13 deletions

View 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))

View 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)

View 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

View 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))

View 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