From d00b3c684264c0481ae07793d388c3e2f4185bad Mon Sep 17 00:00:00 2001 From: Henrik Enberg Date: Fri, 20 Jan 2006 02:23:17 +0000 Subject: [PATCH] (rmail-inbox-alist): New variable. (rmail-get-file-inbox-list): New function. (rmail-perm-variables): Use it. (rmail-parse-file-inboxes): Deleted. --- lisp/mail/ChangeLog | 7 +++++++ lisp/mail/rmail.el | 40 +++++++++++++++++++++------------------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/lisp/mail/ChangeLog b/lisp/mail/ChangeLog index 4fb8bbae380..40cbef3b2f9 100644 --- a/lisp/mail/ChangeLog +++ b/lisp/mail/ChangeLog @@ -1,3 +1,10 @@ +2006-01-20 Henrik Enberg + + * rmail.el: (rmail-inbox-alist): New variable. + (rmail-get-file-inbox-list): New function. + (rmail-perm-variables): Use it. + (rmail-parse-file-inboxes): Deleted. + 2006-01-20 Alex Schroeder * rmailsum.el (rmail-summary-mode): Fixed typo in doc string and diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index fdcbc9b0faa..35722edc182 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -355,6 +355,15 @@ and the value of the environment variable MAIL overrides it)." :group 'rmail-retrieve :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. @@ -1165,7 +1174,7 @@ Instead, these commands are available: (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 @@ Instead, these commands are available: (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 () -- 2.39.5