emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 1d559e3: dired: Revert buffer when DIRNAME is a con


From: Tino Calancha
Subject: [Emacs-diffs] master 1d559e3: dired: Revert buffer when DIRNAME is a cons
Date: Fri, 21 Jul 2017 00:33:49 -0400 (EDT)

branch: master
commit 1d559e384b467b3f74e8b78695f124b561c884d9
Author: Tino Calancha <address@hidden>
Commit: Tino Calancha <address@hidden>

    dired: Revert buffer when DIRNAME is a cons
    
    * lisp/dired.el (dired-internal-noselect): Revert buffer if DIR-OR-LIST
    is a cons, or dired-directory is a cons and DIR-OR-LIST a string (Bug#7131).
    Update the comments.
    * test/lisp/dired-tests.el (dired-test-bug7131): Test should pass.
---
 lisp/dired.el            | 11 +++++++++--
 test/lisp/dired-tests.el |  1 -
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lisp/dired.el b/lisp/dired.el
index 4fb4fe7..9d500a9 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -872,13 +872,15 @@ periodically reverts at specified time intervals."
   :version "23.2")
 
 (defun dired-internal-noselect (dir-or-list &optional switches mode)
-  ;; If there is an existing dired buffer for DIRNAME, just leave
-  ;; buffer as it is (don't even call dired-revert).
+  ;; 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,
@@ -898,6 +900,11 @@ periodically reverts at specified time intervals."
               (setq dired-directory dir-or-list)
               ;; this calls dired-revert
               (dired-sort-other switches))
+             ;; Always revert when `dir-or-list' is a cons.  Also revert
+             ;; if `dired-directory' is a cons but `dir-or-list' is not.
+             ((or (consp dir-or-list) (consp dired-directory))
+              (setq dired-directory dir-or-list)
+              (revert-buffer))
              ;; Always revert regardless of whether it has changed or not.
              ((eq dired-auto-revert-buffer t)
               (revert-buffer))
diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el
index 791ba07..bd18161 100644
--- a/test/lisp/dired-tests.el
+++ b/test/lisp/dired-tests.el
@@ -131,7 +131,6 @@
 
 (ert-deftest dired-test-bug7131 ()
   "Test for http://debbugs.gnu.org/7131 ."
-  :expected-result :failed
   (let* ((dir (expand-file-name "lisp" source-directory))
          (buf (dired dir)))
     (unwind-protect



reply via email to

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