changeset 88232:0e6d3b2196c4

(rmail-inbox-alist): New variable. (rmail-get-file-inbox-list): New function. (rmail-perm-variables): Use it. (rmail-parse-file-inboxes): Deleted.
author Henrik Enberg <henrik.enberg@telia.com>
date Fri, 20 Jan 2006 02:22:58 +0000
parents e304a2bf7bd4
children 7ce784b88079
files lisp/mail/rmail.el
diffstat 1 files changed, 21 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rmail.el	Fri Jan 20 00:42:58 2006 +0000
+++ b/lisp/mail/rmail.el	Fri Jan 20 02:22:58 2006 +0000
@@ -356,6 +356,15 @@
   :group 'rmail-files)
 
 ;;;###autoload
+(defcustom rmail-inbox-alist nil
+  "*Alist of mail files and backup directory names.
+Each element looks like (MAIL-FILE . INBOX-LIST).  Mail files with
+names matching MAIL-FILE will retrieve mail from files in INBOX-LIST."
+  :type '(alist :key-type file :value-type (repeat file))
+  :group 'rmail-retrieve
+  :group 'rmail-files)
+
+;;;###autoload
 (defcustom rmail-mail-new-frame nil
   "*Non-nil means Rmail makes a new frame for composing outgoing mail.
 This is handy if you want to preserve the window configuration of
@@ -1165,7 +1174,7 @@
   (make-local-variable 'rmail-overlay-list)
   (setq rmail-overlay-list nil)
   (make-local-variable 'rmail-inbox-list)
-  (setq rmail-inbox-list (rmail-parse-file-inboxes))
+  (setq rmail-inbox-list (rmail-get-file-inbox-list))
   ;; Provide default set of inboxes for primary mail file ~/RMAIL.
   (and (null rmail-inbox-list)
        (or (equal buffer-file-name (expand-file-name rmail-file-name))
@@ -1237,24 +1246,17 @@
 	  (rmail-show-message rmail-total-messages)
 	  (run-hooks 'rmail-mode-hook)))))
 
-;; NOT DONE
-;; Return a list of files from this buffer's Mail: option.
-;; Does not assume that messages have been parsed.
-;; Just returns nil if buffer does not look like Babyl format.
-(defun rmail-parse-file-inboxes ()
-  (save-excursion
-    (save-restriction
-      (widen)
-      (goto-char 1)
-      (cond ((looking-at "BABYL OPTIONS:")
-	     (search-forward "\n\^_" nil 'move)
-	     (narrow-to-region 1 (point))
-	     (goto-char 1)
-	     (if (search-forward "\nMail:" nil t)
-		 (progn
-		   (narrow-to-region (point) (progn (end-of-line) (point)))
-		   (goto-char (point-min))
-		   (mail-parse-comma-list))))))))
+(defun rmail-get-file-inbox-list ()
+  "Return a list of inbox files for this buffer."
+  (let* ((filename (expand-file-name (buffer-file-name)))
+	 (inboxes (cdr (or (assoc filename rmail-inbox-alist)
+			   (assoc (abbreviate-file-name filename)
+				  rmail-inbox-alist))))
+	 (list nil))
+    (dolist (i inboxes)
+      (when (file-name-absolute-p i)
+	(push (expand-file-name i) list)))
+    (nreverse list)))
 
 ;;; mbox: ready
 (defun rmail-expunge-and-save ()