annotate lisp/rmail/rmailsum.el @ 120:cca96a509cfe r20-1b12

Import from CVS: tag r20-1b12
author cvs
date Mon, 13 Aug 2007 09:25:29 +0200
parents 364816949b59
children
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 ;;; rmailsum.el --- make summary buffers for the mail reader
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1985, 1993 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Maintainer: FSF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Keywords: mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
23 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; Extended by Bob Weiner of Motorola
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; Provided all commands from rmail-mode in rmail-summary-mode and made key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; bindings in both modes wholly compatible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; Entry points for making a summary buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (defvar rmail-summary-redo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (defvar rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (defvar rmail-summary-mode-map nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;; Regenerate the contents of the summary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; using the same selection criterion as last time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; M-x revert-buffer in a summary buffer calls this function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (defun rmail-update-summary (&rest ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (apply (car rmail-summary-redo) (cdr rmail-summary-redo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (defun rmail-summary ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 "Display a summary of all messages, one line per message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (rmail-new-summary "All" '(rmail-summary) nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (defun rmail-summary-by-labels (labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 "Display a summary of all messages with one or more LABELS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 LABELS should be a string containing the desired labels, separated by commas."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (interactive "sLabels to summarize by: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (if (string= labels "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (setq labels (or rmail-last-multi-labels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (error "No label specified"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (setq rmail-last-multi-labels labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (rmail-new-summary (concat "labels " labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (list 'rmail-summary-by-labels labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 'rmail-message-labels-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (concat ", \\(" (mail-comma-list-regexp labels) "\\),")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (defun rmail-summary-by-recipients (recipients &optional primary-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 "Display a summary of all messages with the given RECIPIENTS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 Normally checks the To, From and Cc fields of headers;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 but if PRIMARY-ONLY is non-nil (prefix arg given),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 only look in the To and From fields.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 RECIPIENTS is a string of regexps separated by commas."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (interactive "sRecipients to summarize by: \nP")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (rmail-new-summary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (concat "recipients " recipients)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (list 'rmail-summary-by-recipients recipients primary-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 'rmail-message-recipients-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (mail-comma-list-regexp recipients) primary-only))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (defun rmail-summary-by-regexp (regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 "Display a summary of all messages according to regexp REGEXP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 If the regular expression is found in the header of the message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 \(including in the date and other lines, as well as the subject line),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 Emacs will list the header line in the RMAIL-summary."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (interactive "sRegexp to summarize by: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (if (string= regexp "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (setq regexp (or rmail-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (error "No regexp specified."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (setq rmail-last-regexp regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (rmail-new-summary (concat "regexp " regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (list 'rmail-summary-by-regexp regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 'rmail-message-regexp-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 ;; rmail-summary-by-topic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ;; 1989 R.A. Schnitzler
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (defun rmail-summary-by-topic (subject &optional whole-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 "Display a summary of all messages with the given SUBJECT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 Normally checks the Subject field of headers;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 but if WHOLE-MESSAGE is non-nil (prefix arg given),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 look in the whole message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 SUBJECT is a string of regexps separated by commas."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (interactive "sTopics to summarize by: \nP")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (rmail-new-summary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (concat "about " subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (list 'rmail-summary-by-topic subject whole-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 'rmail-message-subject-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (mail-comma-list-regexp subject) whole-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (defun rmail-message-subject-p (msg subject &optional whole-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (goto-char (rmail-msgbeg msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (search-forward "\n*** EOOH ***\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (progn (search-forward (if whole-message "\^_" "\n\n")) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (if whole-message (re-search-forward subject nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (string-match subject (or (mail-fetch-field "Subject") "")) )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (defun rmail-summary-by-senders (senders)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 "Display a summary of all messages with the given SENDERS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 SENDERS is a string of names separated by commas."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (interactive "sSenders to summarize by: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (rmail-new-summary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (concat "senders " senders)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 'rmail-message-senders-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (mail-comma-list-regexp senders)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (defun rmail-message-senders-p (msg senders)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (goto-char (rmail-msgbeg msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (search-forward "\n*** EOOH ***\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (narrow-to-region (point) (progn (search-forward "\n\n") (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (string-match senders (or (mail-fetch-field "From") ""))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 ;; General making of a summary buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (defvar rmail-summary-symbol-number 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (defun rmail-new-summary (description redo-form function &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 "Create a summary of selected messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 DESCRIPTION makes part of the mode line of the summary buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 For each message, FUNCTION is applied to the message number and ARGS...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 and if the result is non-nil, that message is included.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 nil for FUNCTION means all messages."
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 16
diff changeset
144 (if (eq major-mode 'mime/viewer-mode)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 16
diff changeset
145 (let ((buf mime::preview/article-buffer)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 16
diff changeset
146 (pbuf (current-buffer))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 16
diff changeset
147 )
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 16
diff changeset
148 (switch-to-buffer buf)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 16
diff changeset
149 (bury-buffer pbuf)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 16
diff changeset
150 ))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (message "Computing summary lines...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (let (sumbuf mesg was-in-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ;; Go to the Rmail buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (if (eq major-mode 'rmail-summary-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (setq was-in-summary t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (set-buffer rmail-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ;; Find its summary buffer, or make one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (setq sumbuf
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (if (and rmail-summary-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (buffer-name rmail-summary-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 rmail-summary-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (generate-new-buffer (concat (buffer-name) "-summary"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (setq mesg rmail-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;; Filter the messages; make or get their summary lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (let ((summary-msgs ())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (new-summary-line-count 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (let ((msgnum 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (while (>= rmail-total-messages msgnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (if (or (null function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (apply function (cons msgnum args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (setq summary-msgs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (cons (cons msgnum (rmail-make-summary-line msgnum))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 summary-msgs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (setq msgnum (1+ msgnum)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (setq summary-msgs (nreverse summary-msgs)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ;; Temporarily, while summary buffer is unfinished,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 ;; we "don't have" a summary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (setq rmail-summary-buffer nil)
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 (let ((rbuf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (total rmail-total-messages))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (set-buffer sumbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ;; Set up the summary buffer's contents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (while summary-msgs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (princ (cdr (car summary-msgs)) sumbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (setq summary-msgs (cdr summary-msgs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (goto-char (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ;; Set up the rest of its state and local variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (setq buffer-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (rmail-summary-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (make-local-variable 'minor-mode-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (setq minor-mode-alist (list '(t (concat ": " description))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (setq rmail-buffer rbuf
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 rmail-summary-redo redo-form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 rmail-total-messages total))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (setq rmail-summary-buffer sumbuf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 ;; Now display the summary buffer and go to the right place in it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (or was-in-summary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (pop-to-buffer sumbuf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (rmail-summary-goto-msg mesg t t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (message "Computing summary lines...done")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 ;; Low levels of generating a summary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (defun rmail-make-summary-line (msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (let ((line (or (aref rmail-summary-vector (1- msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (setq new-summary-line-count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (1+ new-summary-line-count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (if (zerop (% new-summary-line-count 10))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (message "Computing summary lines...%d"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 new-summary-line-count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (rmail-make-summary-line-1 msg)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ;; Fix up the part of the summary that says "deleted" or "unseen".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (aset line 4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (if (rmail-message-deleted-p msg) ?\D
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (if (= ?0 (char-after (+ 3 (rmail-msgbeg msg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 ?\- ?\ )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (defun rmail-make-summary-line-1 (msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (goto-char (rmail-msgbeg msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (let* (;;(lim (save-excursion (forward-line 2) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (labels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (forward-char 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 ; (if (save-excursion (re-search-forward ",answered," lim t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 ; "*" "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 ; (if (save-excursion (re-search-forward ",filed," lim t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ; "!" "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (if (progn (search-forward ",,") (eolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (concat "{"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (buffer-substring (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (progn (end-of-line) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 "} ")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (if (looking-at "Summary-line: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (goto-char (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (progn ;;setq line -jwz
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (buffer-substring (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (progn (forward-line 1) (point)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 ;; Obsolete status lines lacking a # should be flushed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (and line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (not (string-match "#" line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (delete-region (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (progn (forward-line -1) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (setq line nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ;; If we didn't get a valid status line from the message,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 ;; make a new one and put it in the message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (or line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (let* ((case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (next (rmail-msgend msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (beg (if (progn (goto-char (rmail-msgbeg msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (search-forward "\n*** EOOH ***\n" next t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (end (progn (search-forward "\n\n" nil t) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (narrow-to-region beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (goto-char beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (setq line (rmail-make-basic-summary-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (goto-char (rmail-msgbeg msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (forward-line 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (insert "Summary-line: " line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (setq pos (string-match "#" line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (aset rmail-summary-vector (1- msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (concat (format "%4d " msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (substring line 0 pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 labels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (substring line (1+ pos))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (defun rmail-make-basic-summary-line ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (concat (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (if (not (re-search-forward "^Date:" nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (cond ((re-search-forward "\\([^0-9:]\\)\\([0-3]?[0-9]\\)\\([- \t_]+\\)\\([adfjmnos][aceopu][bcglnprtvy]\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (save-excursion (end-of-line) (point)) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (format "%2d-%3s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (string-to-int (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (match-beginning 4) (match-end 4))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 ((re-search-forward "\\([^a-z]\\)\\([adfjmnos][acepou][bcglnprtvy]\\)\\([-a-z \t_]*\\)\\([0-9][0-9]?\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (save-excursion (end-of-line) (point)) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (format "%2d-%3s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (string-to-int (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (match-beginning 4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (match-end 4)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (match-beginning 2) (match-end 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (t "??????"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (if (not (re-search-forward "^From:[ \t]*" nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (let* ((from (mail-strip-quoted-names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (1- (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (progn (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (skip-chars-backward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 len mch lo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (if (string-match (concat "^"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (regexp-quote (user-login-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 "\\($\\|@\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (if (not (re-search-forward "^To:[ \t]*" nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (setq from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (concat "to: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (mail-strip-quoted-names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (progn (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (skip-chars-backward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (point)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (setq len (length from))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (setq mch (string-match "[@%]" from))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (format "%25s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (if (or (not mch) (<= len 25))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (substring from (max 0 (- len 25)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (substring from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (setq lo (cond ((< (- mch 9) 0) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 ((< len (+ mch 16))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (- len 25))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (t (- mch 9))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (min len (+ lo 25))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 " #"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (if (re-search-forward "^Subject:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (progn (skip-chars-forward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (buffer-substring (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (progn (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (re-search-forward "[\n][\n]+" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (buffer-substring (point) (progn (end-of-line) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 ;; Simple motion in a summary buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (defun rmail-summary-next-all (&optional number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (forward-line (if number number 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (display-buffer rmail-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (defun rmail-summary-previous-all (&optional number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (forward-line (- (if number number 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (display-buffer rmail-buffer))
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-summary-next-msg (&optional number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 "Display next non-deleted msg from rmail file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 With optional prefix argument NUMBER, moves forward this number of non-deleted
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 messages, or backward if NUMBER is negative."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (forward-line 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (and (> number 0) (end-of-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (let ((count (if (< number 0) (- number) number))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (search (if (> number 0) 're-search-forward 're-search-backward))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (non-del-msg-found nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (while (and (> count 0) (setq non-del-msg-found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (or (funcall search "^....[^D]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 non-del-msg-found)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (setq count (1- count))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (display-buffer rmail-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (defun rmail-summary-previous-msg (&optional number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (rmail-summary-next-msg (- (if number number 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (defun rmail-summary-next-labeled-message (n labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 "Show next message with LABEL. Defaults to last labels used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 With prefix argument N moves forward N messages with these labels."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (interactive "p\nsMove to next msg with labels: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (rmail-next-labeled-message n labels)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (defun rmail-summary-previous-labeled-message (n labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 "Show previous message with LABEL. Defaults to last labels used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 With prefix argument N moves backward N messages with these labels."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (interactive "p\nsMove to previous msg with labels: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (rmail-previous-labeled-message n labels)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 ;; Delete and undelete summary commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (defun rmail-summary-delete-forward (&optional backward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 "Delete this message and move to next nondeleted one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 Deleted messages stay in the file until the \\[rmail-expunge] command is given.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 With prefix argument, delete and move backward."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (progn ;;let (end) ;jwz
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (rmail-summary-goto-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (pop-to-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (rmail-delete-forward backward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (pop-to-buffer rmail-summary-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (defun rmail-summary-delete-backward ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 "Delete this message and move to previous nondeleted one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 Deleted messages stay in the file until the \\[rmail-expunge] command is given."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (rmail-summary-delete-forward t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (defun rmail-summary-mark-deleted (&optional n undel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (and n (rmail-summary-goto-msg n t t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (or (eobp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (skip-chars-forward " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (skip-chars-forward "[0-9]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (if undel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (if (looking-at "D")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (progn (delete-char 1) (insert " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (delete-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (insert "D"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (beginning-of-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (defun rmail-summary-mark-undeleted (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (rmail-summary-mark-deleted n t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (defun rmail-summary-deleted-p (&optional n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (and n (rmail-summary-goto-msg n nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (skip-chars-forward " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (skip-chars-forward "[0-9]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (looking-at "D")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (defun rmail-summary-undelete (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 "Undelete current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 Optional prefix ARG means undelete ARG previous messages."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (if (/= arg 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (rmail-summary-undelete-many arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (cond ((re-search-backward "\\(^ *[0-9]*\\)\\(D\\)" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (replace-match "\\1 ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (rmail-summary-goto-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (pop-to-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (and (rmail-message-deleted-p rmail-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (rmail-undelete-previous-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (pop-to-buffer rmail-summary-buffer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (defun rmail-summary-undelete-many (&optional n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 "Undelete all deleted msgs, optional prefix arg N means undelete N prev msgs."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (let* ((init-msg (if n rmail-current-message rmail-total-messages))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (rmail-current-message init-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (n (or n rmail-total-messages))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (msgs-undeled 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (while (and (> rmail-current-message 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (< msgs-undeled n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (if (rmail-message-deleted-p rmail-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (progn (rmail-set-attribute "deleted" nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (setq msgs-undeled (1+ msgs-undeled))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (setq rmail-current-message (1- rmail-current-message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (set-buffer rmail-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (setq rmail-current-message init-msg msgs-undeled 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (while (and (> rmail-current-message 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (< msgs-undeled n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (if (rmail-summary-deleted-p rmail-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (progn (rmail-summary-mark-undeleted rmail-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (setq msgs-undeled (1+ msgs-undeled))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (setq rmail-current-message (1- rmail-current-message))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (rmail-summary-goto-msg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 ;; Rmail Summary mode is suitable only for specially formatted data.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (put 'rmail-summary-mode 'mode-class 'special)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (defun rmail-summary-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 "Rmail Summary Mode is invoked from Rmail Mode by using \\<rmail-mode-map>\\[rmail-summary].
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 As commands are issued in the summary buffer, they are applied to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 corresponding mail messages in the rmail buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 All normal editing commands are turned off.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 Instead, nearly all the Rmail mode commands are available,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 though many of them move only among the messages in the summary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 These additional commands exist:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 \\[rmail-summary-undelete-many] Undelete all or prefix arg deleted messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 \\[rmail-summary-wipe] Delete the summary and go to the Rmail buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 Commands for sorting the summary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 \\[rmail-summary-sort-by-date] Sort by date.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 \\[rmail-summary-sort-by-subject] Sort by subject.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 \\[rmail-summary-sort-by-author] Sort by author.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 \\[rmail-summary-sort-by-recipient] Sort by recipient.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 \\[rmail-summary-sort-by-correspondent] Sort by correspondent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 \\[rmail-summary-sort-by-lines] Sort by lines."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 (kill-all-local-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (setq major-mode 'rmail-summary-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (setq mode-name "RMAIL Summary")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (use-local-map rmail-summary-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (setq truncate-lines t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (setq buffer-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (set-syntax-table text-mode-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (make-local-variable 'rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (make-local-variable 'rmail-total-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (make-local-variable 'rmail-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (setq rmail-current-message nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 (make-local-variable 'rmail-summary-redo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (setq rmail-summary-redo nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (make-local-variable 'revert-buffer-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (setq revert-buffer-function 'rmail-update-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (make-local-hook 'post-command-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (add-hook 'post-command-hook 'rmail-summary-rmail-update nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (run-hooks 'rmail-summary-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 ;; Show in Rmail the message described by the summary line that point is on,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 ;; but only if the Rmail buffer is already visible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 ;; This is a post-command-hook in summary buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (defun rmail-summary-rmail-update ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (if (get-buffer-window rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (let (buffer-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (skip-chars-forward " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (let ((beg (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 msg-num
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 ;;(buf rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (skip-chars-forward "0-9")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (setq msg-num (string-to-int (buffer-substring beg (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (or (eq rmail-current-message msg-num)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (let (;;go-where
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 window (owin (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (setq rmail-current-message msg-num)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (if (= (following-char) ?-)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (delete-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (insert " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (setq window (display-buffer rmail-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 ;; Using save-window-excursion caused the new value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 ;; of point to get lost.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (select-window window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (rmail-show-message msg-num))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (select-window owin)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (if rmail-summary-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (setq rmail-summary-mode-map (make-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (suppress-keymap rmail-summary-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (define-key rmail-summary-mode-map "a" 'rmail-summary-add-label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (define-key rmail-summary-mode-map "c" 'rmail-summary-continue)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (define-key rmail-summary-mode-map "d" 'rmail-summary-delete-forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (define-key rmail-summary-mode-map "\C-d" 'rmail-summary-delete-backward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (define-key rmail-summary-mode-map "e" 'rmail-summary-edit-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (define-key rmail-summary-mode-map "f" 'rmail-summary-forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (define-key rmail-summary-mode-map "g" 'rmail-summary-get-new-mail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (define-key rmail-summary-mode-map "h" 'rmail-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (define-key rmail-summary-mode-map "i" 'rmail-summary-input)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (define-key rmail-summary-mode-map "j" 'rmail-summary-goto-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (define-key rmail-summary-mode-map "k" 'rmail-summary-kill-label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (define-key rmail-summary-mode-map "l" 'rmail-summary-by-labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (define-key rmail-summary-mode-map "\e\C-h" 'rmail-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (define-key rmail-summary-mode-map "\e\C-l" 'rmail-summary-by-labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (define-key rmail-summary-mode-map "\e\C-r" 'rmail-summary-by-recipients)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (define-key rmail-summary-mode-map "\e\C-s" 'rmail-summary-by-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (define-key rmail-summary-mode-map "\e\C-t" 'rmail-summary-by-topic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (define-key rmail-summary-mode-map "m" 'rmail-summary-mail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (define-key rmail-summary-mode-map "\M-m" 'rmail-summary-retry-failure)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (define-key rmail-summary-mode-map "n" 'rmail-summary-next-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (define-key rmail-summary-mode-map "\en" 'rmail-summary-next-all)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (define-key rmail-summary-mode-map "\e\C-n" 'rmail-summary-next-labeled-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (define-key rmail-summary-mode-map "o" 'rmail-summary-output-to-rmail-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (define-key rmail-summary-mode-map "\C-o" 'rmail-summary-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (define-key rmail-summary-mode-map "p" 'rmail-summary-previous-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (define-key rmail-summary-mode-map "\ep" 'rmail-summary-previous-all)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (define-key rmail-summary-mode-map "\e\C-p" 'rmail-summary-previous-labeled-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (define-key rmail-summary-mode-map "q" 'rmail-summary-quit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (define-key rmail-summary-mode-map "r" 'rmail-summary-reply)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (define-key rmail-summary-mode-map "s" 'rmail-summary-expunge-and-save)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (define-key rmail-summary-mode-map "\es" 'rmail-summary-search)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (define-key rmail-summary-mode-map "t" 'rmail-summary-toggle-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (define-key rmail-summary-mode-map "u" 'rmail-summary-undelete)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (define-key rmail-summary-mode-map "\M-u" 'rmail-summary-undelete-many)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (define-key rmail-summary-mode-map "w" 'rmail-summary-wipe)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (define-key rmail-summary-mode-map "x" 'rmail-summary-expunge)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 (define-key rmail-summary-mode-map "." 'rmail-summary-beginning-of-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (define-key rmail-summary-mode-map "<" 'rmail-summary-first-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 (define-key rmail-summary-mode-map ">" 'rmail-summary-last-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 (define-key rmail-summary-mode-map " " 'rmail-summary-scroll-msg-up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (define-key rmail-summary-mode-map "\177" 'rmail-summary-scroll-msg-down)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (define-key rmail-summary-mode-map "?" 'describe-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (define-key rmail-summary-mode-map "\C-c\C-s\C-d"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 'rmail-summary-sort-by-date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (define-key rmail-summary-mode-map "\C-c\C-s\C-s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 'rmail-summary-sort-by-subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (define-key rmail-summary-mode-map "\C-c\C-s\C-a"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 'rmail-summary-sort-by-author)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (define-key rmail-summary-mode-map "\C-c\C-s\C-r"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 'rmail-summary-sort-by-recipient)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (define-key rmail-summary-mode-map "\C-c\C-s\C-c"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 'rmail-summary-sort-by-correspondent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (define-key rmail-summary-mode-map "\C-c\C-s\C-l"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 'rmail-summary-sort-by-lines)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 ;;; Menu bar bindings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 ;(define-key rmail-summary-mode-map [menu-bar] (make-sparse-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 ;(define-key rmail-summary-mode-map [menu-bar classify]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 ; (cons "Classify" (make-sparse-keymap "Classify")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 ;(define-key rmail-summary-mode-map [menu-bar classify output-inbox]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 ; '("Output (inbox)" . rmail-summary-output))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 ;(define-key rmail-summary-mode-map [menu-bar classify output]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 ; '("Output (Rmail)" . rmail-summary-output-to-rmail-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 ;(define-key rmail-summary-mode-map [menu-bar classify kill-label]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 ; '("Kill Label" . rmail-summary-kill-label))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 ;(define-key rmail-summary-mode-map [menu-bar classify add-label]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 ; '("Add Label" . rmail-summary-add-label))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 ;(define-key rmail-summary-mode-map [menu-bar summary]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 ; (cons "Summary" (make-sparse-keymap "Summary")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 ;(define-key rmail-summary-mode-map [menu-bar summary labels]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 ; '("By Labels" . rmail-summary-by-labels))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 ;(define-key rmail-summary-mode-map [menu-bar summary recipients]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 ; '("By Recipients" . rmail-summary-by-recipients))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 ;(define-key rmail-summary-mode-map [menu-bar summary topic]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 ; '("By Topic" . rmail-summary-by-topic))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 ;(define-key rmail-summary-mode-map [menu-bar summary regexp]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 ; '("By Regexp" . rmail-summary-by-regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 ;(define-key rmail-summary-mode-map [menu-bar summary all]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 ; '("All" . rmail-summary))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 ;(define-key rmail-summary-mode-map [menu-bar mail]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 ; (cons "Mail" (make-sparse-keymap "Mail")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 ;(define-key rmail-summary-mode-map [menu-bar mail continue]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 ; '("Continue" . rmail-summary-continue))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 ;(define-key rmail-summary-mode-map [menu-bar mail forward]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 ; '("Forward" . rmail-summary-forward))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 ;(define-key rmail-summary-mode-map [menu-bar mail retry]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 ; '("Retry" . rmail-summary-retry-failure))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 ;(define-key rmail-summary-mode-map [menu-bar mail reply]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 ; '("Reply" . rmail-summary-reply))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 ;(define-key rmail-summary-mode-map [menu-bar mail mail]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 ; '("Mail" . rmail-summary-mail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 ;(define-key rmail-summary-mode-map [menu-bar delete]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 ; (cons "Delete" (make-sparse-keymap "Delete")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 ;(define-key rmail-summary-mode-map [menu-bar delete expunge/save]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 ; '("Expunge/Save" . rmail-summary-expunge-and-save))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 ;(define-key rmail-summary-mode-map [menu-bar delete expunge]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 ; '("Expunge" . rmail-summary-expunge))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 ;(define-key rmail-summary-mode-map [menu-bar delete undelete]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 ; '("Undelete" . rmail-summary-undelete))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 ;(define-key rmail-summary-mode-map [menu-bar delete delete]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 ; '("Delete" . rmail-summary-delete-forward))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 ;(define-key rmail-summary-mode-map [menu-bar move]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 ; (cons "Move" (make-sparse-keymap "Move")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 ;(define-key rmail-summary-mode-map [menu-bar move search-back]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 ; '("Search Back" . rmail-summary-search-backward))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 ;(define-key rmail-summary-mode-map [menu-bar move search]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 ; '("Search" . rmail-summary-search))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 ;(define-key rmail-summary-mode-map [menu-bar move previous]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 ; '("Previous Nondeleted" . rmail-summary-previous-msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 ;(define-key rmail-summary-mode-map [menu-bar move next]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 ; '("Next Nondeleted" . rmail-summary-next-msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 ;(define-key rmail-summary-mode-map [menu-bar move last]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 ; '("Last" . rmail-summary-last-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 ;(define-key rmail-summary-mode-map [menu-bar move first]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 ; '("First" . rmail-summary-first-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 ;(define-key rmail-summary-mode-map [menu-bar move previous]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 ; '("Previous" . rmail-summary-previous-all))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 ;(define-key rmail-summary-mode-map [menu-bar move next]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 ; '("Next" . rmail-summary-next-all))
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-summary-goto-msg (&optional n nowarn skip-rmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 (if (consp n) (setq n (prefix-numeric-value n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (if (eobp) (forward-line -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 (let ((buf rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 (cur (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 (curmsg (string-to-int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 (buffer-substring (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 (min (point-max) (+ 5 (point)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 (if (not n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 (setq n curmsg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 (if (< n 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 (progn (message "No preceding message")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 (setq n 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 (if (> n rmail-total-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 (progn (message "No following message")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 (rmail-summary-goto-msg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (if (not (re-search-forward (concat "^ *" (int-to-string n)) nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 (progn (or nowarn (message "Message %d not found" n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (setq n curmsg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 (goto-char cur))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 (skip-chars-forward " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 (skip-chars-forward "0-9")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (save-excursion (if (= (following-char) ?-)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 (delete-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (insert " "))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (if skip-rmail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 (pop-to-buffer buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 (rmail-show-message n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 (pop-to-buffer rmail-summary-buffer))))
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-summary-scroll-msg-up (&optional dist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 "Scroll other window forward."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (scroll-other-window dist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (defun rmail-summary-scroll-msg-down (&optional dist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 "Scroll other window backward."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 (scroll-other-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (cond ((eq dist '-) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 ((null dist) '-)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 (t (- (prefix-numeric-value dist))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 (defun rmail-summary-beginning-of-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 "Show current message from the beginning."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 (pop-to-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 (beginning-of-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 (pop-to-buffer rmail-summary-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 (defun rmail-summary-quit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 "Quit out of Rmail and Rmail summary."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 (rmail-summary-wipe)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 (rmail-quit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 (defun rmail-summary-wipe ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 "Kill and wipe away Rmail summary, remaining within Rmail."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 (save-excursion (set-buffer rmail-buffer) (setq rmail-summary-buffer nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 (let ((local-rmail-buffer rmail-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 (kill-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 ;; Delete window if not only one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 (if (not (eq (selected-window) (next-window nil 'no-minibuf)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 (delete-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 ;; Switch windows to the rmail buffer, or switch to it in this window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 (pop-to-buffer local-rmail-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 (defun rmail-summary-expunge ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 "Actually erase all deleted messages and recompute summary headers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 (rmail-only-expunge))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 (rmail-update-summary))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 (defun rmail-summary-expunge-and-save ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 "Expunge and save RMAIL file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 (interactive)
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 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 (rmail-only-expunge))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 (rmail-update-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 (save-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 (defun rmail-summary-get-new-mail ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 "Get new mail and recompute summary headers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 (let (msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 (rmail-get-new-mail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 ;; Get the proper new message number.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 (setq msg rmail-current-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 ;; Make sure that message is displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 (rmail-summary-goto-msg msg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 (defun rmail-summary-input (filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 "Run Rmail on file FILENAME."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 (interactive "FRun rmail on RMAIL file: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 ;; We switch windows here, then display the other Rmail file there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 (pop-to-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 (rmail filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 (defun rmail-summary-first-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 "Show first message in Rmail file from summary buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 (beginning-of-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 (defun rmail-summary-last-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 "Show last message in Rmail file from summary buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (end-of-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 (forward-line -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 (defvar rmail-summary-edit-map nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 (if rmail-summary-edit-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 (setq rmail-summary-edit-map (make-sparse-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 (set-keymap-parent rmail-summary-edit-map text-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 (set-keymap-name rmail-summary-edit-map 'rmail-summary-edit-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 (define-key rmail-summary-edit-map "\C-c\C-c" 'rmail-cease-edit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 (define-key rmail-summary-edit-map "\C-c\C-]" 'rmail-abort-edit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 (defun rmail-summary-edit-current-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 "Edit the contents of this message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (pop-to-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (rmail-edit-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 (use-local-map rmail-summary-edit-map))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (defun rmail-summary-cease-edit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 "Finish editing message, then go back to Rmail summary buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (rmail-cease-edit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (pop-to-buffer rmail-summary-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 (defun rmail-summary-abort-edit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 "Abort edit of current message; restore original contents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 Go back to summary buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (rmail-abort-edit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 (pop-to-buffer rmail-summary-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 (defun rmail-summary-search-backward (regexp &optional n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 "Show message containing next match for REGEXP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 Prefix argument gives repeat count; negative argument means search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 backwards (through earlier messages).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 Interactively, empty argument means use same regexp used last time."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 (let* ((reversep (>= (prefix-numeric-value current-prefix-arg) 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 (prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (concat (if reversep "Reverse " "") "Rmail search (regexp): "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 (if rmail-search-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (setq prompt (concat prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 "(default "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 rmail-search-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 ") ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 (setq regexp (read-string prompt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 (cond ((not (equal regexp ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 (setq rmail-search-last-regexp regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 ((not rmail-search-last-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (error "No previous Rmail search string")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (list rmail-search-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (prefix-numeric-value current-prefix-arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 ;; Don't use save-excursion because that prevents point from moving
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 ;; properly in the summary buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 (let ((buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 (rmail-search regexp (- n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 (set-buffer buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 (defun rmail-summary-search (regexp &optional n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 "Show message containing next match for REGEXP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 Prefix argument gives repeat count; negative argument means search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 backwards (through earlier messages).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 Interactively, empty argument means use same regexp used last time."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 (let* ((reversep (< (prefix-numeric-value current-prefix-arg) 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 (concat (if reversep "Reverse " "") "Rmail search (regexp): "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 (if rmail-search-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 (setq prompt (concat prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 "(default "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 rmail-search-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 ") ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 (setq regexp (read-string prompt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 (cond ((not (equal regexp ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 (setq rmail-search-last-regexp regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 ((not rmail-search-last-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 (error "No previous Rmail search string")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 (list rmail-search-last-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 (prefix-numeric-value current-prefix-arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 ;; Don't use save-excursion because that prevents point from moving
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 ;; properly in the summary buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 (let ((buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (rmail-search regexp n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 (set-buffer buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 (defun rmail-summary-toggle-header ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 "Show original message header if pruned header currently shown, or vice versa."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (rmail-toggle-header)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 (defun rmail-summary-add-label (label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 "Add LABEL to labels associated with current Rmail message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 Completion is performed over known labels when reading."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 (interactive (list (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (rmail-read-label "Add label"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 (rmail-add-label label)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 (defun rmail-summary-kill-label (label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 "Remove LABEL from labels associated with current Rmail message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 Completion is performed over known labels when reading."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 (interactive (list (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 (rmail-read-label "Kill label"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 (rmail-set-label label nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 ;;;; *** Rmail Summary Mailing Commands ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 (defun rmail-summary-mail ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 "Send mail in another window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 While composing the message, use \\[mail-yank-original] to yank the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 original message into it."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (mail-other-window nil nil nil nil nil rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 (use-local-map (copy-keymap (current-local-map)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 (define-key (current-local-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 "\C-c\C-c" 'rmail-summary-send-and-exit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 (defun rmail-summary-continue ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 "Continue composing outgoing message previously being composed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (mail-other-window t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 (defun rmail-summary-reply (just-sender)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 "Reply to the current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 Normally include CC: to all other recipients of original message;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 prefix argument means ignore them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 While composing the reply, use \\[mail-yank-original] to yank the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 original message into it."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 (let (mailbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 (rmail-reply just-sender)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 (setq mailbuf (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 (pop-to-buffer mailbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 (use-local-map (copy-keymap (current-local-map)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (define-key (current-local-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 "\C-c\C-c" 'rmail-summary-send-and-exit)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 (defun rmail-summary-retry-failure ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 "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
1004 For a message rejected by the mail system, extract the interesting headers and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 the body of the original message; otherwise copy the current message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 (let (mailbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 (rmail-retry-failure)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 (setq mailbuf (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 (pop-to-buffer mailbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 (use-local-map (copy-keymap (current-local-map)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 (define-key (current-local-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 "\C-c\C-c" 'rmail-summary-send-and-exit)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (defun rmail-summary-send-and-exit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 "Send mail reply and return to summary buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 (mail-send-and-exit t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 (defun rmail-summary-forward (resend)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 "Forward the current message to another user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 With prefix argument, \"resend\" the message instead of forwarding it;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 see the documentation of `rmail-resend'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 (rmail-forward resend)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 (use-local-map (copy-keymap (current-local-map)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 (define-key (current-local-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 "\C-c\C-c" 'rmail-summary-send-and-exit)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 ;; Summary output commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 (defun rmail-summary-output-to-rmail-file ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 "Append the current message to an Rmail file named FILE-NAME.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 If the file does not exist, ask if it should be created.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 If file is being visited, the message is appended to the Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 buffer visiting that file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 (call-interactively 'rmail-output-to-rmail-file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 (defun rmail-summary-output ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 "Append this message to Unix mail file named FILE-NAME."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 (set-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 (call-interactively 'rmail-output)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 ;; Sorting messages in Rmail Summary buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 (defun rmail-summary-sort-by-date (reverse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 "Sort messages of current Rmail summary by date.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 If prefix argument REVERSE is non-nil, sort them in reverse order."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 (rmail-sort-from-summary (function rmail-sort-by-date) reverse))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 (defun rmail-summary-sort-by-subject (reverse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 "Sort messages of current Rmail summary by subject.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 If prefix argument REVERSE is non-nil, sort them in reverse order."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 (rmail-sort-from-summary (function rmail-sort-by-subject) reverse))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 (defun rmail-summary-sort-by-author (reverse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 "Sort messages of current Rmail summary by author.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 If prefix argument REVERSE is non-nil, sort them in reverse order."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 (rmail-sort-from-summary (function rmail-sort-by-author) reverse))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 (defun rmail-summary-sort-by-recipient (reverse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 "Sort messages of current Rmail summary by recipient.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 If prefix argument REVERSE is non-nil, sort them in reverse order."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 (rmail-sort-from-summary (function rmail-sort-by-recipient) reverse))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 (defun rmail-summary-sort-by-correspondent (reverse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 "Sort messages of current Rmail summary by other correspondent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 If prefix argument REVERSE is non-nil, sort them in reverse order."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (rmail-sort-from-summary (function rmail-sort-by-correspondent) reverse))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 (defun rmail-summary-sort-by-lines (reverse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 "Sort messages of current Rmail summary by lines of the message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 If prefix argument REVERSE is non-nil, sort them in reverse order."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 (rmail-sort-from-summary (function rmail-sort-by-lines) reverse))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 (defun rmail-sort-from-summary (sortfun reverse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 "Sort Rmail messages from Summary buffer and update it after sorting."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 (require 'rmailsort)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 (pop-to-buffer rmail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 (funcall sortfun reverse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 (rmail-summary))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 ;;; rmailsum.el ends here