diff --git a/dired.el b/dired.el index 36c2f17..2ecd6bd 100644 --- a/dired.el +++ b/dired.el @@ -1143,19 +1143,21 @@ The return value is the target column for the file names." (forward-line))))))) (defun dired-internal-noselect (dir-or-list &optional switches mode) - ;; If DIR-OR-LIST is a string and there is an existing dired buffer - ;; for it, just leave buffer as it is (don't even call dired-revert). - ;; This saves time especially for deep trees or with ange-ftp. - ;; The user can type `g' easily, and it is more consistent with find-file. - ;; But if SWITCHES are given they are probably different from the - ;; buffer's old value, so call dired-sort-other, which does - ;; revert the buffer. - ;; Revert the buffer if DIR-OR-LIST is a cons or `dired-directory' - ;; is a cons and DIR-OR-LIST is a string. - ;; A pity we can't possibly do "Directory has changed - refresh? " - ;; like find-file does. - ;; Optional argument MODE is passed to dired-find-buffer-nocreate, - ;; see there. + "Internal function for `dired-noselect'. + +If DIR-OR-LIST is a string and there is an existing dired buffer +for it, just leave buffer as it is (don't even call `dired-revert'). +This saves time especially for deep trees or with `ange-ftp'. +The user can type `g' easily, and it is more consistent with `find-file'. +But if SWITCHES are given they are probably different from the +buffer's old value, so call `dired-sort-other', which does +revert the buffer. +Revert the buffer if DIR-OR-LIST is a cons or `dired-directory' +is a cons and DIR-OR-LIST is a string. +A pity we can't possibly do \"Directory has changed - refresh?\" +like `find-file' does. +Optional argument MODE is passed to `dired-find-buffer-nocreate', +see there." (let* ((old-buf (current-buffer)) (dirname (if (consp dir-or-list) (car dir-or-list) dir-or-list)) (buffer (when (not (bound-and-true-p dired-allow-duplicate-buffers)) @@ -1219,20 +1221,24 @@ The return value is the target column for the file names." buffer)) (defvar dired-buffers nil - ;; Enlarged by dired-advertise - ;; Queried by function dired-buffers-for-dir. When this detects a - ;; killed buffer, it is removed from this list. - "Alist of expanded directories and their associated Dired buffers.") + "Alist of expanded directories and their associated Dired buffers. +The list is enlarged by `dired-advertise'. Function +`dired-buffers-for-dir' queries this list and removes killed +buffers from it, when detected.") (defvar dired-find-subdir) +;; `dired-find-subdir' is defined in `dired-x.el' ;; FIXME add a doc-string, and document dired-x extensions. (defun dired-find-buffer-nocreate (dirname &optional mode) - ;; This differs from dired-buffers-for-dir in that it does not consider - ;; subdirs of default-directory and searches for the first match only. - ;; Also, the major mode must be MODE. - (if (and (featurep 'dired-x) - dired-find-subdir + "Internal function for `dired-internal-noselect'. +Searches among buffers of major-mode MODE (default `dired-mode') +for one visiting DIRNAME, and returns the first one found. This +differs from `dired-buffers-for-dir' in that it does not consider +subdirs of `default-directory', it searches only for the first +match, and it can restrict its search to buffers of +major-mode MODE." + (if (and (featurep 'dired-x) dired-find-subdir ;; Don't try to find a wildcard as a subdirectory. (string-equal dirname (file-name-directory dirname))) (let* ((cur-buf (current-buffer))