*** empty log message ***
[bpt/emacs.git] / lisp / mail / rmailmsc.el
CommitLineData
c88ab9ce
ER
1;;; rmailmsc.el --- miscellaneous support functions for the RMAIL mail reader
2
9750e079
ER
3;; Copyright (C) 1985 Free Software Foundation, Inc.
4
e5167999 5;; Maintainer: FSF
d7b4d18f 6;; Keywords: mail
e5167999 7
0d20f9a0
JB
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
e5167999 12;; the Free Software Foundation; either version 2, or (at your option)
0d20f9a0
JB
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
b578f267
EN
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23;; Boston, MA 02111-1307, USA.
0d20f9a0 24
76550a57 25;;; Code:
0d20f9a0 26
19ee6bfc 27;;;###autoload
0d20f9a0
JB
28(defun set-rmail-inbox-list (file-name)
29 "Set the inbox list of the current RMAIL file to FILE-NAME.
7e3333dd
RS
30You can specify one file name, or several names separated by commas.
31If FILE-NAME is empty, remove any existing inbox list."
0d20f9a0 32 (interactive "sSet mailbox list to (comma-separated list of filenames): ")
349b1f31
RS
33
34 (unless (eq major-mode 'rmail-mode)
35 (error "set-rmail-inbox-list works only for an Rmail file"))
36
0d20f9a0
JB
37 (save-excursion
38 (let ((names (rmail-parse-file-inboxes))
39 (standard-output nil))
40 (if (or (not names)
41 (y-or-n-p (concat "Replace "
42 (mapconcat 'identity names ", ")
43 "? ")))
44 (let ((buffer-read-only nil))
45 (widen)
46 (goto-char (point-min))
47 (search-forward "\n\^_")
48 (re-search-backward "^Mail" nil t)
49 (forward-line 0)
50 (if (looking-at "Mail:")
51 (delete-region (point)
52 (progn (forward-line 1)
53 (point))))
54 (if (not (string= file-name ""))
eedf8416 55 (insert-before-markers "Mail: " file-name "\n"))))))
0d20f9a0
JB
56 (setq rmail-inbox-list (rmail-parse-file-inboxes))
57 (rmail-show-message rmail-current-message))
c88ab9ce
ER
58
59;;; rmailmsc.el ends here