annotate lisp/rmail/rmailsum.el @ 0:376386a54a3c r19-14

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