| 1 | ;;; rmailmsc.el --- miscellaneous support functions for the RMAIL mail reader |
| 2 | |
| 3 | ;; Copyright (C) 1985, 2001-2012 Free Software Foundation, Inc. |
| 4 | |
| 5 | ;; Maintainer: FSF |
| 6 | ;; Keywords: mail |
| 7 | ;; Package: rmail |
| 8 | |
| 9 | ;; This file is part of GNU Emacs. |
| 10 | |
| 11 | ;; GNU Emacs is free software: you can redistribute it and/or modify |
| 12 | ;; it under the terms of the GNU General Public License as published by |
| 13 | ;; the Free Software Foundation, either version 3 of the License, or |
| 14 | ;; (at your option) any later version. |
| 15 | |
| 16 | ;; GNU Emacs is distributed in the hope that it will be useful, |
| 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | ;; GNU General Public License for more details. |
| 20 | |
| 21 | ;; You should have received a copy of the GNU General Public License |
| 22 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
| 23 | |
| 24 | ;;; Commentary: |
| 25 | |
| 26 | ;;; Code: |
| 27 | |
| 28 | (require 'rmail) |
| 29 | |
| 30 | ;;;###autoload |
| 31 | (defun set-rmail-inbox-list (file-name) |
| 32 | "Set the inbox list of the current RMAIL file to FILE-NAME. |
| 33 | You can specify one file name, or several names separated by commas. |
| 34 | If FILE-NAME is empty, remove any existing inbox list. |
| 35 | |
| 36 | This applies only to the current session." |
| 37 | (interactive "sSet mailbox list to (comma-separated list of filenames): ") |
| 38 | (unless (eq major-mode 'rmail-mode) |
| 39 | (error "set-rmail-inbox-list works only for an Rmail file")) |
| 40 | (let ((inbox-list |
| 41 | (with-temp-buffer |
| 42 | (insert file-name) |
| 43 | (goto-char (point-min)) |
| 44 | ;; split-string does not remove leading/trailing whitespace. |
| 45 | (nreverse (mail-parse-comma-list))))) |
| 46 | (when (or (not rmail-inbox-list) |
| 47 | (y-or-n-p (concat "Replace " |
| 48 | (mapconcat 'identity |
| 49 | rmail-inbox-list |
| 50 | ", ") |
| 51 | "? "))) |
| 52 | (message "Setting the inbox list for %s for this session" |
| 53 | (file-name-nondirectory (buffer-file-name))) |
| 54 | (setq rmail-inbox-list inbox-list))) |
| 55 | (rmail-show-message-1 rmail-current-message)) |
| 56 | |
| 57 | ;; Local Variables: |
| 58 | ;; generated-autoload-file: "rmail.el" |
| 59 | ;; End: |
| 60 | |
| 61 | ;;; rmailmsc.el ends here |