]> code.delx.au - gnu-emacs/blobdiff - lisp/dired-x.el
Fix race conditions with MS-Windows lock files by using _sopen.
[gnu-emacs] / lisp / dired-x.el
index ece735196866e3bc87825ad4f6ba656f00c2ecb0..3cf6654da2b4148eeef2528e1c92a970c7e3973b 100644 (file)
@@ -1,6 +1,7 @@
 ;;; dired-x.el --- extra Dired functionality
 
-;; Copyright (C) 1993-1994, 1997, 2001-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 1997, 2001-2013 Free Software Foundation,
+;; Inc.
 
 ;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
 ;;     Lawrence R. Dodd <dodd@roebling.poly.edu>
@@ -1343,13 +1344,20 @@ Otherwise obeys the value of `dired-vm-read-only-folders'."
   (rmail (dired-get-filename)))
 
 (defun dired-do-run-mail ()
-  "If `dired-bind-vm' is non-nil, call `dired-vm', else call `dired-rmail'."
+  "Visit the current file as a mailbox, using VM or RMAIL.
+Prompt for confirmation first; if the user says yes, call
+`dired-vm' if `dired-bind-vm' is non-nil, `dired-rmail'
+otherwise."
   (interactive)
-  (if dired-bind-vm
-      ;; Read mail folder using vm.
-      (dired-vm)
-    ;; Read mail folder using rmail.
-    (dired-rmail)))
+  (let ((file (dired-get-filename t)))
+    (if dired-bind-vm
+       (if (y-or-n-p (concat "Visit `" file
+                             "' as a mail folder with VM?"))
+           (dired-vm))
+      ;; Read mail folder using rmail.
+      (if (y-or-n-p (concat "Visit `" file
+                           "' as a mailbox with RMAIL?"))
+         (dired-rmail)))))
 
 \f
 ;;; MISCELLANEOUS INTERNAL FUNCTIONS.