annotate lisp/rmail/rmailsum.el @ 72:b9518feda344 r20-0b31

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