~ubuntu-branches/ubuntu/karmic/emacs-snapshot/karmic

« back to all changes in this revision

Viewing changes to lisp/mail/rmailmsc.el

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2009-04-05 09:14:30 UTC
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: james.westby@ubuntu.com-20090405091430-nw07lynn2arotjbe
Tags: upstream-20090320
ImportĀ upstreamĀ versionĀ 20090320

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
;;; rmailmsc.el --- miscellaneous support functions for the RMAIL mail reader
2
2
 
3
 
;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005,
4
 
;;   2006, 2007, 2008 Free Software Foundation, Inc.
 
3
;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
 
4
;;   2009  Free Software Foundation, Inc.
5
5
 
6
6
;; Maintainer: FSF
7
7
;; Keywords: mail
25
25
 
26
26
;;; Code:
27
27
 
28
 
(defvar rmail-current-message)
29
 
(defvar rmail-inbox-list)
30
 
 
31
 
(declare-function rmail-parse-file-inboxes "rmail" ())
32
 
(declare-function rmail-show-message "rmail" (&optional n no-summary))
 
28
(require 'rmail)
33
29
 
34
30
;;;###autoload
35
31
(defun set-rmail-inbox-list (file-name)
36
32
  "Set the inbox list of the current RMAIL file to FILE-NAME.
37
33
You can specify one file name, or several names separated by commas.
38
 
If FILE-NAME is empty, remove any existing inbox list."
 
34
If FILE-NAME is empty, remove any existing inbox list.
 
35
 
 
36
This applies only to the current session."
39
37
  (interactive "sSet mailbox list to (comma-separated list of filenames): ")
40
 
 
41
38
  (unless (eq major-mode 'rmail-mode)
42
39
    (error "set-rmail-inbox-list works only for an Rmail file"))
43
 
 
44
 
  (save-excursion
45
 
    (let ((names (rmail-parse-file-inboxes))
46
 
          (standard-output nil))
47
 
      (if (or (not names)
 
40
  (let ((inbox-list
 
41
         (with-temp-buffer
 
42
           (insert file-name)
 
43
           (goto-char (point-min))
 
44
           (nreverse (mail-parse-comma-list)))))
 
45
    (when (or (not rmail-inbox-list)
48
46
              (y-or-n-p (concat "Replace "
49
 
                                (mapconcat 'identity names ", ")
 
47
                                (mapconcat 'identity
 
48
                                           rmail-inbox-list
 
49
                                           ", ")
50
50
                                "? ")))
51
 
          (let ((buffer-read-only nil))
52
 
            (widen)
53
 
            (goto-char (point-min))
54
 
            (search-forward "\n\^_")
55
 
            (re-search-backward "^Mail" nil t)
56
 
            (forward-line 0)
57
 
            (if (looking-at "Mail:")
58
 
                (delete-region (point)
59
 
                               (progn (forward-line 1)
60
 
                                      (point))))
61
 
            (if (not (string= file-name ""))
62
 
                (insert-before-markers "Mail: " file-name "\n"))))))
63
 
  (setq rmail-inbox-list (rmail-parse-file-inboxes))
64
 
  (rmail-show-message rmail-current-message))
 
51
      (message "Setting the inbox list for %s for this session"
 
52
               (file-name-nondirectory (buffer-file-name)))
 
53
      (setq rmail-inbox-list inbox-list)))
 
54
  (rmail-show-message-1 rmail-current-message))
65
55
 
66
 
;; arch-tag: 74ed1d50-2c25-4cbd-b5ae-d29ed8aba6e4
 
56
;; arch-tag: 94614a62-2a0a-4e25-bac9-06f461ed4c60
67
57
;;; rmailmsc.el ends here