aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2009-12-04 21:45:29 +0000
committerJuri Linkov2009-12-04 21:45:29 +0000
commit2b3489a76dc4de45e624530f1ad3341654cce52b (patch)
treebd2ee3bd904d80f7a0db3e28a60f9adf363c8dac
parent9b9debd1fbccfba419e7b6b66ae8e3df2c076674 (diff)
downloademacs-2b3489a76dc4de45e624530f1ad3341654cce52b.tar.gz
emacs-2b3489a76dc4de45e624530f1ad3341654cce52b.zip
(dired-auto-revert-buffer): New defcustom.
(dired-internal-noselect): Use it.
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/dired.el26
3 files changed, 36 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index d398640aa4e..a9f684a9f25 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -201,6 +201,11 @@ effective for buffers that have no associated file. If you want to
201exempt buffers that do correspond to files, customize the value of 201exempt buffers that do correspond to files, customize the value of
202`desktop-files-not-to-save' instead. 202`desktop-files-not-to-save' instead.
203 203
204** Dired
205
206*** The new variable `dired-auto-revert-buffer' allows to revert
207dired buffers automatically on revisiting.
208
204** DocView 209** DocView
205 210
206*** When `doc-view-continuous' is non-nil, scrolling a line 211*** When `doc-view-continuous' is non-nil, scrolling a line
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 732c204f82b..bef37d72e58 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
12009-12-04 Juri Linkov <juri@jurta.org> 12009-12-04 Juri Linkov <juri@jurta.org>
2 2
3 * dired.el (dired-auto-revert-buffer): New defcustom.
4 (dired-internal-noselect): Use it.
5
62009-12-04 Juri Linkov <juri@jurta.org>
7
3 Change roles of modes and functions in image-mode.el (Bug#5062). 8 Change roles of modes and functions in image-mode.el (Bug#5062).
4 9
5 * image-mode.el: Replace `image-mode-maybe' with `image-mode' 10 * image-mode.el: Replace `image-mode-maybe' with `image-mode'
diff --git a/lisp/dired.el b/lisp/dired.el
index f1407c8d80d..c34ff4ec3f7 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -752,6 +752,24 @@ for a remote directory. This feature is used by Auto Revert Mode."
752 buffer-read-only 752 buffer-read-only
753 (dired-directory-changed-p dirname)))) 753 (dired-directory-changed-p dirname))))
754 754
755;;;###autoload
756(defcustom dired-auto-revert-buffer nil
757 "Automatically revert dired buffer on revisiting.
758If t, revisiting an existing dired buffer automatically reverts it.
759If its value is a function, call this function with the directory
760name as single argument and revert the buffer if it returns non-nil.
761Otherwise, a message offering to revert the changed dired buffer
762is displayed.
763Note that this is not the same as `auto-revert-mode' that
764periodically reverts at specified time intervals."
765 :type '(choice
766 (const :tag "Don't revert" nil)
767 (const :tag "Always revert visited dired buffer" t)
768 (const :tag "Revert changed dired buffer" dired-directory-changed-p)
769 (function :tag "Predicate function"))
770 :group 'dired
771 :version "23.2")
772
755(defun dired-internal-noselect (dir-or-list &optional switches mode) 773(defun dired-internal-noselect (dir-or-list &optional switches mode)
756 ;; If there is an existing dired buffer for DIRNAME, just leave 774 ;; If there is an existing dired buffer for DIRNAME, just leave
757 ;; buffer as it is (don't even call dired-revert). 775 ;; buffer as it is (don't even call dired-revert).
@@ -779,6 +797,14 @@ for a remote directory. This feature is used by Auto Revert Mode."
779 (setq dired-directory dir-or-list) 797 (setq dired-directory dir-or-list)
780 ;; this calls dired-revert 798 ;; this calls dired-revert
781 (dired-sort-other switches)) 799 (dired-sort-other switches))
800 ;; Always revert regardless of whether it has changed or not.
801 ((eq dired-auto-revert-buffer t)
802 (revert-buffer))
803 ;; Revert when predicate function returns non-nil.
804 ((functionp dired-auto-revert-buffer)
805 (when (funcall dired-auto-revert-buffer dirname)
806 (revert-buffer)
807 (message "Changed directory automatically updated")))
782 ;; If directory has changed on disk, offer to revert. 808 ;; If directory has changed on disk, offer to revert.
783 ((when (dired-directory-changed-p dirname) 809 ((when (dired-directory-changed-p dirname)
784 (message "%s" 810 (message "%s"