New file.
[bpt/emacs.git] / lisp / mail / rmailmsc.el
1 ;;; rmailmsc.el --- miscellaneous support functions for the RMAIL mail reader
2
3 ;; Copyright (C) 1985, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4
5 ;; Maintainer: FSF
6 ;; Keywords: mail
7
8 ;; This file is part of GNU Emacs.
9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
24
25 ;;; Commentary:
26
27 ;;; Code:
28
29 (defvar rmail-current-message)
30 (defvar rmail-inbox-list)
31
32 ;;;###autoload
33 (defun set-rmail-inbox-list (file-name)
34 "Set the inbox list of the current RMAIL file to FILE-NAME.
35 You can specify one file name, or several names separated by commas.
36 If FILE-NAME is empty, remove any existing inbox list."
37 (interactive "sSet mailbox list to (comma-separated list of filenames): ")
38
39 (unless (eq major-mode 'rmail-mode)
40 (error "set-rmail-inbox-list works only for an Rmail file"))
41
42 (save-excursion
43 (let ((names (rmail-parse-file-inboxes))
44 (standard-output nil))
45 (if (or (not names)
46 (y-or-n-p (concat "Replace "
47 (mapconcat 'identity names ", ")
48 "? ")))
49 (let ((buffer-read-only nil))
50 (widen)
51 (goto-char (point-min))
52 (search-forward "\n\^_")
53 (re-search-backward "^Mail" nil t)
54 (forward-line 0)
55 (if (looking-at "Mail:")
56 (delete-region (point)
57 (progn (forward-line 1)
58 (point))))
59 (if (not (string= file-name ""))
60 (insert-before-markers "Mail: " file-name "\n"))))))
61 (setq rmail-inbox-list (rmail-parse-file-inboxes))
62 (rmail-show-message rmail-current-message))
63
64 ;;; arch-tag: 74ed1d50-2c25-4cbd-b5ae-d29ed8aba6e4
65 ;;; rmailmsc.el ends here