Mercurial > emacs
comparison lisp/mail/mspools.el @ 19041:036cc3196550
(mspools-using-vm): Better handling of VM initialization.
(mspools-size-folder): Allow symbolic links to spool files.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 30 Jul 1997 16:12:30 +0000 |
parents | a9e35f5eea9a |
children | e50604c01474 |
comparison
equal
deleted
inserted
replaced
19040:c0dc58ad2d47 | 19041:036cc3196550 |
---|---|
1 ;;; mspools.el --- Show mail spools waiting to be read | 1 ;;; mspools.el --- Show mail spools waiting to be read |
2 | 2 |
3 ;; Copyright (C) 1997 Stephen Eglen | 3 ;; Copyright (C) 1997 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Stephen Eglen <stephen@cns.ed.ac.uk> | 5 ;; Author: Stephen Eglen <stephen@cns.ed.ac.uk> |
6 ;; Maintainer: Stephen Eglen <stephen@cns.ed.ac.uk> | 6 ;; Maintainer: Stephen Eglen <stephen@cns.ed.ac.uk> |
7 ;; Created: 22 Jan 1997 | 7 ;; Created: 22 Jan 1997 |
8 ;; Keywords: mail | 8 ;; Keywords: mail |
31 ;; is written by the filter to a file called `folder.spool'. (If the | 31 ;; is written by the filter to a file called `folder.spool'. (If the |
32 ;; file writes directly to `folder' you may lose mail if new mail | 32 ;; file writes directly to `folder' you may lose mail if new mail |
33 ;; arrives whilst you are reading the folder in emacs, hence the use | 33 ;; arrives whilst you are reading the folder in emacs, hence the use |
34 ;; of a spool file.) For example, the following procmail recipe puts | 34 ;; of a spool file.) For example, the following procmail recipe puts |
35 ;; any mail with `emacs' in the subject line into the spool file | 35 ;; any mail with `emacs' in the subject line into the spool file |
36 ;; `apple.spool', ready to go into the folder `emacs'. | 36 ;; `emacs.spool', ready to go into the folder `emacs'. |
37 ;:0: | 37 ;:0: |
38 ;* ^Subject.*emacs | 38 ;* ^Subject.*emacs |
39 ;emacs.spool | 39 ;emacs.spool |
40 | 40 |
41 ;; It also assumes that all of your spool files and mail folders live | 41 ;; It also assumes that all of your spool files and mail folders live |
60 | 60 |
61 ;; Basic | 61 ;; Basic |
62 ;(autoload 'mspools-show "mspools" "Show outstanding mail spools." t) | 62 ;(autoload 'mspools-show "mspools" "Show outstanding mail spools." t) |
63 ; Point to directory where spool files and folders are: | 63 ; Point to directory where spool files and folders are: |
64 ; (setq mspools-folder-directory "~/MAIL/") | 64 ; (setq mspools-folder-directory "~/MAIL/") |
65 ; | |
66 ; If you use VM, mspools-folder-directory will default to vm-folder-directory | |
67 ; unless you have already given it a value. | |
65 | 68 |
66 ;; Extras | 69 ;; Extras |
67 ; possibly bind it to a key: | 70 ; possibly bind it to a key: |
68 ;(global-set-key '[S-f1] 'mspools-show) | 71 ;(global-set-key '[S-f1] 'mspools-show) |
69 ;(setq mspools-update t) | 72 ;(setq mspools-update t) |
142 "Name of buffer for displaying spool info.") | 145 "Name of buffer for displaying spool info.") |
143 | 146 |
144 (defvar mspools-mode-map nil | 147 (defvar mspools-mode-map nil |
145 "Keymap for the *spools* buffer.") | 148 "Keymap for the *spools* buffer.") |
146 | 149 |
147 (defvar mspools-folder-directory | 150 (defvar mspools-folder-directory |
148 (if (boundp 'vm-folder-directory) | 151 (if (boundp 'vm-folder-directory) |
149 vm-folder-directory | 152 vm-folder-directory |
150 nil) | 153 nil) |
151 "Directory where mail folders are kept. Defaults to | 154 "Directory where mail folders are kept. Defaults to |
152 `vm-folder-directory' if bound else nil. Make sure it has a trailing / | 155 `vm-folder-directory' if bound else nil. Make sure it has a trailing / |
160 | 163 |
161 ;;; Code | 164 ;;; Code |
162 | 165 |
163 ;;; VM Specific code | 166 ;;; VM Specific code |
164 (if mspools-using-vm | 167 (if mspools-using-vm |
165 (require 'vm-vars)) | 168 ;; set up vm if not already loaded. |
169 (progn | |
170 (require 'vm-vars) | |
171 (if (not vm-init-file-loaded) | |
172 (load-file vm-init-file)) | |
173 (if (not mspools-folder-directory) | |
174 (setq mspools-folder-directory vm-folder-directory)) | |
175 )) | |
166 | 176 |
167 (defun mspools-set-vm-spool-files () | 177 (defun mspools-set-vm-spool-files () |
168 "Set value of `vm-spool-files'. Only needed for VM." | 178 "Set value of `vm-spool-files'. Only needed for VM." |
169 (setq | 179 (setq |
170 vm-spool-files | 180 vm-spool-files |
175 mspools-vm-system-mail; your mailbox | 185 mspools-vm-system-mail; your mailbox |
176 mspools-vm-system-mail-crash ; crash for mailbox | 186 mspools-vm-system-mail-crash ; crash for mailbox |
177 )) | 187 )) |
178 | 188 |
179 ;; Mailing list inboxes | 189 ;; Mailing list inboxes |
190 ;; must have VM already loaded to get vm-folder-directory. | |
180 (mapcar '(lambda (s) | 191 (mapcar '(lambda (s) |
181 "make the appropriate entry for vm-spool-files" | 192 "make the appropriate entry for vm-spool-files" |
182 (list | 193 (list |
183 (concat vm-folder-directory s) | 194 (concat vm-folder-directory s) |
184 (concat vm-folder-directory s "." mspools-suffix) | 195 (concat vm-folder-directory s "." mspools-suffix) |
334 | 345 |
335 (defun mspools-mode () | 346 (defun mspools-mode () |
336 "Major mode for output from mspools-show. | 347 "Major mode for output from mspools-show. |
337 \\<mspools-mode-map>Move point to one of the items in this buffer, then use | 348 \\<mspools-mode-map>Move point to one of the items in this buffer, then use |
338 \\[mspools-visit-spool] to go to the spool that the current line refers to. | 349 \\[mspools-visit-spool] to go to the spool that the current line refers to. |
339 \\[mspools-show-again] to regenerate the list of spools. | 350 \\[revert-buffer] to regenerate the list of spools. |
340 \\{mspools-mode-map}" | 351 \\{mspools-mode-map}" |
341 (kill-all-local-variables) | 352 (kill-all-local-variables) |
342 (make-local-variable 'revert-buffer-function) | 353 (make-local-variable 'revert-buffer-function) |
343 (setq revert-buffer-function 'mspools-revert-buffer) | 354 (setq revert-buffer-function 'mspools-revert-buffer) |
344 (use-local-map mspools-mode-map) | 355 (use-local-map mspools-mode-map) |
379 | 390 |
380 | 391 |
381 (defun mspools-size-folder (spool) | 392 (defun mspools-size-folder (spool) |
382 "Return (SPOOL . SIZE ) iff SIZE of spool file is non-zero." | 393 "Return (SPOOL . SIZE ) iff SIZE of spool file is non-zero." |
383 ;; 7th file attribute is the size of the file in bytes. | 394 ;; 7th file attribute is the size of the file in bytes. |
384 (let ((size (nth 7 | 395 (let ((file (concat mspools-folder-directory spool)) |
385 (file-attributes (concat mspools-folder-directory spool))))) | 396 size) |
386 ;; todo (if (and (not (null size)) (> size 0)) | 397 (setq file (or (file-symlink-p file) file)) |
398 (setq size (nth 7 (file-attributes file))) | |
387 (if (> size 0) | 399 (if (> size 0) |
388 (cons spool size) | 400 (cons spool size) |
389 ;; else SPOOL is empty | 401 ;; else SPOOL is empty |
390 nil))) | 402 nil))) |
391 | 403 |
392 (provide 'mspools) | 404 (provide 'mspools) |
393 ;;; MSPOOLS.EL ends here | 405 ;;; mspools.el ends here |
406 |