annotate lisp/mail/rmailsum.el @ 2331:4d6de8716513

* config.h.in (C_SWITCH_X_SITE, LD_SWITCH_X_SITE): New flags. * ymakefile (C_SWITCH_X_SITE, LD_SWITCH_X_SITE): Provide default values. Include C_SWITCH_X_SITE in CFLAGS, include LD_SWITCH_X_SITE in LIBX, and pass C_SWITCH_X_SITE to the make which builds the X Menu library.
author Jim Blandy <jimb@redhat.com>
date Tue, 23 Mar 1993 05:57:11 +0000
parents fb0ed5a1d0f3
children eb6ae6faff24
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2232
diff changeset
1 ;;; rmailsum.el --- make summary buffers for the mail reader
2232
4f9d60f7de9d Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2164
diff changeset
2
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
3 ;; Copyright (C) 1985, 1993 Free Software Foundation, Inc.
845
213978acbc1e entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
4
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
5 ;; Maintainer: FSF
814
38b2499cb3e9 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
6 ;; Keywords: mail
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
7
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 ;; any later version.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ;; GNU General Public License for more details.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23
2232
4f9d60f7de9d Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2164
diff changeset
24 ;;; Commentary:
4f9d60f7de9d Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2164
diff changeset
25
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
26 ;; Extended by Bob Weiner of Motorola
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
27 ;; Provided all commands from rmail-mode in rmail-summary-mode and made key
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
28 ;; bindings in both modes wholly compatible.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
29
2232
4f9d60f7de9d Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2164
diff changeset
30 ;;; Code:
4f9d60f7de9d Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2164
diff changeset
31
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
32 ;; Entry points for making a summary buffer.
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
34 ;; Regenerate the contents of the summary
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
35 ;; using the same selection criterion as last time.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
36 ;; M-x revert-buffer in a summary buffer calls this function.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
37 (defun rmail-update-summary (&rest ignore)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
38 (apply (car rmail-summary-redo) (cdr rmail-summary-redo)))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 (defun rmail-summary ()
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 "Display a summary of all messages, one line per message."
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 (interactive)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
43 (rmail-new-summary "All" '(rmail-summary) nil))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 (defun rmail-summary-by-labels (labels)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 "Display a summary of all messages with one or more LABELS.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 LABELS should be a string containing the desired labels, separated by commas."
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 (interactive "sLabels to summarize by: ")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 (if (string= labels "")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 (setq labels (or rmail-last-multi-labels
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 (error "No label specified"))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 (setq rmail-last-multi-labels labels)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 (rmail-new-summary (concat "labels " labels)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
54 (list 'rmail-summary-by-labels labels)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 'rmail-message-labels-p
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 (concat ", \\(" (mail-comma-list-regexp labels) "\\),")))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 (defun rmail-summary-by-recipients (recipients &optional primary-only)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 "Display a summary of all messages with the given RECIPIENTS.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 Normally checks the To, From and Cc fields of headers;
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 but if PRIMARY-ONLY is non-nil (prefix arg given),
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 only look in the To and From fields.
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
63 RECIPIENTS is a string of regexps separated by commas."
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 (interactive "sRecipients to summarize by: \nP")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 (rmail-new-summary
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 (concat "recipients " recipients)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
67 (list 'rmail-summary-by-recipients recipients primary-only)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 'rmail-message-recipients-p
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 (mail-comma-list-regexp recipients) primary-only))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 (defun rmail-summary-by-regexp (regexp)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 "Display a summary of all messages according to regexp REGEXP.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 If the regular expression is found in the header of the message
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 \(including in the date and other lines, as well as the subject line),
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 Emacs will list the header line in the RMAIL-summary."
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 (interactive "sRegexp to summarize by: ")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 (if (string= regexp "")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 (setq regexp (or rmail-last-regexp
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
79 (error "No regexp specified."))))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 (setq rmail-last-regexp regexp)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 (rmail-new-summary (concat "regexp " regexp)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
82 (list 'rmail-summary-by-regexp regexp)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 'rmail-message-regexp-p
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 regexp))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
86 ;; rmail-summary-by-topic
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
87 ;; 1989 R.A. Schnitzler
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
88
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
89 (defun rmail-summary-by-topic (subject &optional whole-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
90 "Display a summary of all messages with the given SUBJECT.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
91 Normally checks the Subject field of headers;
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
92 but if WHOLE-MESSAGE is non-nil (prefix arg given),
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
93 look in the whole message.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
94 SUBJECT is a string of regexps separated by commas."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
95 (interactive "sTopics to summarize by: \nP")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
96 (rmail-new-summary
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
97 (concat "about " subject)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
98 (list 'rmail-summary-by-topic subject whole-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
99 'rmail-message-subject-p
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
100 (mail-comma-list-regexp subject) whole-message))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
101
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
102 (defun rmail-message-subject-p (msg subject &optional whole-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
103 (save-restriction
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
104 (goto-char (rmail-msgbeg msg))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
105 (search-forward "\n*** EOOH ***\n")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
106 (narrow-to-region
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
107 (point)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
108 (progn (search-forward (if whole-message "" "\n\n")) (point)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
109 (goto-char (point-min))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
110 (if whole-message (re-search-forward subject nil t)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
111 (string-match subject (or (mail-fetch-field "Subject") "")) )))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
113 ;; General making of a summary buffer.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
114
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
115 (defvar rmail-summary-symbol-number 0)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
116
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
117 (defun rmail-new-summary (description redo-form function &rest args)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 "Create a summary of selected messages.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 DESCRIPTION makes part of the mode line of the summary buffer.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 For each message, FUNCTION is applied to the message number and ARGS...
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 and if the result is non-nil, that message is included.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 nil for FUNCTION means all messages."
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 (message "Computing summary lines...")
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
124 (let (sumbuf mesg was-in-summary)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
125 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
126 ;; Go to the Rmail buffer.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
127 (if (eq major-mode 'rmail-summary-mode)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
128 (progn
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
129 (setq was-in-summary t)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
130 (set-buffer rmail-buffer)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
131 ;; Find its summary buffer, or make one.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
132 (or (and rmail-summary-buffer
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
133 (buffer-name rmail-summary-buffer))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
134 (setq rmail-summary-buffer
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
135 (generate-new-buffer (concat (buffer-name) "-summary"))))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
136 (setq sumbuf rmail-summary-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
137 (setq mesg rmail-current-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
138 (setq foo mesg)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
139 ;; Filter the messages; make or get their summary lines.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
140 (let ((summary-msgs ())
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
141 (new-summary-line-count 0))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
142 (let ((msgnum 1)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
143 (buffer-read-only nil))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
144 (save-restriction
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
145 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
146 (widen)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
147 (goto-char (point-min))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
148 (while (>= rmail-total-messages msgnum)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
149 (if (or (null function)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
150 (apply function (cons msgnum args)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
151 (setq summary-msgs
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
152 (cons (cons msgnum (rmail-make-summary-line msgnum))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
153 summary-msgs)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
154 (setq msgnum (1+ msgnum)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
155 (setq summary-msgs (nreverse summary-msgs)))))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
156 (let ((rbuf (current-buffer))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
157 (total rmail-total-messages))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
158 (set-buffer sumbuf)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
159 ;; Set up the summary buffer's contents.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
160 (let ((buffer-read-only nil))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
161 (erase-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
162 (while summary-msgs
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
163 (princ (cdr (car summary-msgs)) sumbuf)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
164 (setq summary-msgs (cdr summary-msgs)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
165 (goto-char (point-min)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
166 ;; Set up the rest of its state and local variables.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
167 (setq buffer-read-only t)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
168 (rmail-summary-mode)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
169 (make-local-variable 'minor-mode-alist)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
170 (setq minor-mode-alist (list ": " description))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
171 (setq rmail-buffer rbuf
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
172 rmail-summary-redo redo-form
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
173 rmail-total-messages total))))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
174 ;; Now display the summary buffer and go to the right place in it.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
175 (or was-in-summary
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
176 (pop-to-buffer sumbuf))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
177 (rmail-summary-goto-msg mesg t t)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
178 (message "Computing summary lines...done")))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
179
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
180 ;; Low levels of generating a summary.
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 (defun rmail-make-summary-line (msg)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 (let ((line (or (aref rmail-summary-vector (1- msg))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184 (progn
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 (setq new-summary-line-count
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 (1+ new-summary-line-count))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187 (if (zerop (% new-summary-line-count 10))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188 (message "Computing summary lines...%d"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 new-summary-line-count))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 (rmail-make-summary-line-1 msg)))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 ;; Fix up the part of the summary that says "deleted" or "unseen".
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192 (aset line 4
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193 (if (rmail-message-deleted-p msg) ?\D
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194 (if (= ?0 (char-after (+ 3 (rmail-msgbeg msg))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195 ?\- ?\ )))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 line))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 (defun rmail-make-summary-line-1 (msg)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199 (goto-char (rmail-msgbeg msg))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 (let* ((lim (save-excursion (forward-line 2) (point)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201 pos
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202 (labels
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
203 (progn
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204 (forward-char 3)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205 (concat
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 ; (if (save-excursion (re-search-forward ",answered," lim t))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 ; "*" "")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 ; (if (save-excursion (re-search-forward ",filed," lim t))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209 ; "!" "")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210 (if (progn (search-forward ",,") (eolp))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211 ""
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 (concat "{"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213 (buffer-substring (point)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 (progn (end-of-line) (point)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215 "} ")))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 (line
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 (progn
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 (forward-line 1)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219 (if (looking-at "Summary-line: ")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220 (progn
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221 (goto-char (match-end 0))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222 (setq line
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223 (buffer-substring (point)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224 (progn (forward-line 1) (point)))))))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225 ;; Obsolete status lines lacking a # should be flushed.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
226 (and line
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227 (not (string-match "#" line))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
228 (progn
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229 (delete-region (point)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230 (progn (forward-line -1) (point)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231 (setq line nil)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 ;; If we didn't get a valid status line from the message,
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 ;; make a new one and put it in the message.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234 (or line
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235 (let* ((case-fold-search t)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236 (next (rmail-msgend msg))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 (beg (if (progn (goto-char (rmail-msgbeg msg))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238 (search-forward "\n*** EOOH ***\n" next t))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 (point)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 (forward-line 1)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 (point)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 (end (progn (search-forward "\n\n" nil t) (point))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243 (save-restriction
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244 (narrow-to-region beg end)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 (goto-char beg)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 (setq line (rmail-make-basic-summary-line)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 (goto-char (rmail-msgbeg msg))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
248 (forward-line 2)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 (insert "Summary-line: " line)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 (setq pos (string-match "#" line))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251 (aset rmail-summary-vector (1- msg)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252 (concat (format "%4d " msg)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 (substring line 0 pos)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 labels
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255 (substring line (1+ pos))))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 (defun rmail-make-basic-summary-line ()
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258 (goto-char (point-min))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
259 (concat (save-excursion
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260 (if (not (re-search-forward "^Date:" nil t))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261 " "
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
262 (cond ((re-search-forward "\\([^0-9:]\\)\\([0-3]?[0-9]\\)\\([- \t_]+\\)\\([adfjmnos][aceopu][bcglnprtvy]\\)"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263 (save-excursion (end-of-line) (point)) t)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264 (format "%2d-%3s"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 (string-to-int (buffer-substring
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 (match-beginning 2)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267 (match-end 2)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 (buffer-substring
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
269 (match-beginning 4) (match-end 4))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
270 ((re-search-forward "\\([^a-z]\\)\\([adfjmnos][acepou][bcglnprtvy]\\)\\([-a-z \t_]*\\)\\([0-9][0-9]?\\)"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 (save-excursion (end-of-line) (point)) t)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
272 (format "%2d-%3s"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273 (string-to-int (buffer-substring
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
274 (match-beginning 4)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
275 (match-end 4)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276 (buffer-substring
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277 (match-beginning 2) (match-end 2))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278 (t "??????"))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
279 " "
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280 (save-excursion
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281 (if (not (re-search-forward "^From:[ \t]*" nil t))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
282 " "
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
283 (let* ((from (mail-strip-quoted-names
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284 (buffer-substring
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285 (1- (point))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 (progn (end-of-line)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 (skip-chars-backward " \t")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288 (point)))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 len mch lo)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290 (if (string-match (concat "^"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291 (regexp-quote (user-login-name))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292 "\\($\\|@\\)")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
293 from)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294 (save-excursion
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 (goto-char (point-min))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296 (if (not (re-search-forward "^To:[ \t]*" nil t))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 nil
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
298 (setq from
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299 (concat "to: "
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
300 (mail-strip-quoted-names
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301 (buffer-substring
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 (point)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303 (progn (end-of-line)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
304 (skip-chars-backward " \t")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305 (point)))))))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 (setq len (length from))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307 (setq mch (string-match "[@%]" from))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 (format "%25s"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
309 (if (or (not mch) (<= len 25))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310 (substring from (max 0 (- len 25)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 (substring from
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 (setq lo (cond ((< (- mch 9) 0) 0)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
313 ((< len (+ mch 16))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314 (- len 25))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315 (t (- mch 9))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
316 (min len (+ lo 25))))))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317 " #"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
318 (if (re-search-forward "^Subject:" nil t)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319 (progn (skip-chars-forward " \t")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 (buffer-substring (point)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
321 (progn (end-of-line)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
322 (point))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
323 (re-search-forward "[\n][\n]+" nil t)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
324 (buffer-substring (point) (progn (end-of-line) (point))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325 "\n"))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
326
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
327 ;; Simple motion in a summary buffer.
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329 (defun rmail-summary-next-all (&optional number)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330 (interactive "p")
2164
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
331 (forward-line (if number number 1))
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
332 (display-buffer rmail-buffer))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334 (defun rmail-summary-previous-all (&optional number)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
335 (interactive "p")
2164
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
336 (forward-line (- (if number number 1)))
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
337 (display-buffer rmail-buffer))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
338
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339 (defun rmail-summary-next-msg (&optional number)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
340 "Display next non-deleted msg from rmail file.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
341 With optional prefix argument NUMBER, moves forward this number of non-deleted
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
342 messages, or backward if NUMBER is negative."
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
343 (interactive "p")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
344 (forward-line 0)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
345 (and (> number 0) (forward-line 1))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
346 (let ((count (if (< number 0) (- number) number))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
347 (search (if (> number 0) 're-search-forward 're-search-backward))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
348 (non-del-msg-found nil))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
349 (while (and (> count 0) (setq non-del-msg-found
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
350 (or (funcall search "^.....[^D]" nil t)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
351 non-del-msg-found)))
2164
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
352 (setq count (1- count))))
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
353 (display-buffer rmail-buffer))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
355 (defun rmail-summary-previous-msg (&optional number)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
356 (interactive "p")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
357 (rmail-summary-next-msg (- (if number number 1))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
359 (defun rmail-summary-next-labeled-message (n labels)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
360 "Show next message with LABEL. Defaults to last labels used.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
361 With prefix argument N moves forward N messages with these labels."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
362 (interactive "p\nsMove to next msg with labels: ")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
363 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
364 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
365 (rmail-next-labeled-message n labels)))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
367 (defun rmail-summary-previous-labeled-message (n labels)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
368 "Show previous message with LABEL. Defaults to last labels used.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
369 With prefix argument N moves backward N messages with these labels."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
370 (interactive "p\nsMove to previous msg with labels: ")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
371 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
372 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
373 (rmail-previous-labeled-message n labels)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
374
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
375 ;; Delete and undelete summary commands.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
376
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
377 (defun rmail-summary-delete-forward (&optional backward)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
378 "Delete this message and move to next nondeleted one.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
379 Deleted messages stay in the file until the \\[rmail-expunge] command is given.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
380 With prefix argument, delete and move backward."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
381 (interactive "P")
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
382 (let (end)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
383 (rmail-summary-goto-msg)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
384 (pop-to-buffer rmail-buffer)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
385 (rmail-delete-forward backward)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
386 (pop-to-buffer rmail-summary-buffer)))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
387
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
388 (defun rmail-summary-delete-backward ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
389 "Delete this message and move to previous nondeleted one.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
390 Deleted messages stay in the file until the \\[rmail-expunge] command is given."
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
391 (interactive)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
392 (rmail-summary-delete-forward t))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
393
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
394 (defun rmail-summary-mark-deleted (&optional n undel)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
395 (and n (rmail-summary-goto-msg n nil t))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
396 (let ((buffer-read-only nil))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
397 (skip-chars-forward " ")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
398 (skip-chars-forward "[0-9]")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
399 (if undel
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
400 (if (looking-at "D")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
401 (progn (delete-char 1) (insert " ")))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
402 (delete-char 1)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
403 (insert "D")))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
404 (beginning-of-line))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
405
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
406 (defun rmail-summary-mark-undeleted (n)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
407 (rmail-summary-mark-deleted n t))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
408
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
409 (defun rmail-summary-deleted-p (&optional n)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
410 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
411 (and n (rmail-summary-goto-msg n nil t))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
412 (skip-chars-forward " ")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
413 (skip-chars-forward "[0-9]")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
414 (looking-at "D")))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
415
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
416 (defun rmail-summary-undelete (&optional arg)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
417 "Undelete current message.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
418 Optional prefix ARG means undelete ARG previous messages."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
419 (interactive "p")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
420 (if (/= arg 1)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
421 (rmail-summary-undelete-many arg)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
422 (let ((buffer-read-only nil))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
423 (end-of-line)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
424 (cond ((re-search-backward "\\(^ *[0-9]*\\)\\(D\\)" nil t)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
425 (replace-match "\\1 ")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
426 (rmail-summary-goto-msg)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
427 (pop-to-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
428 (and (rmail-message-deleted-p rmail-current-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
429 (rmail-undelete-previous-message))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
430 (pop-to-buffer rmail-summary-buffer))))))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
431
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
432 (defun rmail-summary-undelete-many (&optional n)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
433 "Undelete all deleted msgs, optional prefix arg N means undelete N prev msgs."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
434 (interactive "P")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
435 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
436 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
437 (let* ((init-msg (if n rmail-current-message rmail-total-messages))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
438 (rmail-current-message init-msg)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
439 (n (or n rmail-total-messages))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
440 (msgs-undeled 0))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
441 (while (and (> rmail-current-message 0)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
442 (< msgs-undeled n))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
443 (if (rmail-message-deleted-p rmail-current-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
444 (progn (rmail-set-attribute "deleted" nil)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
445 (setq msgs-undeled (1+ msgs-undeled))))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
446 (setq rmail-current-message (1- rmail-current-message)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
447 (set-buffer rmail-summary-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
448 (setq rmail-current-message init-msg msgs-undeled 0)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
449 (while (and (> rmail-current-message 0)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
450 (< msgs-undeled n))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
451 (if (rmail-summary-deleted-p rmail-current-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
452 (progn (rmail-summary-mark-undeleted rmail-current-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
453 (setq msgs-undeled (1+ msgs-undeled))))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
454 (setq rmail-current-message (1- rmail-current-message))))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
455 (rmail-summary-goto-msg)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
456
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
457 ;; Rmail Summary mode is suitable only for specially formatted data.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
458 (put 'rmail-summary-mode 'mode-class 'special)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
459
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
460 (defun rmail-summary-mode ()
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
461 "Rmail Summary Mode is invoked from Rmail Mode by using \\<rmail-mode-map>\\[rmail-summary].
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
462 As commands are issued in the summary buffer, they are applied to the
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
463 corresponding mail messages in the rmail buffer.
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
464
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
465 All normal editing commands are turned off.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
466 Instead, all of the Rmail Mode commands are available, plus:
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
467
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
468 \\[rmail-summary-undelete-many] Undelete all or prefix arg deleted messages."
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
469 (interactive)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
470 (kill-all-local-variables)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
471 (setq major-mode 'rmail-summary-mode)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
472 (setq mode-name "RMAIL Summary")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
473 (use-local-map rmail-summary-mode-map)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
474 (setq truncate-lines t)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
475 (setq buffer-read-only t)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
476 (set-syntax-table text-mode-syntax-table)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
477 (make-local-variable 'rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
478 (make-local-variable 'rmail-total-messages)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
479 (make-local-variable 'rmail-current-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
480 (setq rmail-current-message nil)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
481 (make-local-variable 'rmail-summary-redo)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
482 (setq rmail-summary-redo nil)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
483 (make-local-variable 'revert-buffer-function)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
484 (setq revert-buffer-function 'rmail-update-summary)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
485 (make-local-variable 'post-command-hook)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
486 (add-hook 'post-command-hook 'rmail-summary-rmail-update)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
487 (run-hooks 'rmail-summary-mode-hook))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
488
2164
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
489 ;; Show in Rmail the message described by the summary line that point is on,
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
490 ;; but only if the Rmail buffer is already visible.
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
491 ;; This is a post-command-hook in summary buffers.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
492 (defun rmail-summary-rmail-update ()
2164
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
493 (if (get-buffer-window rmail-buffer)
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
494 (let (buffer-read-only)
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
495 (save-excursion
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
496 (beginning-of-line)
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
497 (skip-chars-forward " ")
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
498 (let ((beg (point))
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
499 msg-num
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
500 (buf rmail-buffer))
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
501 (skip-chars-forward "0-9")
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
502 (setq msg-num (string-to-int (buffer-substring beg (point))))
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
503 (or (eq rmail-current-message msg-num)
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
504 (progn
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
505 (setq rmail-current-message msg-num)
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
506 (if (= (following-char) ?-)
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
507 (progn
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
508 (delete-char 1)
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
509 (insert " ")))
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
510 (setq window (display-buffer rmail-buffer))
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
511 (save-window-excursion
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
512 (select-window window)
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
513 (rmail-show-message msg-num)))))))))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
514
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
515 (defvar rmail-summary-mode-map nil)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
516
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
517 (if rmail-summary-mode-map
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
518 nil
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
519 (setq rmail-summary-mode-map (make-keymap))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
520 (suppress-keymap rmail-summary-mode-map)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
521 (define-key rmail-summary-mode-map "a" 'rmail-summary-add-label)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
522 (define-key rmail-summary-mode-map "c" 'rmail-summary-continue)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
523 (define-key rmail-summary-mode-map "d" 'rmail-summary-delete-forward)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
524 (define-key rmail-summary-mode-map "\C-d" 'rmail-summary-delete-backward)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
525 (define-key rmail-summary-mode-map "e" 'rmail-summary-edit-current-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
526 (define-key rmail-summary-mode-map "f" 'rmail-summary-forward)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
527 (define-key rmail-summary-mode-map "g" 'rmail-summary-get-new-mail)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
528 (define-key rmail-summary-mode-map "h" 'rmail-summary)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
529 (define-key rmail-summary-mode-map "i" 'rmail-summary-input)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
530 (define-key rmail-summary-mode-map "j" 'rmail-summary-goto-msg)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
531 (define-key rmail-summary-mode-map "k" 'rmail-summary-kill-label)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
532 (define-key rmail-summary-mode-map "l" 'rmail-summary-by-labels)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
533 (define-key rmail-summary-mode-map "\e\C-h" 'rmail-summary)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
534 (define-key rmail-summary-mode-map "\e\C-l" 'rmail-summary-by-labels)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
535 (define-key rmail-summary-mode-map "\e\C-r" 'rmail-summary-by-recipients)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
536 (define-key rmail-summary-mode-map "\e\C-s" 'rmail-summary-by-regexp)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
537 (define-key rmail-summary-mode-map "\e\C-t" 'rmail-summary-by-topic)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
538 (define-key rmail-summary-mode-map "m" 'rmail-summary-mail)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
539 (define-key rmail-summary-mode-map "\M-m" 'rmail-summary-retry-failure)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
540 (define-key rmail-summary-mode-map "n" 'rmail-summary-next-msg)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
541 (define-key rmail-summary-mode-map "\en" 'rmail-summary-next-all)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
542 (define-key rmail-summary-mode-map "\e\C-n" 'rmail-summary-next-labeled-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
543 (define-key rmail-summary-mode-map "o" 'rmail-summary-output-to-rmail-file)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
544 (define-key rmail-summary-mode-map "\C-o" 'rmail-summary-output)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
545 (define-key rmail-summary-mode-map "p" 'rmail-summary-previous-msg)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
546 (define-key rmail-summary-mode-map "\ep" 'rmail-summary-previous-all)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
547 (define-key rmail-summary-mode-map "\e\C-p" 'rmail-summary-previous-labeled-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
548 (define-key rmail-summary-mode-map "q" 'rmail-summary-quit)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
549 (define-key rmail-summary-mode-map "r" 'rmail-summary-reply)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
550 (define-key rmail-summary-mode-map "s" 'rmail-summary-expunge-and-save)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
551 (define-key rmail-summary-mode-map "\es" 'rmail-summary-search)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
552 (define-key rmail-summary-mode-map "t" 'rmail-summary-toggle-header)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
553 (define-key rmail-summary-mode-map "u" 'rmail-summary-undelete)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
554 (define-key rmail-summary-mode-map "\M-u" 'rmail-summary-undelete-many)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
555 (define-key rmail-summary-mode-map "w" 'rmail-summary-wipe)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
556 (define-key rmail-summary-mode-map "x" 'rmail-summary-expunge)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
557 (define-key rmail-summary-mode-map "." 'rmail-summary-beginning-of-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
558 (define-key rmail-summary-mode-map "<" 'rmail-summary-first-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
559 (define-key rmail-summary-mode-map ">" 'rmail-summary-last-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
560 (define-key rmail-summary-mode-map " " 'rmail-summary-scroll-msg-up)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
561 (define-key rmail-summary-mode-map "\177" 'rmail-summary-scroll-msg-down)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
562 (define-key rmail-summary-mode-map "?" 'describe-mode)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
563 )
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
564
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
565 (defun rmail-summary-goto-msg (&optional n nowarn skip-rmail)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
566 (interactive "P")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
567 (if (consp n) (setq n (prefix-numeric-value n)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
568 (if (eobp) (forward-line -1))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
569 (beginning-of-line)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
570 (let ((buf rmail-buffer)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
571 (cur (point))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
572 (curmsg (string-to-int
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
573 (buffer-substring (point)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
574 (min (point-max) (+ 5 (point)))))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
575 (if (not n)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
576 (setq n curmsg)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
577 (if (< n 1)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
578 (progn (message "No preceding message")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
579 (setq n 1)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
580 (if (> n rmail-total-messages)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
581 (progn (message "No following message")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
582 (goto-char (point-max))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
583 (rmail-summary-goto-msg)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
584 (goto-char (point-min))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
585 (if (not (re-search-forward (concat "^ *" (int-to-string n)) nil t))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
586 (progn (or nowarn (message "Message %d not found" n))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
587 (setq n curmsg)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
588 (goto-char cur))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
589 (beginning-of-line)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
590 (skip-chars-forward " ")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
591 (skip-chars-forward "0-9")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
592 (save-excursion (if (= (following-char) ?-)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
593 (let ((buffer-read-only nil))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
594 (delete-char 1)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
595 (insert " "))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
596 (beginning-of-line)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
597 (if skip-rmail
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
598 nil
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
599 (pop-to-buffer buf)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
600 (rmail-show-message n)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
601 (pop-to-buffer rmail-summary-buffer))))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
602
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
603 (defun rmail-summary-scroll-msg-up (&optional dist)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
604 "Scroll other window forward."
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
605 (interactive "P")
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
606 (scroll-other-window dist))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
607
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
608 (defun rmail-summary-scroll-msg-down (&optional dist)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
609 "Scroll other window backward."
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
610 (interactive "P")
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
611 (scroll-other-window
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
612 (cond ((eq dist '-) nil)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
613 ((null dist) '-)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
614 (t (- (prefix-numeric-value dist))))))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
615
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
616 (defun rmail-summary-beginning-of-message ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
617 "Show current message from the beginning."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
618 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
619 (pop-to-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
620 (beginning-of-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
621 (pop-to-buffer rmail-summary-buffer))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
622
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
623 (defun rmail-summary-quit ()
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
624 "Quit out of Rmail and Rmail summary."
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
625 (interactive)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
626 (rmail-summary-wipe)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
627 (rmail-quit))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
628
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
629 (defun rmail-summary-wipe ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
630 "Kill and wipe away Rmail summary, remaining within Rmail."
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
631 (interactive)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
632 (save-excursion (set-buffer rmail-buffer) (setq rmail-summary-buffer nil))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
633 (let ((rmail-wind (get-buffer-window rmail-buffer)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
634 (kill-buffer (current-buffer))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
635 ;; Delete window if not only one.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
636 (if (not (eq (selected-window) (next-window nil 'no-minibuf)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
637 (delete-window))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
638 ;; Switch to the rmail buffer in this window.
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
639 ;; Select the window with rmail in it, then delete this window.
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
640 (and rmail-wind (select-window rmail-wind))))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
641
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
642 (defun rmail-summary-expunge ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
643 "Actually erase all deleted messages and recompute summary headers."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
644 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
645 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
646 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
647 (rmail-only-expunge))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
648 (rmail-update-summary))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
649
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
650 (defun rmail-summary-expunge-and-save ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
651 "Expunge and save RMAIL file."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
652 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
653 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
654 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
655 (rmail-only-expunge)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
656 (save-buffer))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
657 (rmail-update-summary))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
658
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
659 (defun rmail-summary-get-new-mail ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
660 "Get new mail and recompute summary headers."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
661 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
662 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
663 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
664 (rmail-get-new-mail))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
665 (rmail-update-summary))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
666
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
667 (defun rmail-summary-input (filename)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
668 "Run Rmail on file FILENAME."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
669 (interactive "FRun rmail on RMAIL file: ")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
670 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
671 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
672 (rmail filename)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
673
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
674 (defun rmail-summary-first-message ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
675 "Show first message in Rmail file from summary buffer."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
676 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
677 (beginning-of-buffer))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
678
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
679 (defun rmail-summary-last-message ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
680 "Show last message in Rmail file from summary buffer."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
681 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
682 (end-of-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
683 (forward-line -1))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
684
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
685 (defvar rmail-summary-edit-map nil)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
686 (if rmail-summary-edit-map
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
687 nil
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
688 (setq rmail-summary-edit-map
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
689 (nconc (make-sparse-keymap) (cdr text-mode-map)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
690 (define-key rmail-summary-edit-map "\C-c\C-c" 'rmail-cease-edit)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
691 (define-key rmail-summary-edit-map "\C-c\C-]" 'rmail-abort-edit))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
692
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
693 (defun rmail-summary-edit-current-message ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
694 "Edit the contents of this message."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
695 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
696 (pop-to-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
697 (rmail-edit-current-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
698 (use-local-map rmail-summary-edit-map))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
699
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
700 (defun rmail-summary-cease-edit ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
701 "Finish editing message, then go back to Rmail summary buffer."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
702 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
703 (rmail-cease-edit)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
704 (pop-to-buffer rmail-summary-buffer))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
705
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
706 (defun rmail-summary-abort-edit ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
707 "Abort edit of current message; restore original contents.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
708 Go back to summary buffer."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
709 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
710 (rmail-abort-edit)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
711 (pop-to-buffer rmail-summary-buffer))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
712
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
713 (defun rmail-summary-search (regexp &optional n)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
714 "Show message containing next match for REGEXP.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
715 Prefix argument gives repeat count; negative argument means search
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
716 backwards (through earlier messages).
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
717 Interactively, empty argument means use same regexp used last time."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
718 (interactive
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
719 (let* ((reversep (< (prefix-numeric-value current-prefix-arg) 0))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
720 (prompt
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
721 (concat (if reversep "Reverse " "") "Rmail search (regexp): "))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
722 regexp)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
723 (if rmail-search-last-regexp
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
724 (setq prompt (concat prompt
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
725 "(default "
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
726 rmail-search-last-regexp
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
727 ") ")))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
728 (setq regexp (read-string prompt))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
729 (cond ((not (equal regexp ""))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
730 (setq rmail-search-last-regexp regexp))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
731 ((not rmail-search-last-regexp)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
732 (error "No previous Rmail search string")))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
733 (list rmail-search-last-regexp
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
734 (prefix-numeric-value current-prefix-arg))))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
735 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
736 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
737 (rmail-search regexp n)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
738
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
739 (defun rmail-summary-toggle-header ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
740 "Show original message header if pruned header currently shown, or vice versa."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
741 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
742 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
743 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
744 (rmail-toggle-header)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
745
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
746 (defun rmail-summary-add-label (label)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
747 "Add LABEL to labels associated with current Rmail message.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
748 Completion is performed over known labels when reading."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
749 (interactive (list (rmail-read-label "Add label")))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
750 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
751 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
752 (rmail-add-label label)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
753
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
754 (defun rmail-summary-kill-label (label)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
755 "Remove LABEL from labels associated with current Rmail message.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
756 Completion is performed over known labels when reading."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
757 (interactive (list (rmail-read-label "Add label")))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
758 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
759 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
760 (rmail-set-label label nil)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
761
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
762 ;;;; *** Rmail Summary Mailing Commands ***
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
763
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
764 (defun rmail-summary-mail ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
765 "Send mail in another window.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
766 While composing the message, use \\[mail-yank-original] to yank the
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
767 original message into it."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
768 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
769 (mail-other-window nil nil nil nil nil rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
770 (use-local-map (copy-keymap (current-local-map)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
771 (define-key (current-local-map)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
772 "\C-c\C-c" 'rmail-summary-send-and-exit))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
773
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
774 (defun rmail-summary-continue ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
775 "Continue composing outgoing message previously being composed."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
776 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
777 (mail-other-window t))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
778
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
779 (defun rmail-summary-reply (just-sender)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
780 "Reply to the current message.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
781 Normally include CC: to all other recipients of original message;
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
782 prefix argument means ignore them.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
783 While composing the reply, use \\[mail-yank-original] to yank the
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
784 original message into it."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
785 (interactive "P")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
786 (let (mailbuf)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
787 (save-window-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
788 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
789 (rmail-reply just-sender)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
790 (setq mailbuf (current-buffer)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
791 (pop-to-buffer mailbuf)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
792 (use-local-map (copy-keymap (current-local-map)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
793 (define-key (current-local-map)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
794 "\C-c\C-c" 'rmail-summary-send-and-exit)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
795
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
796 (defun rmail-summary-retry-failure ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
797 "Edit a mail message which is based on the contents of the current message.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
798 For a message rejected by the mail system, extract the interesting headers and
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
799 the body of the original message; otherwise copy the current message."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
800 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
801 (let (mailbuf)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
802 (save-window-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
803 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
804 (rmail-retry-failure)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
805 (setq mailbuf (current-buffer)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
806 (pop-to-buffer mailbuf)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
807 (use-local-map (copy-keymap (current-local-map)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
808 (define-key (current-local-map)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
809 "\C-c\C-c" 'rmail-summary-send-and-exit)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
810
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
811 (defun rmail-summary-send-and-exit ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
812 "Send mail reply and return to summary buffer."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
813 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
814 (mail-send-and-exit t))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
815
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
816 (defun rmail-summary-forward ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
817 "Forward the current message to another user."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
818 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
819 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
820 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
821 (rmail-forward)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
822 (use-local-map (copy-keymap (current-local-map)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
823 (define-key (current-local-map)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
824 "\C-c\C-c" 'rmail-summary-send-and-exit)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
825
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
826 ;; Summary output commands.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
827
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
828 (defun rmail-summary-output-to-rmail-file ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
829 "Append the current message to an Rmail file named FILE-NAME.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
830 If the file does not exist, ask if it should be created.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
831 If file is being visited, the message is appended to the Emacs
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
832 buffer visiting that file."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
833 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
834 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
835 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
836 (call-interactively 'rmail-output-to-rmail-file)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
837
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
838 (defun rmail-summary-output ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
839 "Append this message to Unix mail file named FILE-NAME."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
840 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
841 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
842 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
843 (call-interactively 'rmail-output)))
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 130
diff changeset
844
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 130
diff changeset
845 ;;; rmailsum.el ends here