*** empty log message ***
[bpt/emacs.git] / lisp / mail / rmailmsc.el
1 ;; Copyright (C) 1985 Free Software Foundation, Inc.
2
3 ;; This file is part of GNU Emacs.
4
5 ;; GNU Emacs is free software; you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 1, or (at your option)
8 ;; any later version.
9
10 ;; GNU Emacs is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;; GNU General Public License for more details.
14
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with GNU Emacs; see the file COPYING. If not, write to
17 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18
19
20 (defun set-rmail-inbox-list (file-name)
21 "Set the inbox list of the current RMAIL file to FILE-NAME.
22 This may be a list of file names separated by commas.
23 If FILE-NAME is empty, remove any inbox list."
24 (interactive "sSet mailbox list to (comma-separated list of filenames): ")
25 (save-excursion
26 (let ((names (rmail-parse-file-inboxes))
27 (standard-output nil))
28 (if (or (not names)
29 (y-or-n-p (concat "Replace "
30 (mapconcat 'identity names ", ")
31 "? ")))
32 (let ((buffer-read-only nil))
33 (widen)
34 (goto-char (point-min))
35 (search-forward "\n\^_")
36 (re-search-backward "^Mail" nil t)
37 (forward-line 0)
38 (if (looking-at "Mail:")
39 (delete-region (point)
40 (progn (forward-line 1)
41 (point))))
42 (if (not (string= file-name ""))
43 (insert "Mail: " file-name "\n"))))))
44 (setq rmail-inbox-list (rmail-parse-file-inboxes))
45 (rmail-show-message rmail-current-message))