Initial Commit
[packages] / xemacs-packages / dired / dired-xy.el
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ;;
3 ;; File:          dired-xy.el
4 ;; Dired Version: 7.17
5 ;; RCS:
6 ;; Description:   Commands for reading mail from dired.
7 ;;
8 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9
10 ;;; Requirements and provisions
11 (provide 'dired-xy)
12 (require 'dired)
13
14 ;;; Special request: Will an mh-e user please write some mh support in here?
15
16 ;;;###autoload
17 (defun dired-read-mail (&optional arg)
18   "Reads the current file as a mail folder.
19 Uses the setting of `dired-mail-reader' to determine which reader to use.
20 Possibilities are VM or RMAIL. With a prefix arg, visits the folder read-only\;
21 this only works with VM."
22   (interactive "P")
23   (cond
24    ((eq dired-mail-reader 'vm)
25     (dired-vm arg))
26    ((eq dired-mail-reader 'rmail)
27     (dired-rmail)) ; doesn't take read-only arg.
28    (t (error "Never heard of the mail reader %s" dired-mail-reader))))
29
30 ;; Read-only folders only work in VM 5, not in VM 4.
31 ;;;###autoload
32 (defun dired-vm (&optional read-only)
33   "Run VM on this file.
34 With prefix arg, visit folder read-only (this requires at least VM 5).
35 See also variable `dired-vm-read-only-folders'."
36   (interactive "P")
37   (let ((dir (dired-current-directory))
38         (fil (dired-get-filename)))
39     ;; take care to supply 2nd arg only if requested - may still run VM 4!
40     (require 'vm) ; vm-visit-folder may not be an autoload
41     (setq this-command 'vm-visit-folder) ; for vm window config
42     (if read-only
43         (vm-visit-folder fil t)
44       (vm-visit-folder fil))
45     ;; so that pressing `v' inside VM does prompt within current directory:
46     (set (make-local-variable 'vm-folder-directory) dir)))
47
48 ;;;###autoload
49 (defun dired-rmail ()
50   "Run RMAIL on this file."
51   (interactive)
52   (rmail (dired-get-filename)))
53
54 ;; end of dired-xy.el
55