comparison lisp/mail/rmailmsc.el @ 88237:a98285deef68

(set-rmail-inbox-list): Rewrite to only set inbox list temporarily for a session.
author Henrik Enberg <henrik.enberg@telia.com>
date Fri, 20 Jan 2006 16:27:37 +0000
parents d7ddb3e565de
children
comparison
equal deleted inserted replaced
88236:c4d7d203421c 88237:a98285deef68
36 (defun set-rmail-inbox-list (file-name) 36 (defun set-rmail-inbox-list (file-name)
37 "Set the inbox list of the current RMAIL file to FILE-NAME. 37 "Set the inbox list of the current RMAIL file to FILE-NAME.
38 You can specify one file name, or several names separated by commas. 38 You can specify one file name, or several names separated by commas.
39 If FILE-NAME is empty, remove any existing inbox list." 39 If FILE-NAME is empty, remove any existing inbox list."
40 (interactive "sSet mailbox list to (comma-separated list of filenames): ") 40 (interactive "sSet mailbox list to (comma-separated list of filenames): ")
41
42 (unless (eq major-mode 'rmail-mode) 41 (unless (eq major-mode 'rmail-mode)
43 (error "set-rmail-inbox-list works only for an Rmail file")) 42 (error "set-rmail-inbox-list works only for an Rmail file"))
44 43 (let ((inbox-list
45 (save-excursion 44 (with-temp-buffer
46 (let ((names (rmail-parse-file-inboxes)) 45 (insert file-name)
47 (standard-output nil)) 46 (goto-char (point-min))
48 (if (or (not names) 47 (nreverse (mail-parse-comma-list)))))
48 (when (or (not rmail-inbox-list)
49 (y-or-n-p (concat "Replace " 49 (y-or-n-p (concat "Replace "
50 (mapconcat 'identity names ", ") 50 (mapconcat 'identity
51 rmail-inbox-list
52 ", ")
51 "? "))) 53 "? ")))
52 (let ((buffer-read-only nil)) 54 (message "Setting the inbox list for %s for this session"
53 (widen) 55 (file-name-nondirectory (buffer-file-name)))
54 (goto-char (point-min)) 56 (setq rmail-inbox-list inbox-list)))
55 (search-forward "\n\^_")
56 (re-search-backward "^Mail" nil t)
57 (forward-line 0)
58 (if (looking-at "Mail:")
59 (delete-region (point)
60 (progn (forward-line 1)
61 (point))))
62 (if (not (string= file-name ""))
63 (insert-before-markers "Mail: " file-name "\n"))))))
64 (setq rmail-inbox-list (rmail-parse-file-inboxes))
65 (rmail-show-message rmail-current-message)) 57 (rmail-show-message rmail-current-message))
66 58
67 ;;; arch-tag: 74ed1d50-2c25-4cbd-b5ae-d29ed8aba6e4 59 ;;; arch-tag: 74ed1d50-2c25-4cbd-b5ae-d29ed8aba6e4
68 ;;; rmailmsc.el ends here 60 ;;; rmailmsc.el ends here