annotate lisp/rmail/rmail.el @ 108:360340f9fd5f r20-1b6

Import from CVS: tag r20-1b6
author cvs
date Mon, 13 Aug 2007 09:18:39 +0200
parents 364816949b59
children fe104dbd9147
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; rmail.el --- main code of "RMAIL" mail reader for Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
3 ;; Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
4 ;;; Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Maintainer: FSF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; Keywords: mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
24 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; Souped up by shane@mit-ajax based on ideas of rlk@athena.mit.edu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; New features include attribute and keyword support, message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; selection by dispatch table, summary by attributes and keywords,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;; expunging by dispatch table, sticky options for file commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; Extended by Bob Weiner of Motorola
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; New features include: rmail and rmail-summary buffers remain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; synchronized and key bindings basically operate the same way in both
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; buffers, summary by topic or by regular expression, rmail-reply-prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; variable, and a bury rmail buffer (wipe) command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (require 'mail-utils)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; For Emacs V18 compatibility
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (and (not (fboundp 'user-original-login-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (fboundp 'user-real-login-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (defalias 'user-original-login-name 'user-real-login-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (and (not (fboundp 'buffer-disable-undo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (fboundp 'buffer-flush-undo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (defalias 'buffer-disable-undo 'buffer-flush-undo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ; These variables now declared in paths.el.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;(defvar rmail-spool-directory "/usr/spool/mail/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ; "This is the name of the directory used by the system mailer for\n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;delivering new mail. It's name should end with a slash.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;(defvar rmail-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ; (expand-file-name "~/RMAIL")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ; "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (defvar rmail-dont-reply-to-names nil "\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 *A regexp specifying names to prune of reply to messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 A value of nil means exclude your own name only.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (defvar rmail-default-dont-reply-to-names "info-" "\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 A regular expression specifying part of the value of the default value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 the variable `rmail-dont-reply-to-names', for when the user does not set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 `rmail-dont-reply-to-names' explicitly. (The other part of the default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 value is the user's name.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 It is useful to set this variable in the site customization file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;;; XEmacs change: moved rmail-ignored-headers to sendmail.el for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 ;;; benefit of automatically generated autoloads.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 ;;;minimalist FSF version
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
74 ;(defvar rmail-ignored-headers "^via:\\|^mail-from:\\|^origin:\\|^status:\\|^received:\\|^message-id:\\|^summary-line:" "\
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ;*Gubbish headers one would rather not see.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (defvar rmail-delete-after-output nil "\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 *Non-nil means automatically delete a message that is copied to a file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (defvar rmail-primary-inbox-list nil "\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 *List of files which are inboxes for user's primary mail file `~/RMAIL'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 `nil' means the default, which is (\"/usr/spool/mail/$USER\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 \(the name varies depending on the operating system,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 and the value of the environment variable MAIL overrides it).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (defvar rmail-mail-new-frame nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 "*Non-nil means Rmail makes a new frame for composing outgoing mail.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (defvar rmail-retry-setup-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 "Hook that `rmail-retry-failure' uses in place of `mail-setup-hook'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ;; These may be altered by site-init.el to match the format of mmdf files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 ;; delimiting used on a given host (delim1 and delim2 from the config
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 ;; files).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (defvar mmdf-delim1 "^\001\001\001\001\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 "Regexp marking the start of an mmdf message")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (defvar mmdf-delim2 "^\001\001\001\001\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 "Regexp marking the end of an mmdf message")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (defvar rmail-message-filter nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 "If non nil, is a filter function for new headers in RMAIL.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 Called with region narrowed to unformatted header.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (defvar rmail-reply-prefix "Re: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 "String to prepend to Subject line when replying to a message.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (defvar rmail-mode-map nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (defvar rmail-inbox-list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (defvar rmail-keywords nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 ;; Message counters and markers. Deleted flags.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (defvar rmail-current-message nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (defvar rmail-total-messages nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (defvar rmail-message-vector nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (defvar rmail-deleted-vector nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 ;; These are used by autoloaded rmail-summary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (defvar rmail-summary-buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (defvar rmail-summary-vector nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ;; `Sticky' default variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 ;; Last individual label specified to a or k.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (defvar rmail-last-label nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 ;; Last set of values specified to C-M-n, C-M-p, C-M-s or C-M-l.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (defvar rmail-last-multi-labels nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (defvar rmail-last-file nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (defvar rmail-last-regexp nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (defvar rmail-last-rmail-file (expand-file-name "~/XMAIL"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 ;;; Regexp matching the delimiter of messages in UNIX mail format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ;;; (UNIX From lines), minus the initial ^. Note that if you change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ;;; this expression, you must change the code in rmail-nuke-pinhead-header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ;;; that knows the exact ordering of the \\( \\) subexpressions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (defvar rmail-unix-mail-delimiter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (let ((time-zone-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (concat "\\([A-Z]?[A-Z][A-Z][A-Z]\\( DST\\)?"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 "\\|[-+]?[0-9][0-9][0-9][0-9]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 "\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 "\\) *")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 "From "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 ;; Username, perhaps with a quoted section that can contain spaces.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 "\\("
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 "[^ \n]*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 "\\(\\|\".*\"[^ \n]*\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 "\\) ?"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ;; The time the message was sent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 "\\([^ \n]*\\) *" ; day of the week
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 "\\([^ ]*\\) *" ; month
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 "\\([0-9]*\\) *" ; day of month
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 "\\([0-9:]*\\) *" ; time of day
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 ;; Perhaps a time zone, specified by an abbreviation, or by a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;; numeric offset.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 time-zone-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 ;; The year.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 " [0-9][0-9]\\([0-9]*\\) *"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 ;; On some systems the time zone can appear after the year, too.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 time-zone-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 ;; I'm not sure what this is.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 "\\(remote from [^\n]*\\)?"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ;; Perform BODY in the summary buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ;; in such a way that its cursor is properly updated in its own window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (defmacro rmail-select-summary (&rest body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (` (progn (if (rmail-summary-displayed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (let ((window (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (pop-to-buffer rmail-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (,@ body))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (select-window window))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (set-buffer rmail-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (progn (,@ body))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (rmail-maybe-display-summary))))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
196
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
197
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
198 ;;; 1996/12/9 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
199
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
200 ;;; @ for mule and MIME
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
201 ;;;
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
202
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
203 (require 'tm-view)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
204
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
205 (defconst rmail-support-mime t)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
206 (defvar rmail-show-mime t)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
207 (defvar rmail-show-mime-method (function rmail-show-mime-message))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
208
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
209 (defun rmail-show-all-header ()
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
210 (rmail-maybe-set-message-counters)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
211 (narrow-to-region (rmail-msgbeg rmail-current-message) (point-max))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
212 (let ((buffer-read-only nil))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
213 (goto-char (point-min))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
214 (forward-line 1)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
215 (if (= (following-char) ?1)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
216 (progn
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
217 (delete-char 1)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
218 (insert ?0)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
219 (forward-line 1)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
220 (let ((case-fold-search t))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
221 (while (looking-at "Summary-Line:\\|Mail-From:")
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
222 (forward-line 1)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
223 (insert "*** EOOH ***\n")
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
224 (forward-char -1)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
225 (search-forward "\n*** EOOH ***\n")
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
226 (forward-line -1)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
227 (let ((temp (point)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
228 (and (search-forward "\n\n" nil t)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
229 (delete-region temp (point))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
230 (goto-char (point-min))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
231 (search-forward "\n*** EOOH ***\n")
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
232 (narrow-to-region (point) (point-max)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
233 )))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
234
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
235 (defun rmail-show-mime-message ()
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
236 (rmail-show-all-header)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
237 (let ((abuf (current-buffer))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
238 (buf-name (format "*Preview-%s [%d/%d]*"
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
239 (buffer-name)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
240 rmail-current-message rmail-total-messages))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
241 buf win)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
242 (if (and mime::article/preview-buffer
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
243 (setq buf (get-buffer mime::article/preview-buffer))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
244 )
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
245 (progn
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
246 (save-excursion
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
247 (set-buffer buf)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
248 (rename-buffer buf-name)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
249 )
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
250 (if (setq win (get-buffer-window buf))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
251 (progn
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
252 (delete-window (get-buffer-window abuf))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
253 (set-window-buffer win abuf)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
254 (set-buffer abuf)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
255 ))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
256 ))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
257 (setq win (get-buffer-window abuf))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
258 (save-window-excursion
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
259 (mime/viewer-mode nil nil nil nil buf-name rmail-mode-map)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
260 (or buf
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
261 (setq buf (current-buffer))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
262 )
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
263 )
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
264 (set-window-buffer win buf)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
265 ))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
266
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
267 (set-alist 'mime-viewer/code-converter-alist
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
268 'rmail-mode
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
269 (function mime-charset/decode-buffer))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
270
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
271 (set-alist 'mime-viewer/quitting-method-alist
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
272 'rmail-mode
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
273 (function rmail-quit)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
274 )
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
275
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
276 (set-alist 'mime-viewer/over-to-previous-method-alist
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
277 'rmail-mode
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
278 (function
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
279 (lambda ()
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
280 (rmail-previous-undeleted-message 1)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
281 )))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
282
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
283 (set-alist 'mime-viewer/over-to-next-method-alist
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
284 'rmail-mode
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
285 (function
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
286 (lambda ()
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
287 (rmail-next-undeleted-message 1)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
288 )))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
289
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
290 (set-alist 'mime-viewer/show-summary-method
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
291 'rmail-mode
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
292 (function rmail-summary))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
293
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 ;;;; *** Rmail Mode ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (defun rmail (&optional file-name-arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 "Read and edit incoming mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 Moves messages into file named by `rmail-file-name' (a babyl format file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 and edits that file in RMAIL Mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 Type \\[describe-mode] once editing that file, for a list of RMAIL commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 May be called with filename as argument; then performs rmail editing on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 that file, but does not copy any new mail into the file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (interactive (if current-prefix-arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (list (read-file-name "Run rmail on RMAIL file: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 nil nil t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (if (string-match "XEmacs" emacs-version)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
310 (require 'rmail-xemacs))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (or rmail-last-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (setq rmail-last-file (expand-file-name "~/xmail")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (let* ((file-name (expand-file-name (or file-name-arg rmail-file-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (existed (get-file-buffer file-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 ;; Like find-file, but in the case where a buffer existed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 ;; and the file was reverted, recompute the message-data.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (if (and existed (not (verify-visited-file-modtime existed)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 ;; Don't be confused by apparent local-variables spec
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 ;; in the last message in the RMAIL file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (let ((enable-local-variables nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (find-file file-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (if (and (verify-visited-file-modtime existed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (eq major-mode 'rmail-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (progn (rmail-forget-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (rmail-set-message-counters))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (let ((enable-local-variables nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (find-file file-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (if (eq major-mode 'rmail-edit-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (error "Exit Rmail Edit mode before getting new mail."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (if (and existed (> (buffer-size) 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 ;; Buffer not new and not empty; ensure in proper mode, but that's all.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (or (eq major-mode 'rmail-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (rmail-mode-2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (rmail-mode-2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 ;; Convert all or part to Babyl file if possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (rmail-convert-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (if (null rmail-inbox-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (rmail-set-message-counters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (rmail-show-message))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (let ((existing-unseen (rmail-first-unseen-message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (or file-name-arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (rmail-get-new-mail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 ;; Show the first unseen message, which might be from a previous session
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 ;; or might have been just read in by rmail-get-new-mail. Must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 ;; determine already unseen messages first, as rmail-get-new-mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 ;; positions on the first new message, thus marking it as seen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (rmail-show-message existing-unseen))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 ;; Given the value of MAILPATH, return a list of inbox file names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 ;; This is turned off because it is not clear that the user wants
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 ;; all these inboxes to feed into the primary rmail file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 ; (defun rmail-convert-mailpath (string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 ; (let (idx list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 ; (while (setq idx (string-match "[%:]" string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 ; (let ((this (substring string 0 idx)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 ; (setq string (substring string (1+ idx)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 ; (setq list (cons (if (string-match "%" this)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 ; (substring this 0 (string-match "%" this))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 ; this)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 ; list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 ; list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 ;; Someone said:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 ; I have checked that adding "-*- rmail -*-" to the BABYL OPTIONS line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 ; will not cause emacs 18.55 problems.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 ;; To which jwz responds: maybe so but it's damned annoying so don't do it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (defun rmail-convert-file ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (let (convert)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 ;; If file doesn't start like a Babyl file,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 ;; convert it to one, by adding a header and converting each message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (cond ((looking-at "BABYL OPTIONS:"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 ((looking-at "Version: 5\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 ;; Losing babyl file made by old version of Rmail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 ;; Just fix the babyl file header; don't make a new one,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 ;; so we don't lose the Labels: file attribute, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 ;; NO NO NO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 ;;(insert "BABYL OPTIONS: -*- rmail -*-\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (insert "BABYL OPTIONS:\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 ((equal (point-min) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 ;; Empty RMAIL file. Just insert the header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (rmail-insert-rmail-file-header))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 ;; Non-empty file in non-RMAIL format. Add header and convert.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (setq convert t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (rmail-insert-rmail-file-header)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 ;; If file was not a Babyl file or if there are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 ;; Unix format messages added at the end,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 ;; convert file as necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (if (or convert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (search-backward "\^_")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (looking-at "\n*From ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (message "Converting to Babyl format...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 ;; If file needs conversion, convert it all,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 ;; except for the BABYL header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 ;; (rmail-convert-to-babyl-format would delete the header.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (search-forward "\n\^_" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (narrow-to-region (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (rmail-convert-to-babyl-format)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (message "Converting to Babyl format...done")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 ;;; I have checked that adding "-*- rmail -*-" to the BABYL OPTIONS line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 ;;; will not cause emacs 18.55 problems.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 ;;; (Whatever, see above. -jwz)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (defun rmail-insert-rmail-file-header ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 ;; NO NO NO a thousand times NO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 ;; (insert "BABYL OPTIONS: -*- rmail -*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (insert "BABYL OPTIONS:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 Version: 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 Labels:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 Note: This is the header of an rmail file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 Note: If you are seeing it in rmail,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 Note: it means the file has no messages in it.\n\^_")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (if rmail-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (setq rmail-mode-map (make-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (suppress-keymap rmail-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (define-key rmail-mode-map "a" 'rmail-add-label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (define-key rmail-mode-map "b" 'rmail-bury)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (define-key rmail-mode-map "c" 'rmail-continue)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (define-key rmail-mode-map "d" 'rmail-delete-forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (define-key rmail-mode-map "\C-d" 'rmail-delete-backward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (define-key rmail-mode-map "e" 'rmail-edit-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (define-key rmail-mode-map "f" 'rmail-forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (define-key rmail-mode-map "g" 'rmail-get-new-mail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (define-key rmail-mode-map "h" 'rmail-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (define-key rmail-mode-map "i" 'rmail-input)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (define-key rmail-mode-map "j" 'rmail-show-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (define-key rmail-mode-map "k" 'rmail-kill-label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (define-key rmail-mode-map "l" 'rmail-summary-by-labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (define-key rmail-mode-map "\e\C-h" 'rmail-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (define-key rmail-mode-map "\e\C-l" 'rmail-summary-by-labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (define-key rmail-mode-map "\e\C-r" 'rmail-summary-by-recipients)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (define-key rmail-mode-map "\e\C-s" 'rmail-summary-by-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (define-key rmail-mode-map "\e\C-t" 'rmail-summary-by-topic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (define-key rmail-mode-map "m" 'rmail-mail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (define-key rmail-mode-map "\em" 'rmail-retry-failure)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (define-key rmail-mode-map "n" 'rmail-next-undeleted-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (define-key rmail-mode-map "\en" 'rmail-next-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (define-key rmail-mode-map "\e\C-n" 'rmail-next-labeled-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (define-key rmail-mode-map "o" 'rmail-output-to-rmail-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (define-key rmail-mode-map "\C-o" 'rmail-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (define-key rmail-mode-map "p" 'rmail-previous-undeleted-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (define-key rmail-mode-map "\ep" 'rmail-previous-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (define-key rmail-mode-map "\e\C-p" 'rmail-previous-labeled-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (define-key rmail-mode-map "q" 'rmail-quit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (define-key rmail-mode-map "r" 'rmail-reply)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 ;; I find I can't live without the default M-r command -- rms.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 ;; (define-key rmail-mode-map "\er" 'rmail-search-backwards)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (define-key rmail-mode-map "s" 'rmail-expunge-and-save)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (define-key rmail-mode-map "\es" 'rmail-search)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (define-key rmail-mode-map "t" 'rmail-toggle-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (define-key rmail-mode-map "u" 'rmail-undelete-previous-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (define-key rmail-mode-map "w" 'rmail-edit-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (define-key rmail-mode-map "x" 'rmail-expunge)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (define-key rmail-mode-map "." 'rmail-beginning-of-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (define-key rmail-mode-map "<" 'rmail-first-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (define-key rmail-mode-map ">" 'rmail-last-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (define-key rmail-mode-map " " 'scroll-up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (define-key rmail-mode-map "\177" 'scroll-down)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (define-key rmail-mode-map "?" 'describe-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (define-key rmail-mode-map "\C-c\C-s\C-d" 'rmail-sort-by-date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (define-key rmail-mode-map "\C-c\C-s\C-s" 'rmail-sort-by-subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (define-key rmail-mode-map "\C-c\C-s\C-a" 'rmail-sort-by-author)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (define-key rmail-mode-map "\C-c\C-s\C-r" 'rmail-sort-by-recipient)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (define-key rmail-mode-map "\C-c\C-s\C-c" 'rmail-sort-by-correspondent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (define-key rmail-mode-map "\C-c\C-s\C-l" 'rmail-sort-by-lines)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 ;(define-key rmail-mode-map [menu-bar] (make-sparse-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 ;(define-key rmail-mode-map [menu-bar classify]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 ; (cons "Classify" (make-sparse-keymap "Classify")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 ;(define-key rmail-mode-map [menu-bar classify output-inbox]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 ; '("Output (inbox)" . rmail-output))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 ;(define-key rmail-mode-map [menu-bar classify output]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 ; '("Output (Rmail)" . rmail-output-to-rmail-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 ;(define-key rmail-mode-map [menu-bar classify kill-label]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 ; '("Kill Label" . rmail-kill-label))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 ;(define-key rmail-mode-map [menu-bar classify add-label]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 ; '("Add Label" . rmail-add-label))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 ;(define-key rmail-mode-map [menu-bar summary]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 ; (cons "Summary" (make-sparse-keymap "Summary")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 ;(define-key rmail-mode-map [menu-bar summary labels]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 ; '("By Labels" . rmail-summary-by-labels))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 ;(define-key rmail-mode-map [menu-bar summary recipients]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 ; '("By Recipients" . rmail-summary-by-recipients))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 ;(define-key rmail-mode-map [menu-bar summary topic]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 ; '("By Topic" . rmail-summary-by-topic))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 ;(define-key rmail-mode-map [menu-bar summary regexp]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 ; '("By Regexp" . rmail-summary-by-regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 ;(define-key rmail-mode-map [menu-bar summary all]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 ; '("All" . rmail-summary))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 ;(define-key rmail-mode-map [menu-bar mail]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 ; (cons "Mail" (make-sparse-keymap "Mail")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 ;(define-key rmail-mode-map [menu-bar mail continue]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 ; '("Continue" . rmail-continue))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 ;(define-key rmail-mode-map [menu-bar mail forward]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 ; '("Forward" . rmail-forward))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 ;(define-key rmail-mode-map [menu-bar mail retry]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 ; '("Retry" . rmail-retry-failure))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 ;(define-key rmail-mode-map [menu-bar mail reply]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 ; '("Reply" . rmail-reply))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 ;(define-key rmail-mode-map [menu-bar mail mail]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 ; '("Mail" . rmail-mail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 ;(define-key rmail-mode-map [menu-bar delete]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 ; (cons "Delete" (make-sparse-keymap "Delete")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 ;(define-key rmail-mode-map [menu-bar delete expunge/save]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 ; '("Expunge/Save" . rmail-expunge-and-save))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 ;(define-key rmail-mode-map [menu-bar delete expunge]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 ; '("Expunge" . rmail-expunge))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 ;(define-key rmail-mode-map [menu-bar delete undelete]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 ; '("Undelete" . rmail-undelete-previous-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 ;(define-key rmail-mode-map [menu-bar delete delete]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 ; '("Delete" . rmail-delete-forward))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 ;(define-key rmail-mode-map [menu-bar move]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 ; (cons "Move" (make-sparse-keymap "Move")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 ;(define-key rmail-mode-map [menu-bar move search-back]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 ; '("Search Back" . rmail-search-backward))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 ;(define-key rmail-mode-map [menu-bar move search]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 ; '("Search" . rmail-search))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 ;(define-key rmail-mode-map [menu-bar move previous]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 ; '("Previous Nondeleted" . rmail-previous-undeleted-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 ;(define-key rmail-mode-map [menu-bar move next]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 ; '("Next Nondeleted" . rmail-next-undeleted-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 ;(define-key rmail-mode-map [menu-bar move last]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 ; '("Last" . rmail-last-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 ;(define-key rmail-mode-map [menu-bar move first]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 ; '("First" . rmail-first-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 ;(define-key rmail-mode-map [menu-bar move previous]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 ; '("Previous" . rmail-previous-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 ;(define-key rmail-mode-map [menu-bar move next]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 ; '("Next" . rmail-next-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 ;; Rmail mode is suitable only for specially formatted data.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (put 'rmail-mode 'mode-class 'special)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (defun rmail-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 "Rmail Mode is used by \\<rmail-mode-map>\\[rmail] for editing Rmail files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 All normal editing commands are turned off.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 Instead, these commands are available:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 \\[rmail-beginning-of-message] Move point to front of this message (same as \\[beginning-of-buffer]).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 \\[scroll-up] Scroll to next screen of this message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 \\[scroll-down] Scroll to previous screen of this message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 \\[rmail-next-undeleted-message] Move to Next non-deleted message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 \\[rmail-previous-undeleted-message] Move to Previous non-deleted message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 \\[rmail-next-message] Move to Next message whether deleted or not.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 \\[rmail-previous-message] Move to Previous message whether deleted or not.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 \\[rmail-first-message] Move to the first message in Rmail file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 \\[rmail-last-message] Move to the last message in Rmail file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 \\[rmail-show-message] Jump to message specified by numeric position in file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 \\[rmail-search] Search for string and show message it is found in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 \\[rmail-delete-forward] Delete this message, move to next nondeleted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 \\[rmail-delete-backward] Delete this message, move to previous nondeleted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 \\[rmail-undelete-previous-message] Undelete message. Tries current message, then earlier messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 till a deleted message is found.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 \\[rmail-edit-current-message] Edit the current message. \\[rmail-cease-edit] to return to Rmail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 \\[rmail-expunge] Expunge deleted messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 \\[rmail-expunge-and-save] Expunge and save the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 \\[rmail-quit] Quit Rmail: expunge, save, then switch to another buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 \\[save-buffer] Save without expunging.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 \\[rmail-get-new-mail] Move new mail from system spool directory into this file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 \\[rmail-mail] Mail a message (same as \\[mail-other-window]).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 \\[rmail-continue] Continue composing outgoing message started before.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 \\[rmail-reply] Reply to this message. Like \\[rmail-mail] but initializes some fields.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 \\[rmail-retry-failure] Send this message again. Used on a mailer failure message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 \\[rmail-forward] Forward this message to another user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 \\[rmail-output-to-rmail-file] Output this message to an Rmail file (append it).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 \\[rmail-output] Output this message to a Unix-format mail file (append it).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 \\[rmail-input] Input Rmail file. Run Rmail on that file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 \\[rmail-add-label] Add label to message. It will be displayed in the mode line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 \\[rmail-kill-label] Kill label. Remove a label from current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 \\[rmail-next-labeled-message] Move to Next message with specified label
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (label defaults to last one specified).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 Standard labels: filed, unseen, answered, forwarded, deleted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 Any other label is present only if you add it with \\[rmail-add-label].
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 \\[rmail-previous-labeled-message] Move to Previous message with specified label
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 \\[rmail-summary] Show headers buffer, with a one line summary of each message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 \\[rmail-summary-by-labels] Summarize only messages with particular label(s).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 \\[rmail-summary-by-recipients] Summarize only messages with particular recipient(s).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 \\[rmail-summary-by-regexp] Summarize only messages with particular regexp(s).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 \\[rmail-summary-by-topic] Summarize only messages with subject line regexp(s).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 \\[rmail-toggle-header] Toggle display of complete header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (rmail-mode-2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (rmail-set-message-counters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (rmail-show-message rmail-total-messages))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 (defun rmail-mode-2 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (kill-all-local-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 (rmail-mode-1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (rmail-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (run-hooks 'rmail-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (defun rmail-mode-1 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 (setq major-mode 'rmail-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (setq mode-name "RMAIL")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 (setq buffer-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 ;; No need to auto save RMAIL files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 ;; says who??? (asks jwz)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 ;; (setq buffer-auto-save-file-name nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (if (boundp 'mode-line-modified)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 (setq mode-line-modified "--- ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (setq mode-line-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 (cons "--- " (cdr (default-value 'mode-line-format)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (use-local-map rmail-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (set-syntax-table text-mode-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (setq local-abbrev-table text-mode-abbrev-table))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (defun rmail-variables ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (make-local-variable 'revert-buffer-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (setq revert-buffer-function 'rmail-revert)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (make-local-variable 'rmail-last-label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (make-local-variable 'rmail-last-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 (make-local-variable 'rmail-deleted-vector)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 (make-local-variable 'rmail-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (make-local-variable 'rmail-summary-vector)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 (make-local-variable 'rmail-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (make-local-variable 'rmail-total-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (make-local-variable 'require-final-newline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (setq require-final-newline nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (make-local-variable 'version-control)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (setq version-control 'never)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 (make-local-variable 'file-precious-flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (setq file-precious-flag t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (make-local-variable 'rmail-message-vector)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (make-local-variable 'rmail-last-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 (make-local-variable 'rmail-inbox-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (setq rmail-inbox-list (rmail-parse-file-inboxes))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 ;; Provide default set of inboxes for primary mail file ~/RMAIL.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 (and (null rmail-inbox-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (or (equal buffer-file-name (expand-file-name rmail-file-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (equal buffer-file-truename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (abbreviate-file-name (file-truename rmail-file-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 (setq rmail-inbox-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 (or rmail-primary-inbox-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 ;; XEmacs change: FSF had removed "~/mbox" from this list,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 ;; but users expect that to work and don't understand why
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 ;; it changed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 (list "~/mbox"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 (or (getenv "MAIL")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (concat rmail-spool-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 (user-original-login-name)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 (make-local-variable 'rmail-keywords)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 ;; this gets generated as needed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 (setq rmail-keywords nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 ;; Handle M-x revert-buffer done in an rmail-mode buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (defun rmail-revert (arg noconfirm)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (let (revert-buffer-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 ;; Call our caller again, but this time it does the default thing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (if (revert-buffer arg noconfirm)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 ;; If the user said "yes", and we changed something,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 ;; reparse the messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 (rmail-convert-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 (rmail-set-message-counters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (rmail-show-message)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 ;; Return a list of files from this buffer's Mail: option.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 ;; Does not assume that messages have been parsed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 ;; Just returns nil if buffer does not look like Babyl format.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 (defun rmail-parse-file-inboxes ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (goto-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (cond ((looking-at "BABYL OPTIONS:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (search-forward "\n\^_" nil 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (narrow-to-region 1 (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (goto-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 (if (search-forward "\nMail:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 (narrow-to-region (point) (progn (end-of-line) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 (mail-parse-comma-list))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 (defun rmail-expunge-and-save ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 "Expunge and save RMAIL file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (rmail-expunge)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 (save-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 (defun rmail-quit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 "Quit out of RMAIL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 (interactive)
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
734 (if (eq major-mode 'mime/viewer-mode)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
735 (let ((buf mime::preview/article-buffer)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
736 (pbuf (current-buffer))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
737 )
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
738 (switch-to-buffer buf)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
739 (bury-buffer pbuf)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
740 ))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
741 (let (rmail-show-mime)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
742 (rmail-expunge-and-save)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
743 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 ;; Don't switch to the summary buffer even if it was recently visible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (if (rmail-summary-exists)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 (bury-buffer rmail-summary-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (let ((obuf (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 (switch-to-buffer (other-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 (bury-buffer obuf)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (defun rmail-input (filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 "Run Rmail on file FILENAME."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 (interactive "FRun rmail on RMAIL file: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (rmail filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 ;;;; *** Rmail input ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 ;; RLK feature not added in this version:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 ;; argument specifies inbox file or files in various ways.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (defun rmail-get-new-mail (&optional file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 "Move any new mail from this RMAIL file's inbox files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 The inbox files can be specified with the file's Mail: option. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 variable `rmail-primary-inbox-list' specifies the inboxes for your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 primary RMAIL file if it has no Mail: option. By default, this is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 your /usr/spool/mail/$USER.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 You can also specify the file to get new mail from. In this case, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 file of new mail is not changed or deleted. Noninteractively, you can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 pass the inbox file name as an argument. Interactively, a prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 argument causes us to read a file name and use that file as the inbox."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 (list (if current-prefix-arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 (read-file-name "Get new mail from file: "))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 (or (verify-visited-file-modtime (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 (find-file (buffer-file-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 (setq buffer-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 (if (verify-visited-file-modtime (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 (rmail-forget-messages))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 (rmail-maybe-set-message-counters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 ;; Get rid of all undo records for this buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 (or (eq buffer-undo-list t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 (setq buffer-undo-list nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 (let ((opoint (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 (new-messages 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (delete-files ())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 ;; If buffer has not changed yet, and has not been saved yet,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 ;; don't replace the old backup file now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 (make-backup-files (and make-backup-files (buffer-modified-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 (buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 ;; Don't make undo records for what we do in getting mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 (buffer-undo-list t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 (skip-chars-backward " \t\n") ; just in case of brain damage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (delete-region (point) (point-max)) ; caused by require-final-newline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 (narrow-to-region (point) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 ;; Read in the contents of the inbox files,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 ;; renaming them as necessary,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 ;; and adding to the list of files to delete eventually.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 (if file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 (rmail-insert-inbox-text (list file-name) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 (setq delete-files (rmail-insert-inbox-text rmail-inbox-list t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 ;; Scan the new text and convert each message to babyl format.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 (setq new-messages (rmail-convert-to-babyl-format)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 (or (zerop new-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 (progn ;;let (success)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 (search-backward "\n\^_")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 (narrow-to-region (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 (goto-char (1+ (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 (rmail-count-new-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (save-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 ;; Delete the old files, now that babyl file is saved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 (while delete-files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 ;; First, try deleting.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 (delete-file (car delete-files))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 (file-error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 ;; If we can't delete it, truncate it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 (write-region (point) (point) (car delete-files))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 (file-error nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 (setq delete-files (cdr delete-files)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 (if (= new-messages 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 (progn (goto-char opoint)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 (if (or file-name rmail-inbox-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 (message "(No new mail has arrived)")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 (if (rmail-summary-exists)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 (rmail-select-summary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 (rmail-update-summary)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 (message "%d new message%s read"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 new-messages (if (= 1 new-messages) "" "s"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 ;; #### BOGUS! Run a hook here instead and let time.el do it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 (and (boundp 'display-time-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 display-time-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (string-match " Mail" display-time-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 (setq display-time-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 (substring display-time-string 0 (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 (substring display-time-string (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 (force-mode-line-update 'all))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 ;; Don't leave the buffer screwed up if we get a disk-full error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 (rmail-show-message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 (defun rmail-insert-inbox-text (files renamep)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 (let (file tofile delete-files movemail popmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 (while files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 (setq file (expand-file-name (substitute-in-file-name (car files)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 ;;>> un*x specific <<
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 ;; The "+" used to be "~", which is an extremely poor choice;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 ;; it might accidentally be deleted when space is low
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 ;; (as happened to me!).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 tofile (concat file "+"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 ;; If getting from mail spool directory,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 ;; use movemail to move rather than just renaming,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 ;; so as to interlock with the mailer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (setq movemail (equal (file-name-directory file) rmail-spool-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 popmail (string-match "^po:" (file-name-nondirectory file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 (if popmail (setq file (file-name-nondirectory file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 renamep t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (if movemail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 (setq tofile (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 ;; Generate name to move to from inbox name,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 ;; in case of multiple inboxes that need moving.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 (concat ".newmail-" (file-name-nondirectory file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 ;; Use the directory of this rmail file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 ;; because it's a nuisance to use the homedir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 ;; if that is on a full disk and this rmail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 ;; file isn't.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 (file-name-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 (expand-file-name buffer-file-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 ;; On some systems, /usr/spool/mail/foo is a directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 ;; and the actual inbox is /usr/spool/mail/foo/foo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 (if (file-directory-p file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 (setq file (expand-file-name (user-original-login-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 file)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (if popmail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 (message "Getting mail from post office ...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 (if (or (and (file-exists-p tofile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (/= 0 (nth 7 (file-attributes tofile))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 (and (file-exists-p file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 (/= 0 (nth 7 (file-attributes file)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 (message "Getting mail from %s..." file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 ;; Set TOFILE if have not already done so, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 ;; rename or copy the file FILE to TOFILE if and as appropriate.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 (cond ((not renamep)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 (setq tofile file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 ((or (file-exists-p tofile) (and (not popmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (not (file-exists-p file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 ((and (not movemail) (not popmail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 ;; Try copying. If that fails (perhaps no space),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 ;; rename instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 (copy-file file tofile nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 (rename-file file tofile nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 ;; Make the real inbox file empty.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 ;; Leaving it deleted could cause lossage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 ;; because mailers often won't create the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 (write-region (point) (point) file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 (file-error nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (let ((errors nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 (setq errors (generate-new-buffer " *rmail loss*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 (buffer-disable-undo errors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 (call-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 (expand-file-name "movemail" exec-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 nil errors nil file tofile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 (if (not (buffer-modified-p errors))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 ;; No output => movemail won
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 (set-buffer errors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 (subst-char-in-region (point-min) (point-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 ?\n ?\ )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 (skip-chars-backward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 (delete-region (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 (if (looking-at "movemail: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 (delete-region (point-min) (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 (beep t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 (message (concat "movemail: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (buffer-substring (point-min)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 (sit-for 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 (if errors (kill-buffer errors))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 ;; At this point, TOFILE contains the name to read:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 ;; Either the alternate name (if we renamed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 ;; or the actual inbox (if not renaming).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 (if (file-exists-p tofile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (let (size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 (if (not (featurep 'mule))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 (setq size (nth 1 (insert-file-contents tofile)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 ;; At first, read the file without converting coding-system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 (setq size (nth 1 (let (file-coding-system-for-read)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 (insert-file-contents tofile))))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
953 ;; 1996/12/9 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
954 ;; Don't code-convert for RMAIL file
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 ;; Then, convert the contents if necessary.
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
956 ;; (if (> size 0)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
957 ;; (cond
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
958 ;; ((looking-at "^From ")
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
959 ;; ;; New mails. Since the contents may be a mixture
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
960 ;; ;; of various coding-systems, we must decode one
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
961 ;; ;; mail by one.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
962 ;; (while (null (eobp))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
963 ;; (let ((from (point)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
964 ;; (re-search-forward "^From " nil 'mv)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
965 ;; (rmail-decode-coding-system from (point)))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
966 ;; ((looking-at "BABYL OPTIONS:\\|\^L")
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
967 ;; ;; Babyl format, i.e. not a new mail. We had better
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
968 ;; ;; not to convert large region at once.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
969 ;; (while (null (eobp))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
970 ;; (let ((max-size (* 1024 1024))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
971 ;; (from (point)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
972 ;; (goto-char (+ from max-size))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
973 ;; (re-search-forward "\^_" nil 'mv)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
974 ;; (rmail-decode-coding-system from (point)))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
975 ;; (t
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
976 ;; ;; Perhaps, MMDF format. Since I don't know how to
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
977 ;; ;; deal with it, convert all data at once.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
978 ;; (rmail-decode-coding-system (point) (point-max)))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
979 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 (or (= (preceding-char) ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (zerop size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (insert ?\n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 (setq delete-files (cons tofile delete-files))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 (message "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 (setq files (cdr files)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 delete-files))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
989 ;; (if (not (featurep 'mule)) nil
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
990 ;;
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
991 ;; (defvar mail-coding-system '*junet*)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
992 ;;
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
993 ;; (defun rmail-decode-coding-system (from to)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
994 ;; (let (coding-system)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
995 ;; ;; At first, detect the coding-system of the region and set it to
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 86
diff changeset
996 ;; ;; `coding-system'.
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
997 ;; (let ((detected-coding-system (code-detect-region from to))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
998 ;; (coding (get-code mail-coding-system)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
999 ;; (if (listp detected-coding-system)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1000 ;; ;; Something other than ASCII was found. If a coding-system
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1001 ;; ;; of which information is same as `mail-coding-system' is
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1002 ;; ;; in the list of detected coding-systems, use it, else use
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1003 ;; ;; the coding-system of the highest priority in the list.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1004 ;; (let ((l detected-coding-system))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1005 ;; (while (and l
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1006 ;; (null (eq (get-code (car l)) coding)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1007 ;; (setq l (cdr l)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1008 ;; (setq coding-system (car (or l detected-coding-system))))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1009 ;; ;; Then, decode the region.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1010 ;; (if coding-system
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1011 ;; (save-restriction
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1012 ;; (narrow-to-region from to)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1013 ;; (code-convert from to coding-system '*internal*)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1014 ;; (goto-char (point-max))))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1015 ;;
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1016 ;; ) ; (featurep 'mule)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 ;; the rmail-break-forwarded-messages feature is not implemented
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 (defun rmail-convert-to-babyl-format ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 (let ((count 0) start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 (case-fold-search nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 (invalid-input-resync
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 (function (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 (message "Invalid Babyl format in inbox!")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 (sit-for 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 ;; Try to get back in sync with a real message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 (if (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (concat mmdf-delim1 "\\|^From") nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 (goto-char (point-max)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 (cond ((looking-at "BABYL OPTIONS:");Babyl header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 (if (search-forward "\n\^_" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 ;; If we find the proper terminator, delete through there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 (delete-region (point-min) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 (funcall invalid-input-resync)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 (delete-region (point-min) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 ;; Babyl format message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 ((looking-at "\^L")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 (or (search-forward "\n\^_" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 (funcall invalid-input-resync))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 (setq count (1+ count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 ;; Make sure there is no extra white space after the ^_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 ;; at the end of the message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 ;; Narrowing will make sure that whatever follows the junk
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 ;; will be treated properly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 (delete-region (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 (skip-chars-forward " \t\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 (narrow-to-region (point) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 ;;*** MMDF format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 ((let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 (looking-at mmdf-delim1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 (replace-match "\^L\n0, unseen,,\n*** EOOH ***\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 (re-search-forward mmdf-delim2 nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 (replace-match "\^_"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 (narrow-to-region start (1- (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 (while (search-forward "\n\^_" nil t); single char "\^_"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 (replace-match "\n^_")))); 2 chars: "^" and "_"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 (narrow-to-region (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 (setq count (1+ count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 ;;*** Mail format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 ((looking-at "^From ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 (insert "\^L\n0, unseen,,\n*** EOOH ***\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 (rmail-nuke-pinhead-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 ;; If this message has a Content-Length field,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 ;; skip to the end of the contents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 (let* ((header-end (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 (and (re-search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 (case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 (size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 ;; Get the numeric value from the Content-Length field.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 ;; Back up to end of prev line,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 ;; in case the Content-Length field comes first.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 (and (search-forward "\ncontent-length: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 header-end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 (let ((beg (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (eol (progn (end-of-line) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 (read (buffer-substring beg eol)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 (and size (numberp size) (>= size 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 (goto-char (+ header-end size))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 (if (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 (concat "^[\^_]?\\("
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 rmail-unix-mail-delimiter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 "\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 mmdf-delim1 "\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 "^BABYL OPTIONS:\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 "\^L\n[01],\\)") nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 (goto-char (match-beginning 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 (goto-char (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 (setq count (1+ count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 (narrow-to-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 (while (search-forward "\n\^_" nil t); single char
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 (replace-match "\n^_")))); 2 chars: "^" and "_"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 (insert ?\^_)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 (narrow-to-region (point) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 ;; This kludge is because some versions of sendmail.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 ;; insert an extra newline at the beginning that shouldn't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 ;; be there. sendmail.el has been fixed, but old versions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 ;; may still be in use. -- rms, 7 May 1993.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 ((eolp) (delete-char 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 (t (error "Cannot convert to babyl format")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 ;; Delete the "From ..." line, creating various other headers with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 ;; information from it if they don't already exist. Now puts the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 ;; original line into a mail-from: header line for debugging and for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 ;; use by the rmail-output function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 (defun rmail-nuke-pinhead-header ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 (let ((start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 (end (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 (search-forward "\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 (insert "\n\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 has-from has-date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 (narrow-to-region start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 (setq has-from (search-forward "\nFrom:" nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 (setq has-date (and (search-forward "\nDate:" nil t) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 (goto-char start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 (let ((case-fold-search nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 (if (re-search-forward (concat "^" rmail-unix-mail-delimiter) nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 (replace-match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 "Mail-from: \\&"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 ;; Keep and reformat the date if we don't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 ;; have a Date: field.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 (if has-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 "Date: \\3, \\5 \\4 \\9 \\6 "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 ;; The timezone could be matched by group 7 or group 10.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 ;; If neither of them matched, assume EST, since only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 ;; Easterners would be so sloppy.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 ;; It's a shame the substitution can't use "\\10".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 ((/= (match-beginning 7) (match-end 7)) "\\7")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 ((/= (match-beginning 10) (match-end 10))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 (buffer-substring (match-beginning 10)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 (match-end 10)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 (t "EST"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 ;; Keep and reformat the sender if we don't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 ;; have a From: field.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 (if has-from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 "From: \\1\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 t)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 ;;;; *** Rmail Message Formatting and Header Manipulation ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 (defun rmail-reformat-message (beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 (goto-char beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 (if (/= (following-char) ?0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 (error "Bad format in RMAIL file."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 (let ((buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 (delta (- (buffer-size) end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 (delete-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 (insert ?1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 (while (looking-at "Summary-line:\\|Mail-From:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 (forward-line 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 (if (looking-at "\\*\\*\\* EOOH \\*\\*\\*\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 (delete-region (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 (progn (forward-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 (let ((str (buffer-substring (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 (save-excursion (search-forward "\n\n" end 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 (insert str "*** EOOH ***\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 (narrow-to-region (point) (- (buffer-size) delta)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 (if rmail-ignored-headers (rmail-clear-headers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 (if rmail-message-filter (funcall rmail-message-filter))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 (defun rmail-clear-headers ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 (if (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 (narrow-to-region (point-min) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 (while (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 (re-search-forward rmail-ignored-headers nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 (delete-region (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 (progn (re-search-forward "\n[^ \t]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 (point))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 (defun rmail-toggle-header ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 "Show original message header if pruned header currently shown, or vice versa."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 (rmail-maybe-set-message-counters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 (narrow-to-region (rmail-msgbeg rmail-current-message) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 (if (= (following-char) ?1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 (progn (delete-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 (insert ?0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 (while (looking-at "Summary-Line:\\|Mail-From:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 (forward-line 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 (insert "*** EOOH ***\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 (search-forward "\n*** EOOH ***\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 (let ((temp (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 (and (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 (delete-region temp (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 (search-forward "\n*** EOOH ***\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 (narrow-to-region (point) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 (rmail-reformat-message (point-min) (point-max)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 ;;;; *** Rmail Attributes and Keywords ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 ;; Make a string describing current message's attributes and keywords
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 ;; and set it up as the name of a minor mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 ;; so it will appear in the mode line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 (defun rmail-display-labels ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 (let ((blurb "") (beg (point-min-marker)) (end (point-max-marker)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 (goto-char (rmail-msgbeg rmail-current-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 (if (looking-at "[01],")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 (narrow-to-region (point) (progn (end-of-line) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 ;; Truly valid BABYL format requires a space before each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 ;; attribute or keyword name. Put them in if missing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 (let (buffer-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 (while (search-forward "," nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 (or (looking-at "[ ,]") (eobp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 (insert " "))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 (if (search-backward ",," nil 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 (if (> (point) (1+ (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 (setq blurb (buffer-substring (+ 1 (point-min)) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 (if (> (- (point-max) (point)) 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 (setq blurb
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 (concat blurb
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 ";"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 (buffer-substring (+ (point) 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 (1- (point-max)))))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 ;; Note: we don't use save-restriction because that does not work right
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 ;; if changes are made outside the saved restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 ;; before that restriction is restored.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 (narrow-to-region beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 (set-marker beg nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 (set-marker end nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 (while (string-match " +," blurb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 (setq blurb (concat (substring blurb 0 (match-beginning 0)) ","
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 (substring blurb (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 (while (string-match ", +" blurb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 (setq blurb (concat (substring blurb 0 (match-beginning 0)) ","
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 (substring blurb (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 (setq mode-line-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 (format " %d/%d%s" rmail-current-message rmail-total-messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 blurb))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 ;; Turn an attribute of a message on or off according to STATE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 ;; ATTR is the name of the attribute, as a string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 ;; MSGNUM is message number to change; nil means current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 (defun rmail-set-attribute (attr state &optional msgnum)
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1297 (let ((the-buf (current-buffer)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1298 (if (eq major-mode 'mime/viewer-mode)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1299 (switch-to-buffer mime::preview/article-buffer)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1300 )
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1301 (let ((omax (point-max-marker))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1302 (omin (point-min-marker))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1303 (buffer-read-only nil))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1304 (or msgnum (setq msgnum rmail-current-message))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1305 (if (> msgnum 0)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1306 (unwind-protect
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1307 (save-excursion
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1308 (widen)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1309 (goto-char (+ 3 (rmail-msgbeg msgnum)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1310 (let ((curstate
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1311 (not
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1312 (null (search-backward (concat ", " attr ",")
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1313 (prog1 (point)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1314 (end-of-line)) t)))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1315 (or (eq curstate (not (not state)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1316 (if curstate
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1317 (delete-region (point) (1- (match-end 0)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1318 (beginning-of-line)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1319 (forward-char 2)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1320 (insert " " attr ","))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1321 (if (string= attr "deleted")
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1322 (rmail-set-message-deleted-p msgnum state)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1323 ;; Note: we don't use save-restriction
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1324 ;; because that does not work right
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1325 ;; if changes are made outside the saved restriction
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1326 ;; before that restriction is restored.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1327 (narrow-to-region omin omax)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1328 (set-marker omin nil)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1329 (set-marker omax nil)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1330 (if (= msgnum rmail-current-message)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1331 (rmail-display-labels)))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1332 (switch-to-buffer the-buf)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1333 ))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 ;; Return t if the attributes/keywords line of msg number MSG
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 ;; contains a match for the regexp LABELS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 (defun rmail-message-labels-p (msg labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 (goto-char (rmail-msgbeg msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 (forward-char 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 (re-search-backward labels (prog1 (point) (end-of-line)) t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 ;;;; *** Rmail Message Selection And Support ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 (defun rmail-msgend (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 (marker-position (aref rmail-message-vector (1+ n))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 (defun rmail-msgbeg (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 (marker-position (aref rmail-message-vector n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 (defun rmail-widen-to-current-msgbeg (function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 "Call FUNCTION with point at start of internal data of current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 Assumes that bounds were previously narrowed to display the message in Rmail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 The bounds are widened enough to move point where desired, then narrowed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 again afterward.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 FUNCTION may not change the visible text of the message, but it may
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 change the invisible header text."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 (let ((obeg (- (point-max) (point-min))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 (narrow-to-region (rmail-msgbeg rmail-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 (funcall function))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 ;; Note: we don't use save-restriction because that does not work right
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 ;; if changes are made outside the saved restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 ;; before that restriction is restored.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 ;; Here we assume that changes made by FUNCTION
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 ;; occur before the visible region of the message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 (narrow-to-region (- (point-max) obeg) (point-max))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 (defun rmail-forget-messages ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 (if (vectorp rmail-message-vector)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 (let* ((i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 (v rmail-message-vector)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 (n (length v)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 (while (< i n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 (move-marker (aref v i) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 (setq i (1+ i)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 (setq rmail-message-vector nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 (setq rmail-deleted-vector nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 (defun rmail-maybe-set-message-counters ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 (if (not (and rmail-deleted-vector
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 rmail-message-vector
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 rmail-current-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 rmail-total-messages))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 (rmail-set-message-counters)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 (defun rmail-count-new-messages (&optional nomsg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 (let* ((case-fold-search nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 (total-messages 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 (messages-head nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 (deleted-head nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 (or nomsg (message "Counting new messages..."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 ;; Put at the end of messages-head
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 ;; the entry for message N+1, which marks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 ;; the end of message N. (N = number of messages).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 (search-backward "\n\^_")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 (setq messages-head (list (point-marker)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 (rmail-set-message-counters-counter (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 (setq rmail-current-message (1+ rmail-total-messages))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 (setq rmail-total-messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 (+ rmail-total-messages total-messages))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 (setq rmail-message-vector
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 (vconcat rmail-message-vector (cdr messages-head)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 (aset rmail-message-vector
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 rmail-current-message (car messages-head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 (setq rmail-deleted-vector
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 (concat rmail-deleted-vector deleted-head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 (setq rmail-summary-vector
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 (vconcat rmail-summary-vector (make-vector total-messages nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 (or nomsg (message "Counting new messages...done (%d)" total-messages))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 (defun rmail-set-message-counters ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 (rmail-forget-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 (let* ((point-save (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 (total-messages 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 (messages-after-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 (case-fold-search nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 (messages-head nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 (deleted-head nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 (message "Counting messages...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 ;; Put at the end of messages-head
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 ;; the entry for message N+1, which marks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 ;; the end of message N. (N = number of messages).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 (search-backward "\n\^_")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 (setq messages-head (list (point-marker)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 (rmail-set-message-counters-counter (min (point) point-save))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 (setq messages-after-point total-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 (rmail-set-message-counters-counter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 (setq rmail-total-messages total-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 (setq rmail-current-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 (min total-messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 (max 1 (- total-messages messages-after-point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 (setq rmail-message-vector
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 (apply 'vector (cons (point-min-marker) messages-head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 rmail-deleted-vector (concat "D" deleted-head)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 rmail-summary-vector (make-vector rmail-total-messages nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 (message "Counting messages...done")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 (defun rmail-set-message-counters-counter (&optional stop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 (while (search-backward "\n\^_\^L\n" stop t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 (setq messages-head (cons (point-marker) messages-head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 (setq deleted-head
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 (cons (if (search-backward ", deleted,"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 (prog1 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 (forward-line 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 ?D ?\ )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 deleted-head)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 (if (zerop (% (setq total-messages (1+ total-messages)) 20))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 (message "Counting messages...%d" total-messages))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 (defun rmail-beginning-of-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 "Show current message starting from the beginning."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 (rmail-show-message rmail-current-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 (defun rmail-show-message (&optional n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 "Show message number N (prefix argument), counting from start of file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 If summary buffer is currently displayed, update current message there also."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 (interactive "p")
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1479 (if (eq major-mode 'mime/viewer-mode)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1480 (switch-to-buffer mime::preview/article-buffer)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1481 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 (rmail-maybe-set-message-counters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 (if (zerop rmail-total-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 (progn (narrow-to-region (point-min) (1- (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 (setq mode-line-process nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 (let (blurb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 (if (not n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 (setq n rmail-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 (cond ((<= n 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 (setq n 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 rmail-current-message 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 blurb "No previous message"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 ((> n rmail-total-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 (setq n rmail-total-messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 rmail-current-message rmail-total-messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 blurb "No following message"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 (setq rmail-current-message n))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 (let ((beg (rmail-msgbeg n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 (end (rmail-msgend n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 (goto-char beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 (if (= (following-char) ?0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 (rmail-reformat-message beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 (rmail-set-attribute "unseen" nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 (search-forward "\n*** EOOH ***\n" end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 (narrow-to-region (point) end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 (rmail-display-labels)
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1513 (if rmail-show-mime
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1514 (funcall rmail-show-mime-method)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1515 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 (run-hooks 'rmail-show-message-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 ;; If there is a summary buffer, try to move to this message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 ;; in that buffer. But don't complain if this message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 ;; is not mentioned in the summary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 (if (rmail-summary-exists)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 (let ((curr-msg rmail-current-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 (rmail-select-summary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 (rmail-summary-goto-msg curr-msg t t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 (if blurb
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 (message blurb))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 (defun rmail-next-message (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 "Show following message whether deleted or not.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 With prefix arg N, moves forward N messages, or backward if N is negative."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 (interactive "p")
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1531 (if (eq major-mode 'mime/viewer-mode)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1532 (switch-to-buffer mime::preview/article-buffer)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1533 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 (rmail-maybe-set-message-counters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 (rmail-show-message (+ rmail-current-message n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 (defun rmail-previous-message (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538 "Show previous message whether deleted or not.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 With prefix arg N, moves backward N messages, or forward if N is negative."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540 (interactive "p")
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1541 (rmail-next-message (- n)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543 (defun rmail-next-undeleted-message (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 "Show following non-deleted message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545 With prefix arg N, moves forward N non-deleted messages,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546 or backward if N is negative.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548 Returns t if a new message is being shown, nil otherwise."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 (interactive "p")
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1550 (let ((the-buf (current-buffer)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1551 (if (eq major-mode 'mime/viewer-mode)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1552 (switch-to-buffer mime::preview/article-buffer)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1553 )
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1554 (rmail-maybe-set-message-counters)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1555 (let ((lastwin rmail-current-message)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1556 (current rmail-current-message))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1557 (while (and (> n 0) (< current rmail-total-messages))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1558 (setq current (1+ current))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1559 (if (not (rmail-message-deleted-p current))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1560 (setq lastwin current n (1- n))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1561 (while (and (< n 0) (> current 1))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1562 (setq current (1- current))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1563 (if (not (rmail-message-deleted-p current))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1564 (setq lastwin current n (1+ n))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1565 (if (/= lastwin rmail-current-message)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1566 (progn (rmail-show-message lastwin)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1567 t)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1568 (if (< n 0)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1569 (message "No previous nondeleted message"))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1570 (if (> n 0)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1571 (message "No following nondeleted message"))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1572 (switch-to-buffer the-buf)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1573 nil))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575 (defun rmail-previous-undeleted-message (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576 "Show previous non-deleted message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577 With prefix argument N, moves backward N non-deleted messages,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578 or forward if N is negative."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580 (rmail-next-undeleted-message (- n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582 (defun rmail-first-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583 "Show first message in file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 (rmail-maybe-set-message-counters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 (rmail-show-message 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 (defun rmail-last-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 "Show last message in file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 (rmail-maybe-set-message-counters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 (rmail-show-message rmail-total-messages))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 (defun rmail-what-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 (let ((where (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 (low 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 (high rmail-total-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598 (mid (/ rmail-total-messages 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 (while (> (- high low) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 (if (>= where (rmail-msgbeg mid))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 (setq low mid)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602 (setq high mid))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603 (setq mid (+ low (/ (- high low) 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1604 (if (>= where (rmail-msgbeg high)) high low)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606 (defun rmail-message-recipients-p (msg recipients &optional primary-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 (goto-char (rmail-msgbeg msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609 (search-forward "\n*** EOOH ***\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 (narrow-to-region (point) (progn (search-forward "\n\n") (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 (or (string-match recipients (or (mail-fetch-field "To") ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612 (string-match recipients (or (mail-fetch-field "From") ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613 (if (not primary-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614 (string-match recipients (or (mail-fetch-field "Cc") ""))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616 (defun rmail-message-regexp-p (msg regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 "Return t, if for message number MSG, regexp REGEXP matches in the header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 (goto-char (rmail-msgbeg msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 (let ((end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 (search-forward "*** EOOH ***" (point-max)) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 (re-search-forward regexp end t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 (defvar rmail-search-last-regexp nil) ; jwz: moved this up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625 (defun rmail-search-backward (regexp &optional n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 "Show message containing next match for REGEXP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 Prefix argument gives repeat count; negative argument means search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628 backwards (through earlier messages).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 Interactively, empty argument means use same regexp used last time."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 (let* ((reversep (>= (prefix-numeric-value current-prefix-arg) 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632 (prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 (concat (if reversep "Reverse " "") "Rmail search (regexp): "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634 regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 (if rmail-search-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 (setq prompt (concat prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 "(default "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 rmail-search-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639 ") ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 (setq regexp (read-string prompt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 (cond ((not (equal regexp ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642 (setq rmail-search-last-regexp regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 ((not rmail-search-last-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 (error "No previous Rmail search string")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 (list rmail-search-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646 (prefix-numeric-value current-prefix-arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 (rmail-search regexp (- n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 (defun rmail-search (regexp &optional n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 "Show message containing next match for REGEXP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 Prefix argument gives repeat count; negative argument means search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 backwards (through earlier messages).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 Interactively, empty argument means use same regexp used last time."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 (let* ((reversep (< (prefix-numeric-value current-prefix-arg) 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656 (prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 (concat (if reversep "Reverse " "") "Rmail search (regexp): "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658 regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659 (if rmail-search-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660 (setq prompt (concat prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 "(default "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1662 rmail-search-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663 ") ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664 (setq regexp (read-string prompt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 (cond ((not (equal regexp ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 (setq rmail-search-last-regexp regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667 ((not rmail-search-last-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668 (error "No previous Rmail search string")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669 (list rmail-search-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 (prefix-numeric-value current-prefix-arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 (or n (setq n 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 (message "%sRmail search for %s..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673 (if (< n 0) "Reverse " "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 (rmail-maybe-set-message-counters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 (let ((omin (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 (omax (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 (opoint (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 win
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 (reversep (< n 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 (msg rmail-current-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685 (while (/= n 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 ;; Check messages one by one, advancing message number up or down
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 ;; but searching forward through each message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 (if reversep
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 (while (and (null win) (> msg 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690 (goto-char (rmail-msgbeg (setq msg (1- msg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 (setq win (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 regexp (rmail-msgend msg) t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 (while (and (null win) (< msg rmail-total-messages))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694 (goto-char (rmail-msgbeg (setq msg (1+ msg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 (setq win (re-search-forward regexp (rmail-msgend msg) t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 (setq n (+ n (if reversep 1 -1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 (if win
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 ;; If this is a reverse search and we found a message,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700 ;; search backward thru this message to position point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 (if reversep
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703 (goto-char (rmail-msgend msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704 (re-search-backward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705 regexp (rmail-msgbeg msg) t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 (setq win (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707 (rmail-show-message msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 (message "%sRmail search for %s...done"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709 (if reversep "Reverse " "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710 regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711 (goto-char win))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 (goto-char opoint)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713 (narrow-to-region omin omax)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714 (ding)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 (message "Search failed: %s" regexp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 (defun rmail-search-backwards (regexp &optional n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 "Show message containing previous match for REGEXP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719 Prefix argument gives repeat count; negative argument means search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 forward (through later messages).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 Interactively, empty argument means use same regexp used last time."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 (let* ((reversep (>= (prefix-numeric-value current-prefix-arg) 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 (prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725 (concat (if reversep "Reverse " "") "Rmail search (regexp): "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 (if rmail-search-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 (setq prompt (concat prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 "(default "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 rmail-search-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 ") ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732 (setq regexp (read-string prompt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 (cond ((not (equal regexp ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 (setq rmail-search-last-regexp regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 ((not rmail-search-last-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1736 (error "No previous Rmail search string")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 (list rmail-search-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 (prefix-numeric-value current-prefix-arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1739 (rmail-search regexp (- (or n -1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741 ;; Show the first message which has the `unseen' attribute.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 (defun rmail-first-unseen-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 (rmail-maybe-set-message-counters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744 (let ((current 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 found)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 (while (and (not found) (< current rmail-total-messages))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 (if (rmail-message-labels-p current ", ?\\(unseen\\),")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 (setq found current))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 (setq current (1+ current))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752 ;; Let the caller show the message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753 ;; (if found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754 ;; (rmail-show-message found))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755 found))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 ;;;; *** Rmail Message Deletion Commands ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 (defun rmail-message-deleted-p (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 (= (aref rmail-deleted-vector n) ?D))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762 (defun rmail-set-message-deleted-p (n state)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 (aset rmail-deleted-vector n (if state ?D ?\ )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765 (defun rmail-delete-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 "Delete this message and stay on it."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 (rmail-set-attribute "deleted" t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770 (defun rmail-undelete-previous-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771 "Back up to deleted message, select it, and undelete it."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 (let ((msg rmail-current-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 (while (and (> msg 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 (not (rmail-message-deleted-p msg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776 (setq msg (1- msg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777 (if (= msg 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778 (error "No previous deleted message")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 (if (/= msg rmail-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 (rmail-show-message msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781 (rmail-set-attribute "deleted" nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782 (if (rmail-summary-exists)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784 (set-buffer rmail-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785 (rmail-summary-mark-undeleted msg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 (rmail-maybe-display-summary))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 (defun rmail-delete-forward (&optional backward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 "Delete this message and move to next nondeleted one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790 Deleted messages stay in the file until the \\[rmail-expunge] command is given.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 With prefix argument, delete and move backward.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 Returns t if a new message is displayed after the delete, or nil otherwise."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795 (rmail-set-attribute "deleted" t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796 (let ((del-msg rmail-current-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1797 (if (rmail-summary-exists)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799 (set-buffer rmail-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800 (rmail-summary-mark-deleted del-msg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801 (prog1 (rmail-next-undeleted-message (if backward -1 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802 (rmail-maybe-display-summary))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 (defun rmail-delete-backward ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 "Delete this message and move to previous nondeleted one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 Deleted messages stay in the file until the \\[rmail-expunge] command is given."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808 (rmail-delete-forward t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 (defun rmail-only-expunge ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811 "Actually erase all deleted messages in the file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813 (message "Expunging deleted messages...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814 ;; Discard all undo records for this buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815 (or (eq buffer-undo-list t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1816 (setq buffer-undo-list nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817 (rmail-maybe-set-message-counters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818 (let* ((omax (- (buffer-size) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 (omin (- (buffer-size) (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 (opoint (if (and (> rmail-current-message 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821 (= ?D (aref rmail-deleted-vector rmail-current-message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822 0 (- (point) (point-min))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1823 (messages-head (cons (aref rmail-message-vector 0) nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 (messages-tail messages-head)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825 ;; Don't make any undo records for the expunging.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 (buffer-undo-list t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827 (win))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832 (let ((counter 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833 (number 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 (total rmail-total-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 (new-message-number rmail-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 (new-summary nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 (buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838 (messages rmail-message-vector)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 (deleted rmail-deleted-vector)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 (summary rmail-summary-vector))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841 (setq rmail-total-messages nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842 rmail-current-message nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1843 rmail-message-vector nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1844 rmail-deleted-vector nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1845 rmail-summary-vector nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1846 (while (<= number total)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847 (if (= (aref deleted number) ?D)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 (delete-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850 (marker-position (aref messages number))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1851 (marker-position (aref messages (1+ number))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852 (move-marker (aref messages number) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853 (if (> new-message-number counter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 (setq new-message-number (1- new-message-number))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 (setq counter (1+ counter))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 (setq messages-tail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 (setcdr messages-tail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 (cons (aref messages number) nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859 (setq new-summary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 (cons (if (= counter number) (aref summary (1- number)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861 new-summary)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862 (if (zerop (% (setq number (1+ number)) 20))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863 (message "Expunging deleted messages...%d" number)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864 (setq messages-tail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865 (setcdr messages-tail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 (cons (aref messages number) nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1867 (setq rmail-current-message new-message-number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868 rmail-total-messages counter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869 rmail-message-vector (apply 'vector messages-head)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870 rmail-deleted-vector (make-string (1+ counter) ?\ )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 rmail-summary-vector (vconcat (nreverse new-summary))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 win t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873 (message "Expunging deleted messages...done")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874 (if (not win)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875 (narrow-to-region (- (buffer-size) omin) (- (buffer-size) omax)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 (rmail-show-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 (if (zerop rmail-current-message) 1 nil))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1878 ;; 1996/12/9 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1879 ;; to avoid error but it is quit bad way
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1880 (if (> (+ (point) opoint)(point-max))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1881 (goto-char (point-max))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1882 (forward-char opoint)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 70
diff changeset
1883 ))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885 (defun rmail-expunge ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 "Erase deleted messages from Rmail file and summary buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888 (rmail-only-expunge)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 (if (rmail-summary-exists)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1890 (rmail-select-summary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1891 (rmail-update-summary))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1893 ;;;; *** Rmail Mailing Commands ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895 (defun rmail-start-mail (&rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896 (if (and window-system rmail-mail-new-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1898 (apply 'mail-other-frame args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1899 (modify-frame-parameters (selected-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1900 '((dedicated . t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1901 (apply 'mail-other-window args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1902
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1903 (defun rmail-mail ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1904 "Send mail in another window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1905 While composing the message, use \\[mail-yank-original] to yank the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1906 original message into it."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1907 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1908 (rmail-start-mail nil nil nil nil nil (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1909
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1910 (defun rmail-continue ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1911 "Continue composing outgoing message previously being composed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1912 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1913 (rmail-start-mail t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1914
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1915 (defun rmail-reply (just-sender)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1916 "Reply to the current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917 Normally include CC: to all other recipients of original message;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1918 prefix argument means ignore them. While composing the reply,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1919 use \\[mail-yank-original] to yank the original message into it."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1920 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1921 (let (from reply-to cc subject date to message-id resent-reply-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1923 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1924 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1925 (goto-char (rmail-msgbeg rmail-current-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1926 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1927 (if (= (following-char) ?0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1928 (narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929 (progn (forward-line 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1930 (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1931 (progn (search-forward "\n\n" (rmail-msgend rmail-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1932 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1933 (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1934 (narrow-to-region (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1935 (progn (search-forward "\n*** EOOH ***\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1936 (beginning-of-line) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937 (setq resent-reply-to (mail-fetch-field "resent-reply-to" t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938 from (mail-fetch-field "from")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1939 reply-to (or resent-reply-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1940 (mail-fetch-field "reply-to" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1941 from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1942 cc (cond (just-sender nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1943 (resent-reply-to (mail-fetch-field "resent-cc" t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1944 (t (mail-fetch-field "cc" nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1945 subject (or (and resent-reply-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1946 (mail-fetch-field "resent-subject" t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947 (mail-fetch-field "subject"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1948 date (cond (resent-reply-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949 (mail-fetch-field "resent-date" t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950 ((mail-fetch-field "date")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951 to (cond (resent-reply-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 (mail-fetch-field "resent-to" t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953 ((mail-fetch-field "to" nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954 ;((mail-fetch-field "apparently-to")) ack gag barf
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1955 (t ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956 message-id (cond (resent-reply-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957 (mail-fetch-field "resent-message-id" t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1958 ((mail-fetch-field "message-id"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1959 (and (stringp subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1960 (or (string-match (concat "\\`" (regexp-quote rmail-reply-prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1961 subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1962 (setq subject (concat rmail-reply-prefix subject))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1963 (rmail-start-mail nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1964 (mail-strip-quoted-names reply-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1965 subject
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1966 (rmail-make-in-reply-to-field from date message-id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1967 (if just-sender
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1968 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1969 (let* ((cc-list (rmail-dont-reply-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1970 (mail-strip-quoted-names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971 (if (null cc) to (concat to ", " cc))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1972 (if (string= cc-list "") nil cc-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1973 (current-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1974 (list (list '(lambda (buf msgnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976 (set-buffer buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977 (rmail-set-attribute "answered" t msgnum)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1978 (current-buffer) rmail-current-message)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1979
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1980 (defun rmail-make-in-reply-to-field (from date message-id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1981 (cond ((not from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1982 (if message-id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983 message-id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1984 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1985 (mail-use-rfc822
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1986 (require 'rfc822)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1987 (let ((tem (car (rfc822-addresses from))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1988 (if message-id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1989 (if (string-match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1990 (regexp-quote (if (string-match "@[^@]*\\'" tem)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1991 (substring tem 0 (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1992 tem))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1993 message-id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1994 ;; Message-ID is sufficiently informative
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1995 message-id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1996 (concat message-id " (" tem ")"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1997 ;; Use prin1 to fake RFC822 quoting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1998 (let ((field (prin1-to-string tem)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1999 (if date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2000 (concat field "'s message of " date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2001 field)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2002 ((let* ((foo "[^][\000-\037\177-\377()<>@,;:\\\" ]+")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2003 (bar "[^][\000-\037\177-\377()<>@,;:\\\"]+"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2004 ;; Can't use format because format loses on \000 (unix *^&%*^&%$!!)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2005 (or (string-match (concat "\\`[ \t]*\\(" bar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2006 "\\)\\(<" foo "@" foo ">\\)?[ \t]*\\'")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2007 ;; "Unix Loser <Foo@bar.edu>" => "Unix Loser"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2008 from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2009 (string-match (concat "\\`[ \t]*<" foo "@" foo ">[ \t]*(\\("
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2010 bar "\\))[ \t]*\\'")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2011 ;; "<Bugs@bar.edu>" (Losing Unix) => "Losing Unix"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2012 from)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2013 (let ((start (match-beginning 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2014 (end (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2015 ;; Trim whitespace which above regexp match allows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2016 (while (and (< start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2017 (memq (aref from start) '(?\t ?\ )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2018 (setq start (1+ start)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2019 (while (and (< start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2020 (memq (aref from (1- end)) '(?\t ?\ )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2021 (setq end (1- end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2022 (let ((field (substring from start end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2023 (if date (setq field (concat "message from " field " on " date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2024 (if message-id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2025 ;; "<AA259@bar.edu> (message from Unix Loser on 1-Apr-89)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2026 (concat message-id " (" field ")")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2027 field))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2028 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2029 ;; If we can't kludge it simply, do it correctly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2030 (let ((mail-use-rfc822 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2031 (rmail-make-in-reply-to-field from date message-id)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2032
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2033 (defun rmail-forward (resend)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2034 "Forward the current message to another user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2035 With prefix argument, \"resend\" the message instead of forwarding it;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2036 see the documentation of `rmail-resend'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2037 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2038 (if resend
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2039 (call-interactively 'rmail-resend)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2040 (let ((forward-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2041 (subject (concat "["
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2042 (let ((from (or (mail-fetch-field "From")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2043 (mail-fetch-field ">From"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2044 (if from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2045 (concat (mail-strip-quoted-names from) ": ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2046 ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2047 (or (mail-fetch-field "Subject") "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2048 "]")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2049 ;; If only one window, use it for the mail buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2050 ;; Otherwise, use another window for the mail buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2051 ;; so that the Rmail buffer remains visible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2052 ;; and sending the mail will get back to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2053 (if (funcall (if (and (not rmail-mail-new-frame) (one-window-p t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2054 (function mail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055 (function rmail-start-mail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2056 nil nil subject nil nil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2057 (list (list (function (lambda (buf msgnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2058 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2059 (set-buffer buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2060 (rmail-set-attribute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2061 "forwarded" t msgnum))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2062 (current-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2063 rmail-current-message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2064 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2065 ;; Insert after header separator--before signature if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2066 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2067 (search-forward-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2068 (concat "^" (regexp-quote mail-header-separator)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2069 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2070 (insert-buffer forward-buffer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2071
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2072 (defun rmail-resend (address &optional from comment mail-alias-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2073 "Resend current message to ADDRESSES.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2074 ADDRESSES should be a single address, a a string consisting of several
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2075 addresses separated by commas, or a list of addresses.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2076
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2077 Optional FROM is the address to resend the message from, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2078 defaults to the username of the person redistributing the message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2079 Optional COMMENT is a string that will be inserted as a comment in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2080 resent message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2081 Optional ALIAS-FILE is alternate aliases file to be used by sendmail,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2082 typically for purposes of moderating a list."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2083 (interactive "sResend to: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2084 (require 'sendmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2085 ;;(require 'mailalias)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2086 (if (not from) (setq from (user-login-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2087 (let ((tembuf (generate-new-buffer " sendmail temp"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2088 (mail-header-separator "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2089 (case-fold-search nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2090 (mailbuf (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2091 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2092 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2093 ;;>> Copy message into temp buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2094 (set-buffer tembuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2095 (insert-buffer-substring mailbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2096 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2097 ;; Delete any Sender field, since that's not specifyable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2098 (if (re-search-forward "^Sender:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2099 (let (beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2100 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2101 (setq beg (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2102 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2103 (while (looking-at "[ \t]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2104 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2105 (delete-region beg (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2106 ;;>> Insert resent-from:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2107 (insert "Resent-From: " from "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2108 (insert "Resent-Date: " (mail-rfc822-date) "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2109 ;;>> Insert resent-to: and bcc if need be.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2110 (progn ;;let ((before (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2111 (if mail-self-blind
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2112 (insert "Resent-Bcc: " (user-login-name) "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2113 (insert "Resent-To: " (if (stringp address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2114 address
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2115 (mapconcat 'identity address ",\n\t"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2116 "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2117 ;; lose this loser. -jwz
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2118 ;;(expand-mail-aliases before (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2119 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2120 ;;>> Set up comment, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2121 (if (and (sequencep comment) (not (zerop (length comment))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2122 (let ((before (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2123 after)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2124 (insert comment)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2125 (or (eolp) (insert "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2126 (setq after (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2127 (goto-char before)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2128 (while (< (point) after)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2129 (insert "Resent-Comment: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2130 (forward-line 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2131 ;; Don't expand aliases in the destination fields
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2132 ;; of the original message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2133 (let (mail-aliases)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2134 (sendmail-send-it)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2135 (kill-buffer tembuf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2136 (rmail-set-attribute "resent" t rmail-current-message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2138 (defvar mail-unsent-separator
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2139 (concat "^ *---+ +Unsent message follows +---+ *$\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2140 "^ *---+ +Returned message +---+ *$\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2141 "^ *---+ +Original message +---+ *$\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2142 "^ *--+ +begin message +--+ *$\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2143 "^ *---+ +Original message follows +---+ *$\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2144 "^|? *---+ +Message text follows: +---+ *|?$"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2146 (defun rmail-retry-failure ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2147 "Edit a mail message which is based on the contents of the current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2148 For a message rejected by the mail system, extract the interesting headers and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2149 the body of the original message; otherwise copy the current message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2150 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2151 (require 'mail-utils)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2152 (let (to subj irp2 cc orig-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2153 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2154 ;; Narrow down to just the quoted original message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2155 (rmail-beginning-of-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2156 (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2157 (or (re-search-forward mail-unsent-separator nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2158 (error "Cannot parse this as a failure message")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2159 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2160 (narrow-to-region (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2161 ;; Now mail-fetch-field will get from headers of the original message,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2162 ;; not from the headers of the rejection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2163 (setq to (mail-fetch-field "To")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2164 subj (mail-fetch-field "Subject")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2165 irp2 (mail-fetch-field "In-reply-to")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2166 cc (mail-fetch-field "Cc"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2167 ;; Get the entire text (not headers) of the original message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2168 (setq orig-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2169 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2170 (progn (search-forward "\n\n") (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2171 (point-max)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2172 ;; Start sending a new message; default header fields from the original.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2173 ;; Turn off the usual actions for initializing the message body
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2174 ;; because we want to get only the text from the failure message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2175 (let (mail-signature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2176 (mail-setup-hook rmail-retry-setup-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2177 (if (rmail-start-mail nil to subj irp2 cc (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2178 ;; Insert original text as initial text of new draft message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2179 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2180 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2181 (insert orig-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2182 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2183 (end-of-line))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2185 (defun rmail-bury ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2186 "Bury current Rmail buffer and its summary buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2187 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2188 (let ((rmail-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2189 (if (rmail-summary-exists)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2190 (let (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2191 (while (setq window (get-buffer-window rmail-summary-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2192 (set-window-buffer window (other-buffer rmail-summary-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2193 (bury-buffer rmail-summary-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2194 (switch-to-buffer (other-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2195 (bury-buffer rmail-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2197 (defun rmail-summary-exists ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2198 "Non-nil iff in an RMAIL buffer and an associated summary buffer exists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2199 Non-nil value returned is the summary buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2200 (and rmail-summary-buffer (buffer-name rmail-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2201 rmail-summary-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2203 (defun rmail-summary-displayed ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2204 "t iff in RMAIL buffer and an associated summary buffer is displayed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2205 (and (rmail-summary-exists) (get-buffer-window rmail-summary-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2207 (defvar rmail-redisplay-summary nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2208 "*Non-nil means Rmail should show the summary when it changes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2209 This has an effect only if a summary buffer exists.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2211 ;; Put the summary buffer back on the screen, if user wants that.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2212 (defun rmail-maybe-display-summary ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2213 (and (rmail-summary-exists)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2214 rmail-redisplay-summary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2215 (display-buffer rmail-summary-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2216
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2217 ;;;; *** Rmail Specify Inbox Files ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2218
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2219 (autoload 'set-rmail-inbox-list "rmailmsc"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2220 "Set the inbox list of the current RMAIL file to FILE-NAME.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2221 This may be a list of file names separated by commas.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2222 If FILE-NAME is empty, remove any inbox list."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2223 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2224
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2225 ;;;; *** Rmail Commands for Labels ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2227 (autoload 'rmail-add-label "rmailkwd"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2228 "Add LABEL to labels associated with current RMAIL message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2229 Completion is performed over known labels when reading."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2230 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2232 (autoload 'rmail-kill-label "rmailkwd"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2233 "Remove LABEL from labels associated with current RMAIL message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2234 Completion is performed over known labels when reading."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2235 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2237 (autoload 'rmail-next-labeled-message "rmailkwd"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2238 "Show next message with LABEL. Defaults to last label used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2239 With prefix argument N moves forward N messages with this label."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2240 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2242 (autoload 'rmail-previous-labeled-message "rmailkwd"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2243 "Show previous message with LABEL. Defaults to last label used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2244 With prefix argument N moves backward N messages with this label."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2245 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2247 (autoload 'rmail-read-label "rmailkwd"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2248 "PROMPT and read with completion an Rmail message label."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2249 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2251 ;;;; *** Rmail Edit Mode ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2253 (autoload 'rmail-edit-current-message "rmailedit"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2254 "Edit the contents of the current message"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2255 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2257 ;;;; *** Rmail Sorting ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2259 (autoload 'rmail-sort-by-date "rmailsort"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2260 "Sort messages of current Rmail file by date.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2261 If prefix argument REVERSE is non-nil, sort them in reverse order." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2262
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2263 (autoload 'rmail-sort-by-subject "rmailsort"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2264 "Sort messages of current Rmail file by subject.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2265 If prefix argument REVERSE is non-nil, sort them in reverse order." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2267 (autoload 'rmail-sort-by-author "rmailsort"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2268 "Sort messages of current Rmail file by author.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2269 If prefix argument REVERSE is non-nil, sort them in reverse order." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2271 (autoload 'rmail-sort-by-recipient "rmailsort"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2272 "Sort messages of current Rmail file by recipient.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2273 If prefix argument REVERSE is non-nil, sort them in reverse order." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2275 (autoload 'rmail-sort-by-correspondent "rmailsort"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2276 "Sort messages of current Rmail file by other correspondent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2277 If prefix argument REVERSE is non-nil, sort them in reverse order." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2279 (autoload 'rmail-sort-by-lines "rmailsort"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2280 "Sort messages of current Rmail file by number of lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2281 If prefix argument REVERSE is non-nil, sort them in reverse order." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2282
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2283 ;;;; *** Rmail Summary Mode ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2285 (autoload 'rmail-summary "rmailsum"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2286 "Display a summary of all messages, one line per message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2287 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2289 (autoload 'rmail-summary-by-labels "rmailsum"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2290 "Display a summary of all messages with one or more LABELS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2291 LABELS should be a string containing the desired labels, separated by commas."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2292 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2293
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2294 (autoload 'rmail-summary-by-recipients "rmailsum"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2295 "Display a summary of all messages with the given RECIPIENTS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2296 Normally checks the To, From and Cc fields of headers; but if PRIMARY-ONLY
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2297 is non-nil (prefix arg given), only look in the To and From fields.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2298 RECIPIENTS is a string of regexps separated by commas."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2299 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2301 (autoload 'rmail-summary-by-regexp "rmailsum"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2302 "Display a summary of all messages according to regexp REGEXP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2303 If the regular expression is found in the header of the message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2304 \(including in the date and other lines, as well as the subject line),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2305 Emacs will list the header line in the RMAIL-summary."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2306 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2307
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2308 (autoload 'rmail-summary-by-topic "rmailsum"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2309 "Display a summary of all messages with the given SUBJECT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2310 Normally checks the Subject field of headers;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2311 but if WHOLE-MESSAGE is non-nil (prefix arg given),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2312 look in the whole message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2313 SUBJECT is a string of regexps separated by commas."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2314 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2316 ;;;; *** Rmail output messages to files ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2318 (autoload 'rmail-output-to-rmail-file "rmailout"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2319 "Append the current message to an Rmail file named FILE-NAME.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2320 If the file does not exist, ask if it should be created.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2321 If file is being visited, the message is appended to the Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2322 buffer visiting that file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2323 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2324
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2325 (autoload 'rmail-output "rmailout"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2326 "Append this message to Unix mail file named FILE-NAME."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2327 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2329 ;;;; *** Rmail undigestification ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2331 (autoload 'undigestify-rmail-message "undigest"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2332 "Break up a digest message into its constituent messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2333 Leaves original message, deleted, before the undigestified messages."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2334 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2335
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2336 (provide 'rmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2338 ;;; rmail.el ends here