annotate lisp/mail/rmailsum.el @ 13740:7868bb1ee05f libc-951216 libc-951217 libc-951218 libc-951219 libc-951220 libc-951221 libc-951222 libc-951223 libc-951224 libc-951225 libc-951226 libc-951227 libc-951228 libc-951229 libc-951230 libc-951231 libc-960101 libc-960102 libc-960103 libc-960104 libc-960105 libc-960106 libc-960107 libc-960108 libc-960109 libc-960110 libc-960111 libc-960112 libc-960113 libc-960114 libc-960115

(AViiON): Add ix86-dg-dgux
author Stan Cox <scox@redhat.com>
date Sat, 16 Dec 1995 03:32:35 +0000
parents 197f7ae5493d
children db6a50dd1257
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
10663
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
3 ;; Copyright (C) 1985, 1993, 1994, 1995 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
12911
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
32 ;; For rmail-select-summary
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
33 (require 'rmail)
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
34
9379
138d99e53e94 (rmail-summary-font-lock-keywords): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 9352
diff changeset
35 (defvar rmail-summary-font-lock-keywords
11519
aecbeb4d287a rmail-summary-font-lock-keywords efficiency fix.
Simon Marshall <simon@gnu.org>
parents: 11175
diff changeset
36 '(("^....D.*" . font-lock-string-face) ; Deleted.
aecbeb4d287a rmail-summary-font-lock-keywords efficiency fix.
Simon Marshall <simon@gnu.org>
parents: 11175
diff changeset
37 ("^....-.*" . font-lock-type-face) ; Unread.
9379
138d99e53e94 (rmail-summary-font-lock-keywords): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 9352
diff changeset
38 ;; Neither of the below will be highlighted if either of the above are:
138d99e53e94 (rmail-summary-font-lock-keywords): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 9352
diff changeset
39 ("^....[^D-] \\(......\\)" 1 font-lock-keyword-face) ; Date.
138d99e53e94 (rmail-summary-font-lock-keywords): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 9352
diff changeset
40 ("{ \\([^}]+\\),}" 1 font-lock-comment-face)) ; Labels.
138d99e53e94 (rmail-summary-font-lock-keywords): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 9352
diff changeset
41 "Additional expressions to highlight in Rmail Summary mode.")
138d99e53e94 (rmail-summary-font-lock-keywords): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 9352
diff changeset
42
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
43 ;; Entry points for making a summary buffer.
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
45 ;; Regenerate the contents of the summary
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
46 ;; using the same selection criterion as last time.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
47 ;; 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
48 (defun rmail-update-summary (&rest ignore)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
49 (apply (car rmail-summary-redo) (cdr rmail-summary-redo)))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 (defun rmail-summary ()
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 "Display a summary of all messages, one line per message."
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 (interactive)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
54 (rmail-new-summary "All" '(rmail-summary) nil))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 (defun rmail-summary-by-labels (labels)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 "Display a summary of all messages with one or more LABELS.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 LABELS should be a string containing the desired labels, separated by commas."
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 (interactive "sLabels to summarize by: ")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 (if (string= labels "")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 (setq labels (or rmail-last-multi-labels
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 (error "No label specified"))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 (setq rmail-last-multi-labels labels)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 (rmail-new-summary (concat "labels " labels)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
65 (list 'rmail-summary-by-labels labels)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 'rmail-message-labels-p
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 (concat ", \\(" (mail-comma-list-regexp labels) "\\),")))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 (defun rmail-summary-by-recipients (recipients &optional primary-only)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 "Display a summary of all messages with the given RECIPIENTS.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 Normally checks the To, From and Cc fields of headers;
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 but if PRIMARY-ONLY is non-nil (prefix arg given),
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 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
74 RECIPIENTS is a string of regexps separated by commas."
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 (interactive "sRecipients to summarize by: \nP")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 (rmail-new-summary
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 (concat "recipients " recipients)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
78 (list 'rmail-summary-by-recipients recipients primary-only)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 'rmail-message-recipients-p
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 (mail-comma-list-regexp recipients) primary-only))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 (defun rmail-summary-by-regexp (regexp)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 "Display a summary of all messages according to regexp REGEXP.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 If the regular expression is found in the header of the message
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 \(including in the date and other lines, as well as the subject line),
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 Emacs will list the header line in the RMAIL-summary."
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 (interactive "sRegexp to summarize by: ")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 (if (string= regexp "")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 (setq regexp (or rmail-last-regexp
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
90 (error "No regexp specified."))))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 (setq rmail-last-regexp regexp)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 (rmail-new-summary (concat "regexp " regexp)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
93 (list 'rmail-summary-by-regexp regexp)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 'rmail-message-regexp-p
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 regexp))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
97 ;; rmail-summary-by-topic
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
98 ;; 1989 R.A. Schnitzler
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
99
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
100 (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
101 "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
102 Normally checks the Subject field of headers;
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
103 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
104 look in the whole message.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
105 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
106 (interactive "sTopics to summarize by: \nP")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
107 (rmail-new-summary
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
108 (concat "about " subject)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
109 (list 'rmail-summary-by-topic subject whole-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
110 'rmail-message-subject-p
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
111 (mail-comma-list-regexp subject) whole-message))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
112
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
113 (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
114 (save-restriction
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
115 (goto-char (rmail-msgbeg msg))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
116 (search-forward "\n*** EOOH ***\n")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
117 (narrow-to-region
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
118 (point)
3349
31390246a7a2 (rmail-message-subject-p): Fix typo in string constant.
Richard M. Stallman <rms@gnu.org>
parents: 3198
diff changeset
119 (progn (search-forward (if whole-message "\^_" "\n\n")) (point)))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
120 (goto-char (point-min))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
121 (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
122 (string-match subject (or (mail-fetch-field "Subject") "")) )))
3443
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
123
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
124 (defun rmail-summary-by-senders (senders)
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
125 "Display a summary of all messages with the given SENDERS.
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
126 SENDERS is a string of names separated by commas."
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
127 (interactive "sSenders to summarize by: ")
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
128 (rmail-new-summary
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
129 (concat "senders " senders)
5507
0a6c0e720ece (rmail-summary-by-senders):
Richard M. Stallman <rms@gnu.org>
parents: 5370
diff changeset
130 (list 'rmail-summary-by-senders senders)
3443
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
131 'rmail-message-senders-p
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
132 (mail-comma-list-regexp senders)))
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
133
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
134 (defun rmail-message-senders-p (msg senders)
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
135 (save-restriction
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
136 (goto-char (rmail-msgbeg msg))
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
137 (search-forward "\n*** EOOH ***\n")
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
138 (narrow-to-region (point) (progn (search-forward "\n\n") (point)))
7a15b35366f8 (rmail-summary-by-senders): New function.
Richard M. Stallman <rms@gnu.org>
parents: 3349
diff changeset
139 (string-match senders (or (mail-fetch-field "From") ""))))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
141 ;; General making of a summary buffer.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
142
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
143 (defvar rmail-summary-symbol-number 0)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
144
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
145 (defun rmail-new-summary (description redo-form function &rest args)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 "Create a summary of selected messages.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 DESCRIPTION makes part of the mode line of the summary buffer.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 For each message, FUNCTION is applied to the message number and ARGS...
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 and if the result is non-nil, that message is included.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150 nil for FUNCTION means all messages."
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 (message "Computing summary lines...")
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
152 (let (sumbuf mesg was-in-summary)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
153 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
154 ;; Go to the Rmail buffer.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
155 (if (eq major-mode 'rmail-summary-mode)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
156 (progn
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
157 (setq was-in-summary t)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
158 (set-buffer rmail-buffer)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
159 ;; Find its summary buffer, or make one.
3198
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
160 (setq sumbuf
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
161 (if (and rmail-summary-buffer
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
162 (buffer-name rmail-summary-buffer))
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
163 rmail-summary-buffer
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
164 (generate-new-buffer (concat (buffer-name) "-summary"))))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
165 (setq mesg rmail-current-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
166 ;; 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
167 (let ((summary-msgs ())
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
168 (new-summary-line-count 0))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
169 (let ((msgnum 1)
6762
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
170 (buffer-read-only nil)
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
171 (old-min (point-min-marker))
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
172 (old-max (point-max-marker)))
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
173 ;; Can't use save-restriction here; that doesn't work if we
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
174 ;; plan to modify text outside the original restriction.
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
175 (save-excursion
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
176 (widen)
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
177 (goto-char (point-min))
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
178 (while (>= rmail-total-messages msgnum)
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
179 (if (or (null function)
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
180 (apply function (cons msgnum args)))
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
181 (setq summary-msgs
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
182 (cons (cons msgnum (rmail-make-summary-line msgnum))
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
183 summary-msgs)))
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
184 (setq msgnum (1+ msgnum)))
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
185 (setq summary-msgs (nreverse summary-msgs)))
f77de1e2b48b (rmail-new-summary): Avoid unsafe save-restriction.
Karl Heuer <kwzh@gnu.org>
parents: 6726
diff changeset
186 (narrow-to-region old-min old-max))
3198
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
187 ;; Temporarily, while summary buffer is unfinished,
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
188 ;; we "don't have" a summary.
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
189 (setq rmail-summary-buffer nil)
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
190 (save-excursion
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
191 (let ((rbuf (current-buffer))
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
192 (total rmail-total-messages))
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
193 (set-buffer sumbuf)
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
194 ;; Set up the summary buffer's contents.
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
195 (let ((buffer-read-only nil))
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
196 (erase-buffer)
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
197 (while summary-msgs
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
198 (princ (cdr (car summary-msgs)) sumbuf)
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
199 (setq summary-msgs (cdr summary-msgs)))
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
200 (goto-char (point-min)))
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
201 ;; Set up the rest of its state and local variables.
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
202 (setq buffer-read-only t)
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
203 (rmail-summary-mode)
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
204 (make-local-variable 'minor-mode-alist)
3466
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
205 (setq minor-mode-alist (list '(t (concat ": " description))))
3198
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
206 (setq rmail-buffer rbuf
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
207 rmail-summary-redo redo-form
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
208 rmail-total-messages total))))
18612999f80c (rmail-new-summary): Set rmail-summary-buffer
Richard M. Stallman <rms@gnu.org>
parents: 3100
diff changeset
209 (setq rmail-summary-buffer sumbuf))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
210 ;; 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
211 (or was-in-summary
12911
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
212 (progn
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
213 (if (and (one-window-p)
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
214 pop-up-windows (not pop-up-frames))
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
215 ;; If there is just one window, put the summary on the top.
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
216 (progn
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
217 (split-window (selected-window) rmail-summary-window-size)
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
218 (select-window (next-window (frame-first-window)))
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
219 (pop-to-buffer sumbuf)
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
220 ;; If pop-to-buffer did not use that window, delete that
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
221 ;; window. (This can happen if it uses another frame.)
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
222 (if (not (eq sumbuf (window-buffer (frame-first-window))))
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
223 (delete-other-windows)))
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
224 (pop-to-buffer sumbuf))
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
225 (set-buffer rmail-buffer)
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
226 ;; This is how rmail makes the summary buffer reappear.
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
227 ;; We do this here to make the window the proper size.
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
228 (rmail-select-summary nil)
be0fe2c66b9d Require rmail.
Richard M. Stallman <rms@gnu.org>
parents: 12877
diff changeset
229 (set-buffer rmail-summary-buffer)))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
230 (rmail-summary-goto-msg mesg t t)
12877
e5a2fab50a4b (rmail-new-summary): Enable the Input/output menu.
Richard M. Stallman <rms@gnu.org>
parents: 12033
diff changeset
231 (rmail-summary-construct-io-menu)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
232 (message "Computing summary lines...done")))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
233
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
234 ;; Low levels of generating a summary.
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236 (defun rmail-make-summary-line (msg)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 (let ((line (or (aref rmail-summary-vector (1- msg))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238 (progn
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 (setq new-summary-line-count
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 (1+ new-summary-line-count))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 (if (zerop (% new-summary-line-count 10))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 (message "Computing summary lines...%d"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243 new-summary-line-count))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244 (rmail-make-summary-line-1 msg)))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 ;; Fix up the part of the summary that says "deleted" or "unseen".
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 (aset line 4
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 (if (rmail-message-deleted-p msg) ?\D
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
248 (if (= ?0 (char-after (+ 3 (rmail-msgbeg msg))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 ?\- ?\ )))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 line))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252 (defun rmail-make-summary-line-1 (msg)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 (goto-char (rmail-msgbeg msg))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 (let* ((lim (save-excursion (forward-line 2) (point)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255 pos
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 (labels
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 (progn
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258 (forward-char 3)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
259 (concat
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260 ; (if (save-excursion (re-search-forward ",answered," lim 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 ; (if (save-excursion (re-search-forward ",filed," lim t))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263 ; "!" "")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264 (if (progn (search-forward ",,") (eolp))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 ""
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 (concat "{"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267 (buffer-substring (point)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 (progn (end-of-line) (point)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
269 "} ")))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
270 (line
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 (progn
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
272 (forward-line 1)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273 (if (looking-at "Summary-line: ")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
274 (progn
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
275 (goto-char (match-end 0))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276 (setq line
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277 (buffer-substring (point)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278 (progn (forward-line 1) (point)))))))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
279 ;; Obsolete status lines lacking a # should be flushed.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280 (and line
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281 (not (string-match "#" line))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
282 (progn
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
283 (delete-region (point)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284 (progn (forward-line -1) (point)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285 (setq line nil)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 ;; If we didn't get a valid status line from the message,
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 ;; make a new one and put it in the message.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288 (or line
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 (let* ((case-fold-search t)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290 (next (rmail-msgend msg))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291 (beg (if (progn (goto-char (rmail-msgbeg msg))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292 (search-forward "\n*** EOOH ***\n" next t))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
293 (point)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294 (forward-line 1)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 (point)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296 (end (progn (search-forward "\n\n" nil t) (point))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 (save-restriction
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
298 (narrow-to-region beg end)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299 (goto-char beg)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
300 (setq line (rmail-make-basic-summary-line)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301 (goto-char (rmail-msgbeg msg))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 (forward-line 2)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303 (insert "Summary-line: " line)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
304 (setq pos (string-match "#" line))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305 (aset rmail-summary-vector (1- msg)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 (concat (format "%4d " msg)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307 (substring line 0 pos)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 labels
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
309 (substring line (1+ pos))))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 (defun rmail-make-basic-summary-line ()
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 (goto-char (point-min))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
313 (concat (save-excursion
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314 (if (not (re-search-forward "^Date:" nil t))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315 " "
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
316 (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
317 (save-excursion (end-of-line) (point)) t)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
318 (format "%2d-%3s"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319 (string-to-int (buffer-substring
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 (match-beginning 2)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
321 (match-end 2)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
322 (buffer-substring
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
323 (match-beginning 4) (match-end 4))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
324 ((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
325 (save-excursion (end-of-line) (point)) t)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
326 (format "%2d-%3s"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
327 (string-to-int (buffer-substring
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 (match-beginning 4)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329 (match-end 4)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330 (buffer-substring
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331 (match-beginning 2) (match-end 2))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332 (t "??????"))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 " "
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334 (save-excursion
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
335 (if (not (re-search-forward "^From:[ \t]*" nil t))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
336 " "
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
337 (let* ((from (mail-strip-quoted-names
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
338 (buffer-substring
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339 (1- (point))
7421
6f9af07c5783 (rmail-make-basic-summary-line): Get all the lines of the From field.
Richard M. Stallman <rms@gnu.org>
parents: 7368
diff changeset
340 ;; Get all the lines of the From field
6f9af07c5783 (rmail-make-basic-summary-line): Get all the lines of the From field.
Richard M. Stallman <rms@gnu.org>
parents: 7368
diff changeset
341 ;; so that we get a whole comment if there is one,
6f9af07c5783 (rmail-make-basic-summary-line): Get all the lines of the From field.
Richard M. Stallman <rms@gnu.org>
parents: 7368
diff changeset
342 ;; so that mail-strip-quoted-names can discard it.
6f9af07c5783 (rmail-make-basic-summary-line): Get all the lines of the From field.
Richard M. Stallman <rms@gnu.org>
parents: 7368
diff changeset
343 (let ((opoint (point)))
6f9af07c5783 (rmail-make-basic-summary-line): Get all the lines of the From field.
Richard M. Stallman <rms@gnu.org>
parents: 7368
diff changeset
344 (while (progn (forward-line 1)
6f9af07c5783 (rmail-make-basic-summary-line): Get all the lines of the From field.
Richard M. Stallman <rms@gnu.org>
parents: 7368
diff changeset
345 (looking-at "[ \t]")))
6f9af07c5783 (rmail-make-basic-summary-line): Get all the lines of the From field.
Richard M. Stallman <rms@gnu.org>
parents: 7368
diff changeset
346 ;; Back up over newline, then trailing spaces or tabs
6f9af07c5783 (rmail-make-basic-summary-line): Get all the lines of the From field.
Richard M. Stallman <rms@gnu.org>
parents: 7368
diff changeset
347 (forward-char -1)
6f9af07c5783 (rmail-make-basic-summary-line): Get all the lines of the From field.
Richard M. Stallman <rms@gnu.org>
parents: 7368
diff changeset
348 (skip-chars-backward " \t")
6f9af07c5783 (rmail-make-basic-summary-line): Get all the lines of the From field.
Richard M. Stallman <rms@gnu.org>
parents: 7368
diff changeset
349 (point)))))
6f9af07c5783 (rmail-make-basic-summary-line): Get all the lines of the From field.
Richard M. Stallman <rms@gnu.org>
parents: 7368
diff changeset
350 len mch lo)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
351 (if (string-match (concat "^"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352 (regexp-quote (user-login-name))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353 "\\($\\|@\\)")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354 from)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
355 (save-excursion
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
356 (goto-char (point-min))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
357 (if (not (re-search-forward "^To:[ \t]*" nil t))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358 nil
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 (setq from
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
360 (concat "to: "
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
361 (mail-strip-quoted-names
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
362 (buffer-substring
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
363 (point)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364 (progn (end-of-line)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
365 (skip-chars-backward " \t")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 (point)))))))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367 (setq len (length from))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
368 (setq mch (string-match "[@%]" from))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
369 (format "%25s"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
370 (if (or (not mch) (<= len 25))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
371 (substring from (max 0 (- len 25)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
372 (substring from
7368
5e3d372d6016 (rmail-make-basic-summary-line): Show 14 chars before @ and 11 after.
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
373 (setq lo (cond ((< (- mch 14) 0) 0)
5e3d372d6016 (rmail-make-basic-summary-line): Show 14 chars before @ and 11 after.
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
374 ((< len (+ mch 11))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
375 (- len 25))
7368
5e3d372d6016 (rmail-make-basic-summary-line): Show 14 chars before @ and 11 after.
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
376 (t (- mch 14))))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
377 (min len (+ lo 25))))))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
378 " #"
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
379 (if (re-search-forward "^Subject:" nil t)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
380 (progn (skip-chars-forward " \t")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
381 (buffer-substring (point)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
382 (progn (end-of-line)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
383 (point))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
384 (re-search-forward "[\n][\n]+" nil t)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
385 (buffer-substring (point) (progn (end-of-line) (point))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
386 "\n"))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
387
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
388 ;; Simple motion in a summary buffer.
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
389
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
390 (defun rmail-summary-next-all (&optional number)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
391 (interactive "p")
2164
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
392 (forward-line (if number number 1))
9540
cde03222210e (rmail-summary-previous-all)
Richard M. Stallman <rms@gnu.org>
parents: 9482
diff changeset
393 ;; It doesn't look nice to move forward past the last message line.
cde03222210e (rmail-summary-previous-all)
Richard M. Stallman <rms@gnu.org>
parents: 9482
diff changeset
394 (and (eobp) (> number 0)
cde03222210e (rmail-summary-previous-all)
Richard M. Stallman <rms@gnu.org>
parents: 9482
diff changeset
395 (forward-line -1))
2164
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
396 (display-buffer rmail-buffer))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
397
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
398 (defun rmail-summary-previous-all (&optional number)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
399 (interactive "p")
2164
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
400 (forward-line (- (if number number 1)))
9540
cde03222210e (rmail-summary-previous-all)
Richard M. Stallman <rms@gnu.org>
parents: 9482
diff changeset
401 ;; It doesn't look nice to move forward past the last message line.
cde03222210e (rmail-summary-previous-all)
Richard M. Stallman <rms@gnu.org>
parents: 9482
diff changeset
402 (and (eobp) (< number 0)
cde03222210e (rmail-summary-previous-all)
Richard M. Stallman <rms@gnu.org>
parents: 9482
diff changeset
403 (forward-line -1))
2164
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
404 (display-buffer rmail-buffer))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
405
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
406 (defun rmail-summary-next-msg (&optional number)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
407 "Display next non-deleted msg from rmail file.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
408 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
409 messages, or backward if NUMBER is negative."
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
410 (interactive "p")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
411 (forward-line 0)
3466
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
412 (and (> number 0) (end-of-line))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
413 (let ((count (if (< number 0) (- number) number))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
414 (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
415 (non-del-msg-found nil))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
416 (while (and (> count 0) (setq non-del-msg-found
3509
a1ef317ceb18 (rmail-summary-next-msg): Fix number of dots in regexp.
Richard M. Stallman <rms@gnu.org>
parents: 3466
diff changeset
417 (or (funcall search "^....[^D]" nil t)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
418 non-del-msg-found)))
2164
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
419 (setq count (1- count))))
3466
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
420 (beginning-of-line)
2164
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
421 (display-buffer rmail-buffer))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
422
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
423 (defun rmail-summary-previous-msg (&optional number)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
424 (interactive "p")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
425 (rmail-summary-next-msg (- (if number number 1))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
426
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
427 (defun rmail-summary-next-labeled-message (n labels)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
428 "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
429 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
430 (interactive "p\nsMove to next msg with labels: ")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
431 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
432 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
433 (rmail-next-labeled-message n labels)))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
434
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
435 (defun rmail-summary-previous-labeled-message (n labels)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
436 "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
437 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
438 (interactive "p\nsMove to previous msg with labels: ")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
439 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
440 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
441 (rmail-previous-labeled-message n labels)))
10663
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
442
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
443 (defun rmail-summary-next-same-subject (n)
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
444 "Go to the next message in the summary having the same subject.
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
445 With prefix argument N, do this N times.
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
446 If N is negative, go backwards."
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
447 (interactive "p")
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
448 (let (subject search-regexp i found
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
449 (forward (> n 0)))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
450 (save-excursion
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
451 (set-buffer rmail-buffer)
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
452 (setq subject (mail-fetch-field "Subject"))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
453 (setq search-regexp (concat "^Subject: *\\(Re: *\\)?"
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
454 (regexp-quote subject)
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
455 "\n"))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
456 (setq i rmail-current-message))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
457 (if (string-match "Re:[ \t]*" subject)
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
458 (setq subject (substring subject (match-end 0))))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
459 (save-excursion
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
460 (while (and (/= n 0)
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
461 (if forward
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
462 (not (eobp))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
463 (not (bobp))))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
464 (let (done)
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
465 (while (and (not done)
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
466 (if forward
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
467 (not (eobp))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
468 (not (bobp))))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
469 ;; Advance thru summary.
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
470 (forward-line (if forward 1 -1))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
471 ;; Get msg number of this line.
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
472 (setq i (string-to-int
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
473 (buffer-substring (point)
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
474 (min (point-max) (+ 5 (point))))))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
475 ;; See if that msg has desired subject.
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
476 (save-excursion
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
477 (set-buffer rmail-buffer)
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
478 (save-restriction
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
479 (widen)
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
480 (goto-char (rmail-msgbeg i))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
481 (search-forward "\n*** EOOH ***\n")
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
482 (let ((beg (point)) end)
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
483 (search-forward "\n\n")
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
484 (setq end (point))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
485 (goto-char beg)
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
486 (setq done (re-search-forward search-regexp end t))))))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
487 (if done (setq found i)))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
488 (setq n (if forward (1- n) (1+ n)))))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
489 (if found
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
490 (rmail-summary-goto-msg found)
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
491 (error "No %s message with same subject"
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
492 (if forward "following" "previous")))))
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
493
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
494 (defun rmail-summary-previous-same-subject (n)
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
495 "Go to the previous message in the summary having the same subject.
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
496 With prefix argument N, do this N times.
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
497 If N is negative, go forwards instead."
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
498 (interactive "p")
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
499 (rmail-summary-next-same-subject (- n)))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
500
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
501 ;; Delete and undelete summary commands.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
502
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
503 (defun rmail-summary-delete-forward (&optional backward)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
504 "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
505 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
506 With prefix argument, delete and move backward."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
507 (interactive "P")
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
508 (let (end)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
509 (rmail-summary-goto-msg)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
510 (pop-to-buffer rmail-buffer)
5370
45ed020959f1 (rmail-summary-delete-forward): Move to next or prev msg
Richard M. Stallman <rms@gnu.org>
parents: 5275
diff changeset
511 (rmail-delete-message)
45ed020959f1 (rmail-summary-delete-forward): Move to next or prev msg
Richard M. Stallman <rms@gnu.org>
parents: 5275
diff changeset
512 (let ((del-msg rmail-current-message))
45ed020959f1 (rmail-summary-delete-forward): Move to next or prev msg
Richard M. Stallman <rms@gnu.org>
parents: 5275
diff changeset
513 (pop-to-buffer rmail-summary-buffer)
45ed020959f1 (rmail-summary-delete-forward): Move to next or prev msg
Richard M. Stallman <rms@gnu.org>
parents: 5275
diff changeset
514 (rmail-summary-mark-deleted del-msg)
45ed020959f1 (rmail-summary-delete-forward): Move to next or prev msg
Richard M. Stallman <rms@gnu.org>
parents: 5275
diff changeset
515 (while (and (not (if backward (bobp) (eobp)))
5514
8112b5b2651b (rmail-summary-delete-forward): Fix regexp
Richard M. Stallman <rms@gnu.org>
parents: 5507
diff changeset
516 (save-excursion (beginning-of-line)
9151
02bee4d2de9a (rmail-summary-delete-forward): Regexp for recognizing deleted message
Richard M. Stallman <rms@gnu.org>
parents: 8997
diff changeset
517 (looking-at " *[0-9]+D")))
9545
0773b7048206 (rmail-summary-delete-forward): Don't move fwd to eob.
Richard M. Stallman <rms@gnu.org>
parents: 9540
diff changeset
518 (forward-line (if backward -1 1)))
0773b7048206 (rmail-summary-delete-forward): Don't move fwd to eob.
Richard M. Stallman <rms@gnu.org>
parents: 9540
diff changeset
519 ;; It looks ugly to move to the empty line at end of buffer.
0773b7048206 (rmail-summary-delete-forward): Don't move fwd to eob.
Richard M. Stallman <rms@gnu.org>
parents: 9540
diff changeset
520 (and (eobp) (not backward)
0773b7048206 (rmail-summary-delete-forward): Don't move fwd to eob.
Richard M. Stallman <rms@gnu.org>
parents: 9540
diff changeset
521 (forward-line -1)))))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
522
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
523 (defun rmail-summary-delete-backward ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
524 "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
525 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
526 (interactive)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
527 (rmail-summary-delete-forward t))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
528
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
529 (defun rmail-summary-mark-deleted (&optional n undel)
3100
eb6ae6faff24 (rmail-summary-mark-deleted): Check for end of buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
530 (and n (rmail-summary-goto-msg n t t))
eb6ae6faff24 (rmail-summary-mark-deleted): Check for end of buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
531 (or (eobp)
10489
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
532 (not (overlay-get rmail-summary-overlay 'face))
3100
eb6ae6faff24 (rmail-summary-mark-deleted): Check for end of buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
533 (let ((buffer-read-only nil))
eb6ae6faff24 (rmail-summary-mark-deleted): Check for end of buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
534 (skip-chars-forward " ")
eb6ae6faff24 (rmail-summary-mark-deleted): Check for end of buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
535 (skip-chars-forward "[0-9]")
eb6ae6faff24 (rmail-summary-mark-deleted): Check for end of buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
536 (if undel
eb6ae6faff24 (rmail-summary-mark-deleted): Check for end of buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
537 (if (looking-at "D")
eb6ae6faff24 (rmail-summary-mark-deleted): Check for end of buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
538 (progn (delete-char 1) (insert " ")))
eb6ae6faff24 (rmail-summary-mark-deleted): Check for end of buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
539 (delete-char 1)
eb6ae6faff24 (rmail-summary-mark-deleted): Check for end of buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
540 (insert "D"))))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
541 (beginning-of-line))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
542
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
543 (defun rmail-summary-mark-undeleted (n)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
544 (rmail-summary-mark-deleted n t))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
545
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
546 (defun rmail-summary-deleted-p (&optional n)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
547 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
548 (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
549 (skip-chars-forward " ")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
550 (skip-chars-forward "[0-9]")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
551 (looking-at "D")))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
552
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
553 (defun rmail-summary-undelete (&optional arg)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
554 "Undelete current message.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
555 Optional prefix ARG means undelete ARG previous messages."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
556 (interactive "p")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
557 (if (/= arg 1)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
558 (rmail-summary-undelete-many arg)
5678
3824222fed2e (rmail-summary-undelete): If we don't undelete anything, don't move point.
Richard M. Stallman <rms@gnu.org>
parents: 5514
diff changeset
559 (let ((buffer-read-only nil)
3824222fed2e (rmail-summary-undelete): If we don't undelete anything, don't move point.
Richard M. Stallman <rms@gnu.org>
parents: 5514
diff changeset
560 (opoint (point)))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
561 (end-of-line)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
562 (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
563 (replace-match "\\1 ")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
564 (rmail-summary-goto-msg)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
565 (pop-to-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
566 (and (rmail-message-deleted-p rmail-current-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
567 (rmail-undelete-previous-message))
5678
3824222fed2e (rmail-summary-undelete): If we don't undelete anything, don't move point.
Richard M. Stallman <rms@gnu.org>
parents: 5514
diff changeset
568 (pop-to-buffer rmail-summary-buffer))
3824222fed2e (rmail-summary-undelete): If we don't undelete anything, don't move point.
Richard M. Stallman <rms@gnu.org>
parents: 5514
diff changeset
569 (t (goto-char opoint))))))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
570
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
571 (defun rmail-summary-undelete-many (&optional n)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
572 "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
573 (interactive "P")
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
574 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
575 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
576 (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
577 (rmail-current-message init-msg)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
578 (n (or n rmail-total-messages))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
579 (msgs-undeled 0))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
580 (while (and (> rmail-current-message 0)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
581 (< msgs-undeled n))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
582 (if (rmail-message-deleted-p rmail-current-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
583 (progn (rmail-set-attribute "deleted" nil)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
584 (setq msgs-undeled (1+ msgs-undeled))))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
585 (setq rmail-current-message (1- rmail-current-message)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
586 (set-buffer rmail-summary-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
587 (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
588 (while (and (> rmail-current-message 0)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
589 (< msgs-undeled n))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
590 (if (rmail-summary-deleted-p rmail-current-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
591 (progn (rmail-summary-mark-undeleted rmail-current-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
592 (setq msgs-undeled (1+ msgs-undeled))))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
593 (setq rmail-current-message (1- rmail-current-message))))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
594 (rmail-summary-goto-msg)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
595
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
596 ;; Rmail Summary mode is suitable only for specially formatted data.
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
597 (put 'rmail-summary-mode 'mode-class 'special)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
598
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
599 (defun rmail-summary-mode ()
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
600 "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
601 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
602 corresponding mail messages in the rmail buffer.
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
603
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
604 All normal editing commands are turned off.
5121
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
605 Instead, nearly all the Rmail mode commands are available,
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
606 though many of them move only among the messages in the summary.
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
607
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
608 These additional commands exist:
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
609
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
610 \\[rmail-summary-undelete-many] Undelete all or prefix arg deleted messages.
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
611 \\[rmail-summary-wipe] Delete the summary and go to the Rmail buffer.
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
612
5121
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
613 Commands for sorting the summary:
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
614
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
615 \\[rmail-summary-sort-by-date] Sort by date.
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
616 \\[rmail-summary-sort-by-subject] Sort by subject.
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
617 \\[rmail-summary-sort-by-author] Sort by author.
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
618 \\[rmail-summary-sort-by-recipient] Sort by recipient.
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
619 \\[rmail-summary-sort-by-correspondent] Sort by correspondent.
6717
2121bf252398 (rmail-summary-sort-by-keywords): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6688
diff changeset
620 \\[rmail-summary-sort-by-lines] Sort by lines.
2121bf252398 (rmail-summary-sort-by-keywords): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6688
diff changeset
621 \\[rmail-summary-sort-by-keywords] Sort by keywords."
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
622 (interactive)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
623 (kill-all-local-variables)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
624 (setq major-mode 'rmail-summary-mode)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
625 (setq mode-name "RMAIL Summary")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
626 (setq truncate-lines t)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
627 (setq buffer-read-only t)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
628 (set-syntax-table text-mode-syntax-table)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
629 (make-local-variable 'rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
630 (make-local-variable 'rmail-total-messages)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
631 (make-local-variable 'rmail-current-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
632 (setq rmail-current-message nil)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
633 (make-local-variable 'rmail-summary-redo)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
634 (setq rmail-summary-redo nil)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
635 (make-local-variable 'revert-buffer-function)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
636 (make-local-variable 'post-command-hook)
9482
7330d8566c13 * rmailsum.el: (rmail-summary-mode): Set font-lock-defaults.
Simon Marshall <simon@gnu.org>
parents: 9448
diff changeset
637 (make-local-variable 'font-lock-defaults)
7330d8566c13 * rmailsum.el: (rmail-summary-mode): Set font-lock-defaults.
Simon Marshall <simon@gnu.org>
parents: 9448
diff changeset
638 (setq font-lock-defaults '(rmail-summary-font-lock-keywords t))
6724
6728ad7f85e9 (rmail-summary-disable): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6717
diff changeset
639 (rmail-summary-enable)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
640 (run-hooks 'rmail-summary-mode-hook))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
641
6724
6728ad7f85e9 (rmail-summary-disable): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6717
diff changeset
642 ;; Summary features need to be disabled during edit mode.
6728ad7f85e9 (rmail-summary-disable): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6717
diff changeset
643 (defun rmail-summary-disable ()
6726
d6bc6057d197 Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents: 6724
diff changeset
644 (use-local-map text-mode-map)
d6bc6057d197 Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents: 6724
diff changeset
645 (remove-hook 'post-command-hook 'rmail-summary-rmail-update)
d6bc6057d197 Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents: 6724
diff changeset
646 (setq revert-buffer-function nil))
6724
6728ad7f85e9 (rmail-summary-disable): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6717
diff changeset
647
6728ad7f85e9 (rmail-summary-disable): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6717
diff changeset
648 (defun rmail-summary-enable ()
6726
d6bc6057d197 Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents: 6724
diff changeset
649 (use-local-map rmail-summary-mode-map)
d6bc6057d197 Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents: 6724
diff changeset
650 (add-hook 'post-command-hook 'rmail-summary-rmail-update)
d6bc6057d197 Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents: 6724
diff changeset
651 (setq revert-buffer-function 'rmail-update-summary))
6724
6728ad7f85e9 (rmail-summary-disable): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6717
diff changeset
652
2164
6e276a32aef1 (rmail-summary-next-msg): Call display-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 2077
diff changeset
653 ;; 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
654 ;; 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
655 ;; 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
656 (defun rmail-summary-rmail-update ()
6961
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
657 (let (buffer-read-only)
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
658 (save-excursion
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
659 ;; If at end of buffer, pretend we are on the last text line.
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
660 (if (eobp)
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
661 (forward-line -1))
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
662 (beginning-of-line)
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
663 (skip-chars-forward " ")
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
664 (let ((msg-num (string-to-int (buffer-substring
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
665 (point)
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
666 (progn (skip-chars-forward "0-9")
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
667 (point))))))
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
668 (or (eq rmail-current-message msg-num)
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
669 (let ((window (get-buffer-window rmail-buffer))
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
670 (owin (selected-window)))
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
671 (setq rmail-current-message msg-num)
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
672 (if (= (following-char) ?-)
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
673 (progn
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
674 (delete-char 1)
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
675 (insert " ")))
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
676 (if window
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
677 ;; Using save-window-excursion would cause the new value
3461
1dec1449324d (rmail-summary-expunge-and-save):
Richard M. Stallman <rms@gnu.org>
parents: 3443
diff changeset
678 ;; of point to get lost.
1dec1449324d (rmail-summary-expunge-and-save):
Richard M. Stallman <rms@gnu.org>
parents: 3443
diff changeset
679 (unwind-protect
1dec1449324d (rmail-summary-expunge-and-save):
Richard M. Stallman <rms@gnu.org>
parents: 3443
diff changeset
680 (progn
1dec1449324d (rmail-summary-expunge-and-save):
Richard M. Stallman <rms@gnu.org>
parents: 3443
diff changeset
681 (select-window window)
9432
a8cd4563a8ae (rmail-summary-rmail-update): Pass new arg to rmail-show-message.
Richard M. Stallman <rms@gnu.org>
parents: 9379
diff changeset
682 (rmail-show-message msg-num t))
6961
666f11765323 (rmail-summary-rmail-update): Update rmail buffer even if it isn't displayed.
Karl Heuer <kwzh@gnu.org>
parents: 6762
diff changeset
683 (select-window owin))
8635
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
684 (if (buffer-name rmail-buffer)
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
685 (save-excursion
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
686 (set-buffer rmail-buffer)
10489
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
687 (rmail-show-message msg-num t))))))
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
688 (rmail-summary-update-highlight nil)))))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
689
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
690 (defvar rmail-summary-mode-map nil)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
691
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
692 (if rmail-summary-mode-map
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
693 nil
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
694 (setq rmail-summary-mode-map (make-keymap))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
695 (suppress-keymap rmail-summary-mode-map)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
696 (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
697 (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
698 (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
699 (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
700 (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
701 (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
702 (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
703 (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
704 (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
705 (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
706 (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
707 (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
708 (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
709 (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
710 (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
711 (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
712 (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
713 (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
714 (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
715 (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
716 (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
717 (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
718 (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
719 (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
720 (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
721 (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
722 (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
723 (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
724 (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
725 (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
726 (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
727 (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
728 (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
729 (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
730 (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
731 (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
732 (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
733 (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
734 (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
735 (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
736 (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
737 (define-key rmail-summary-mode-map "?" 'describe-mode)
10663
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
738 (define-key rmail-summary-mode-map "\C-c\C-n" 'rmail-summary-next-same-subject)
b0bf7d40a75d (rmail-summary-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10489
diff changeset
739 (define-key rmail-summary-mode-map "\C-c\C-p" 'rmail-summary-previous-same-subject)
3879
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
740 (define-key rmail-summary-mode-map "\C-c\C-s\C-d"
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
741 'rmail-summary-sort-by-date)
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
742 (define-key rmail-summary-mode-map "\C-c\C-s\C-s"
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
743 'rmail-summary-sort-by-subject)
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
744 (define-key rmail-summary-mode-map "\C-c\C-s\C-a"
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
745 'rmail-summary-sort-by-author)
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
746 (define-key rmail-summary-mode-map "\C-c\C-s\C-r"
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
747 'rmail-summary-sort-by-recipient)
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
748 (define-key rmail-summary-mode-map "\C-c\C-s\C-c"
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
749 'rmail-summary-sort-by-correspondent)
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
750 (define-key rmail-summary-mode-map "\C-c\C-s\C-l"
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
751 'rmail-summary-sort-by-lines)
6717
2121bf252398 (rmail-summary-sort-by-keywords): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6688
diff changeset
752 (define-key rmail-summary-mode-map "\C-c\C-s\C-k"
2121bf252398 (rmail-summary-sort-by-keywords): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6688
diff changeset
753 'rmail-summary-sort-by-keywords)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
754 )
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
755
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
756 ;;; Menu bar bindings.
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
757
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
758 (define-key rmail-summary-mode-map [menu-bar] (make-sparse-keymap))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
759
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
760 (define-key rmail-summary-mode-map [menu-bar classify]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
761 (cons "Classify" (make-sparse-keymap "Classify")))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
762
8635
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
763 (define-key rmail-summary-mode-map [menu-bar classify output-menu]
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
764 '("Output (Rmail Menu)..." . rmail-summary-output-menu))
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
765
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
766 (define-key rmail-summary-mode-map [menu-bar classify input-menu]
12033
f7638ab47de7 Fix capitalization in menu bar.
Karl Heuer <kwzh@gnu.org>
parents: 11519
diff changeset
767 '("Input Rmail File (menu)..." . rmail-input-menu))
8635
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
768
8911
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
769 (define-key rmail-summary-mode-map [menu-bar classify input-menu]
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
770 '(nil))
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
771
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
772 (define-key rmail-summary-mode-map [menu-bar classify output-menu]
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
773 '(nil))
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
774
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
775 (define-key rmail-summary-mode-map [menu-bar classify output-inbox]
8422
bfdf6de7fddb (rmail-summary-mode-map): Add `...' where appropriate.
Richard M. Stallman <rms@gnu.org>
parents: 8421
diff changeset
776 '("Output (inbox)..." . rmail-summary-output))
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
777
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
778 (define-key rmail-summary-mode-map [menu-bar classify output]
8422
bfdf6de7fddb (rmail-summary-mode-map): Add `...' where appropriate.
Richard M. Stallman <rms@gnu.org>
parents: 8421
diff changeset
779 '("Output (Rmail)..." . rmail-summary-output-to-rmail-file))
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
780
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
781 (define-key rmail-summary-mode-map [menu-bar classify kill-label]
8422
bfdf6de7fddb (rmail-summary-mode-map): Add `...' where appropriate.
Richard M. Stallman <rms@gnu.org>
parents: 8421
diff changeset
782 '("Kill Label..." . rmail-summary-kill-label))
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
783
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
784 (define-key rmail-summary-mode-map [menu-bar classify add-label]
8422
bfdf6de7fddb (rmail-summary-mode-map): Add `...' where appropriate.
Richard M. Stallman <rms@gnu.org>
parents: 8421
diff changeset
785 '("Add Label..." . rmail-summary-add-label))
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
786
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
787 (define-key rmail-summary-mode-map [menu-bar summary]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
788 (cons "Summary" (make-sparse-keymap "Summary")))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
789
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
790 (define-key rmail-summary-mode-map [menu-bar summary labels]
8422
bfdf6de7fddb (rmail-summary-mode-map): Add `...' where appropriate.
Richard M. Stallman <rms@gnu.org>
parents: 8421
diff changeset
791 '("By Labels..." . rmail-summary-by-labels))
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
792
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
793 (define-key rmail-summary-mode-map [menu-bar summary recipients]
8422
bfdf6de7fddb (rmail-summary-mode-map): Add `...' where appropriate.
Richard M. Stallman <rms@gnu.org>
parents: 8421
diff changeset
794 '("By Recipients..." . rmail-summary-by-recipients))
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
795
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
796 (define-key rmail-summary-mode-map [menu-bar summary topic]
8422
bfdf6de7fddb (rmail-summary-mode-map): Add `...' where appropriate.
Richard M. Stallman <rms@gnu.org>
parents: 8421
diff changeset
797 '("By Topic..." . rmail-summary-by-topic))
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
798
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
799 (define-key rmail-summary-mode-map [menu-bar summary regexp]
8422
bfdf6de7fddb (rmail-summary-mode-map): Add `...' where appropriate.
Richard M. Stallman <rms@gnu.org>
parents: 8421
diff changeset
800 '("By Regexp..." . rmail-summary-by-regexp))
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
801
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
802 (define-key rmail-summary-mode-map [menu-bar summary all]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
803 '("All" . rmail-summary))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
804
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
805 (define-key rmail-summary-mode-map [menu-bar mail]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
806 (cons "Mail" (make-sparse-keymap "Mail")))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
807
8419
711098a43695 (rmail-summary-mode-map): Fix the Get New Mail entry.
Richard M. Stallman <rms@gnu.org>
parents: 8392
diff changeset
808 (define-key rmail-summary-mode-map [menu-bar mail rmail-summary-get-new-mail]
8392
f0e1008534c4 (rmail-summary-mode-map): Move new Re-send menu item to right place.
Richard M. Stallman <rms@gnu.org>
parents: 8385
diff changeset
809 '("Get New Mail" . rmail-summary-get-new-mail))
f0e1008534c4 (rmail-summary-mode-map): Move new Re-send menu item to right place.
Richard M. Stallman <rms@gnu.org>
parents: 8385
diff changeset
810
8421
6f13961ee63e (rmail-summary-mode-map): Fix typo.
Richard M. Stallman <rms@gnu.org>
parents: 8419
diff changeset
811 (define-key rmail-summary-mode-map [menu-bar mail lambda]
8392
f0e1008534c4 (rmail-summary-mode-map): Move new Re-send menu item to right place.
Richard M. Stallman <rms@gnu.org>
parents: 8385
diff changeset
812 '("----"))
8379
466112a5ae5a (rmail-summary-mode-map): Add Re-send menu item.
Richard M. Stallman <rms@gnu.org>
parents: 7421
diff changeset
813
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
814 (define-key rmail-summary-mode-map [menu-bar mail continue]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
815 '("Continue" . rmail-summary-continue))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
816
8392
f0e1008534c4 (rmail-summary-mode-map): Move new Re-send menu item to right place.
Richard M. Stallman <rms@gnu.org>
parents: 8385
diff changeset
817 (define-key rmail-summary-mode-map [menu-bar mail resend]
9448
99ec41e9cb2e (rmail-summary-resend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9432
diff changeset
818 '("Re-send..." . rmail-summary-resend))
8392
f0e1008534c4 (rmail-summary-mode-map): Move new Re-send menu item to right place.
Richard M. Stallman <rms@gnu.org>
parents: 8385
diff changeset
819
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
820 (define-key rmail-summary-mode-map [menu-bar mail forward]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
821 '("Forward" . rmail-summary-forward))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
822
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
823 (define-key rmail-summary-mode-map [menu-bar mail retry]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
824 '("Retry" . rmail-summary-retry-failure))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
825
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
826 (define-key rmail-summary-mode-map [menu-bar mail reply]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
827 '("Reply" . rmail-summary-reply))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
828
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
829 (define-key rmail-summary-mode-map [menu-bar mail mail]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
830 '("Mail" . rmail-summary-mail))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
831
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
832 (define-key rmail-summary-mode-map [menu-bar delete]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
833 (cons "Delete" (make-sparse-keymap "Delete")))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
834
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
835 (define-key rmail-summary-mode-map [menu-bar delete expunge/save]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
836 '("Expunge/Save" . rmail-summary-expunge-and-save))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
837
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
838 (define-key rmail-summary-mode-map [menu-bar delete expunge]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
839 '("Expunge" . rmail-summary-expunge))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
840
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
841 (define-key rmail-summary-mode-map [menu-bar delete undelete]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
842 '("Undelete" . rmail-summary-undelete))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
843
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
844 (define-key rmail-summary-mode-map [menu-bar delete delete]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
845 '("Delete" . rmail-summary-delete-forward))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
846
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
847 (define-key rmail-summary-mode-map [menu-bar move]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
848 (cons "Move" (make-sparse-keymap "Move")))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
849
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
850 (define-key rmail-summary-mode-map [menu-bar move search-back]
8422
bfdf6de7fddb (rmail-summary-mode-map): Add `...' where appropriate.
Richard M. Stallman <rms@gnu.org>
parents: 8421
diff changeset
851 '("Search Back..." . rmail-summary-search-backward))
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
852
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
853 (define-key rmail-summary-mode-map [menu-bar move search]
8422
bfdf6de7fddb (rmail-summary-mode-map): Add `...' where appropriate.
Richard M. Stallman <rms@gnu.org>
parents: 8421
diff changeset
854 '("Search..." . rmail-summary-search))
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
855
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
856 (define-key rmail-summary-mode-map [menu-bar move previous]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
857 '("Previous Nondeleted" . rmail-summary-previous-msg))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
858
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
859 (define-key rmail-summary-mode-map [menu-bar move next]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
860 '("Next Nondeleted" . rmail-summary-next-msg))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
861
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
862 (define-key rmail-summary-mode-map [menu-bar move last]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
863 '("Last" . rmail-summary-last-message))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
864
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
865 (define-key rmail-summary-mode-map [menu-bar move first]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
866 '("First" . rmail-summary-first-message))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
867
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
868 (define-key rmail-summary-mode-map [menu-bar move previous]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
869 '("Previous" . rmail-summary-previous-all))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
870
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
871 (define-key rmail-summary-mode-map [menu-bar move next]
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
872 '("Next" . rmail-summary-next-all))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
873
6422
401da3d11995 (rmail-summary-goto-msg): Highlight message number of current message.
Richard M. Stallman <rms@gnu.org>
parents: 5861
diff changeset
874 (defvar rmail-summary-overlay nil)
13515
b7ad3e888238 (rmail-summary-overlay): Make it a permanent local.
Richard M. Stallman <rms@gnu.org>
parents: 13001
diff changeset
875 (put 'rmail-summary-overlay 'permanent-local t)
6422
401da3d11995 (rmail-summary-goto-msg): Highlight message number of current message.
Richard M. Stallman <rms@gnu.org>
parents: 5861
diff changeset
876
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
877 (defun rmail-summary-goto-msg (&optional n nowarn skip-rmail)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
878 (interactive "P")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
879 (if (consp n) (setq n (prefix-numeric-value n)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
880 (if (eobp) (forward-line -1))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
881 (beginning-of-line)
9352
f10a1492ecfa (rmail-summary-goto-msg): Get rmail-total-messages from the rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents: 9151
diff changeset
882 (let* ((obuf (current-buffer))
f10a1492ecfa (rmail-summary-goto-msg): Get rmail-total-messages from the rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents: 9151
diff changeset
883 (buf rmail-buffer)
f10a1492ecfa (rmail-summary-goto-msg): Get rmail-total-messages from the rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents: 9151
diff changeset
884 (cur (point))
f10a1492ecfa (rmail-summary-goto-msg): Get rmail-total-messages from the rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents: 9151
diff changeset
885 message-not-found
f10a1492ecfa (rmail-summary-goto-msg): Get rmail-total-messages from the rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents: 9151
diff changeset
886 (curmsg (string-to-int
f10a1492ecfa (rmail-summary-goto-msg): Get rmail-total-messages from the rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents: 9151
diff changeset
887 (buffer-substring (point)
f10a1492ecfa (rmail-summary-goto-msg): Get rmail-total-messages from the rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents: 9151
diff changeset
888 (min (point-max) (+ 5 (point))))))
f10a1492ecfa (rmail-summary-goto-msg): Get rmail-total-messages from the rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents: 9151
diff changeset
889 (total (save-excursion (set-buffer buf) rmail-total-messages)))
6422
401da3d11995 (rmail-summary-goto-msg): Highlight message number of current message.
Richard M. Stallman <rms@gnu.org>
parents: 5861
diff changeset
890 ;; If message number N was specified, find that message's line
401da3d11995 (rmail-summary-goto-msg): Highlight message number of current message.
Richard M. Stallman <rms@gnu.org>
parents: 5861
diff changeset
891 ;; or set message-not-found.
401da3d11995 (rmail-summary-goto-msg): Highlight message number of current message.
Richard M. Stallman <rms@gnu.org>
parents: 5861
diff changeset
892 ;; If N wasn't specified or that message can't be found.
401da3d11995 (rmail-summary-goto-msg): Highlight message number of current message.
Richard M. Stallman <rms@gnu.org>
parents: 5861
diff changeset
893 ;; set N by default.
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
894 (if (not n)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
895 (setq n curmsg)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
896 (if (< n 1)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
897 (progn (message "No preceding message")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
898 (setq n 1)))
9352
f10a1492ecfa (rmail-summary-goto-msg): Get rmail-total-messages from the rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents: 9151
diff changeset
899 (if (> n total)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
900 (progn (message "No following message")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
901 (goto-char (point-max))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
902 (rmail-summary-goto-msg)))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
903 (goto-char (point-min))
8997
6616ea991c4a (rmail-summary-goto-msg): Simply the regexp
Richard M. Stallman <rms@gnu.org>
parents: 8911
diff changeset
904 (if (not (re-search-forward (format "^%4d[^0-9]" n) nil t))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
905 (progn (or nowarn (message "Message %d not found" n))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
906 (setq n curmsg)
6422
401da3d11995 (rmail-summary-goto-msg): Highlight message number of current message.
Richard M. Stallman <rms@gnu.org>
parents: 5861
diff changeset
907 (setq message-not-found t)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
908 (goto-char cur))))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
909 (beginning-of-line)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
910 (skip-chars-forward " ")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
911 (skip-chars-forward "0-9")
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
912 (save-excursion (if (= (following-char) ?-)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
913 (let ((buffer-read-only nil))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
914 (delete-char 1)
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
915 (insert " "))))
10489
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
916 (rmail-summary-update-highlight message-not-found)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
917 (beginning-of-line)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
918 (if skip-rmail
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
919 nil
5275
c2a5a99d89e8 (rmail-summary-goto-msg): Use unwind-protect to go
Richard M. Stallman <rms@gnu.org>
parents: 5121
diff changeset
920 (let ((selwin (selected-window)))
c2a5a99d89e8 (rmail-summary-goto-msg): Use unwind-protect to go
Richard M. Stallman <rms@gnu.org>
parents: 5121
diff changeset
921 (unwind-protect
c2a5a99d89e8 (rmail-summary-goto-msg): Use unwind-protect to go
Richard M. Stallman <rms@gnu.org>
parents: 5121
diff changeset
922 (progn (pop-to-buffer buf)
c2a5a99d89e8 (rmail-summary-goto-msg): Use unwind-protect to go
Richard M. Stallman <rms@gnu.org>
parents: 5121
diff changeset
923 (rmail-show-message n))
8728
b30c35c8e7ed (rmail-summary-goto-msg): Preserve the current buffer.
Richard M. Stallman <rms@gnu.org>
parents: 8635
diff changeset
924 (select-window selwin)
b30c35c8e7ed (rmail-summary-goto-msg): Preserve the current buffer.
Richard M. Stallman <rms@gnu.org>
parents: 8635
diff changeset
925 ;; The actions above can alter the current buffer. Preserve it.
b30c35c8e7ed (rmail-summary-goto-msg): Preserve the current buffer.
Richard M. Stallman <rms@gnu.org>
parents: 8635
diff changeset
926 (set-buffer obuf))))))
10489
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
927
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
928 ;; Update the highlighted line in an rmail summary buffer.
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
929 ;; That should be current. We highlight the line point is on.
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
930 ;; If NOT-FOUND is non-nil, we turn off highlighting.
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
931 (defun rmail-summary-update-highlight (not-found)
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
932 ;; Make sure we have an overlay to use.
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
933 (or rmail-summary-overlay
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
934 (progn
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
935 (make-local-variable 'rmail-summary-overlay)
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
936 (setq rmail-summary-overlay (make-overlay (point) (point)))))
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
937 ;; If this message is in the summary, use the overlay to highlight it.
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
938 ;; Otherwise, don't highlight anything.
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
939 (if not-found
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
940 (overlay-put rmail-summary-overlay 'face nil)
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
941 (move-overlay rmail-summary-overlay
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
942 (save-excursion (beginning-of-line)
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
943 (skip-chars-forward " ")
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
944 (point))
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
945 (save-excursion (end-of-line) (point)))
5906e2f35eb9 (rmail-summary-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10142
diff changeset
946 (overlay-put rmail-summary-overlay 'face 'highlight)))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
947
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
948 (defun rmail-summary-scroll-msg-up (&optional dist)
10030
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
949 "Scroll the Rmail window forward.
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
950 If the Rmail window is displaying the end of a message,
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
951 advance to the next message."
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
952 (interactive "P")
10030
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
953 (if (eq dist '-)
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
954 (rmail-summary-scroll-msg-down nil)
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
955 (let ((rmail-buffer-window (get-buffer-window rmail-buffer)))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
956 (if rmail-buffer-window
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
957 (if (let ((rmail-summary-window (selected-window)))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
958 (select-window rmail-buffer-window)
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
959 (prog1
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
960 ;; Is EOB visible in the buffer?
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
961 (save-excursion
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
962 (let ((ht (window-height (selected-window))))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
963 (move-to-window-line (- ht 2))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
964 (end-of-line)
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
965 (eobp)))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
966 (select-window rmail-summary-window)))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
967 (rmail-summary-next-msg (or dist 1))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
968 (let ((other-window-scroll-buffer rmail-buffer))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
969 (scroll-other-window dist)))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
970 ;; This forces rmail-buffer to be sized correctly later.
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
971 (display-buffer rmail-buffer)
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
972 (setq rmail-current-message nil)))))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
973
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
974 (defun rmail-summary-scroll-msg-down (&optional dist)
10030
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
975 "Scroll the Rmail window backward.
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
976 If the Rmail window is displaying the beginning of a message,
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
977 advance to the previous message."
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
978 (interactive "P")
10030
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
979 (if (eq dist '-)
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
980 (rmail-summary-scroll-msg-up nil)
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
981 (let ((rmail-buffer-window (get-buffer-window rmail-buffer)))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
982 (if rmail-buffer-window
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
983 (if (let ((rmail-summary-window (selected-window)))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
984 (select-window rmail-buffer-window)
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
985 (prog1
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
986 ;; Is BOB visible in the buffer?
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
987 (save-excursion
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
988 (move-to-window-line 0)
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
989 (beginning-of-line)
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
990 (bobp))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
991 (select-window rmail-summary-window)))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
992 (rmail-summary-previous-msg (or dist 1))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
993 (let ((other-window-scroll-buffer rmail-buffer))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
994 (scroll-other-window-down dist)))
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
995 ;; This forces rmail-buffer to be sized correctly later.
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
996 (display-buffer rmail-buffer)
f0264fb75509 (rmail-summary-scroll-msg-up): If at end of message,
Richard M. Stallman <rms@gnu.org>
parents: 9545
diff changeset
997 (setq rmail-current-message nil)))))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
998
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
999 (defun rmail-summary-beginning-of-message ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1000 "Show current message from the beginning."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1001 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1002 (pop-to-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1003 (beginning-of-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1004 (pop-to-buffer rmail-summary-buffer))
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1005
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1006 (defun rmail-summary-quit ()
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1007 "Quit out of Rmail and Rmail summary."
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1008 (interactive)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1009 (rmail-summary-wipe)
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1010 (rmail-quit))
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1011
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1012 (defun rmail-summary-wipe ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1013 "Kill and wipe away Rmail summary, remaining within Rmail."
130
ad8219ab7a97 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1014 (interactive)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1015 (save-excursion (set-buffer rmail-buffer) (setq rmail-summary-buffer nil))
5121
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
1016 (let ((local-rmail-buffer rmail-buffer))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1017 (kill-buffer (current-buffer))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1018 ;; Delete window if not only one.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1019 (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
1020 (delete-window))
5121
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
1021 ;; Switch windows to the rmail buffer, or switch to it in this window.
864d3ca7f2b6 (rmail-summary-wipe): If rmail buffer is not visible,
Richard M. Stallman <rms@gnu.org>
parents: 5006
diff changeset
1022 (pop-to-buffer local-rmail-buffer)))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1023
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1024 (defun rmail-summary-expunge ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1025 "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
1026 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1027 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1028 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1029 (rmail-only-expunge))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1030 (rmail-update-summary))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1031
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1032 (defun rmail-summary-expunge-and-save ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1033 "Expunge and save RMAIL file."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1034 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1035 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1036 (set-buffer rmail-buffer)
3466
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
1037 (rmail-only-expunge))
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
1038 (rmail-update-summary)
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
1039 (save-excursion
3461
1dec1449324d (rmail-summary-expunge-and-save):
Richard M. Stallman <rms@gnu.org>
parents: 3443
diff changeset
1040 (set-buffer rmail-buffer)
5861
882894a8c217 (rmail-summary-expunge-and-save): Mark summary buffer as unmodified.
Karl Heuer <kwzh@gnu.org>
parents: 5709
diff changeset
1041 (save-buffer))
882894a8c217 (rmail-summary-expunge-and-save): Mark summary buffer as unmodified.
Karl Heuer <kwzh@gnu.org>
parents: 5709
diff changeset
1042 (set-buffer-modified-p nil))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1043
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1044 (defun rmail-summary-get-new-mail ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1045 "Get new mail and recompute summary headers."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1046 (interactive)
3466
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
1047 (let (msg)
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
1048 (save-excursion
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
1049 (set-buffer rmail-buffer)
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
1050 (rmail-get-new-mail)
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
1051 ;; Get the proper new message number.
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
1052 (setq msg rmail-current-message))
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
1053 ;; Make sure that message is displayed.
13663
197f7ae5493d (rmail-summary-get-new-mail): Don't call rmail-summary-goto-msg if msg is 0.
Richard M. Stallman <rms@gnu.org>
parents: 13515
diff changeset
1054 (or (zerop msg)
197f7ae5493d (rmail-summary-get-new-mail): Don't call rmail-summary-goto-msg if msg is 0.
Richard M. Stallman <rms@gnu.org>
parents: 13515
diff changeset
1055 (rmail-summary-goto-msg msg))))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1056
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1057 (defun rmail-summary-input (filename)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1058 "Run Rmail on file FILENAME."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1059 (interactive "FRun rmail on RMAIL file: ")
3466
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
1060 ;; We switch windows here, then display the other Rmail file there.
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
1061 (pop-to-buffer rmail-buffer)
c8f52c44d9a4 (rmail-summary-expunge-and-save): Do save-buffer last.
Richard M. Stallman <rms@gnu.org>
parents: 3461
diff changeset
1062 (rmail filename))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1063
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1064 (defun rmail-summary-first-message ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1065 "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
1066 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1067 (beginning-of-buffer))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1068
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1069 (defun rmail-summary-last-message ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1070 "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
1071 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1072 (end-of-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1073 (forward-line -1))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1074
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1075 (defvar rmail-summary-edit-map nil)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1076 (if rmail-summary-edit-map
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1077 nil
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1078 (setq rmail-summary-edit-map
4990
8f5a44af0114 (rmail-summary-edit-map): Inherit text-mode-map properly.
Richard M. Stallman <rms@gnu.org>
parents: 3879
diff changeset
1079 (nconc (make-sparse-keymap) text-mode-map))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1080 (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
1081 (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
1082
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1083 (defun rmail-summary-edit-current-message ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1084 "Edit the contents of this message."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1085 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1086 (pop-to-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1087 (rmail-edit-current-message)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1088 (use-local-map rmail-summary-edit-map))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1089
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1090 (defun rmail-summary-cease-edit ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1091 "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
1092 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1093 (rmail-cease-edit)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1094 (pop-to-buffer rmail-summary-buffer))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1095
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1096 (defun rmail-summary-abort-edit ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1097 "Abort edit of current message; restore original contents.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1098 Go back to summary buffer."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1099 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1100 (rmail-abort-edit)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1101 (pop-to-buffer rmail-summary-buffer))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1102
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1103 (defun rmail-summary-search-backward (regexp &optional n)
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1104 "Show message containing next match for REGEXP.
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1105 Prefix argument gives repeat count; negative argument means search
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1106 backwards (through earlier messages).
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1107 Interactively, empty argument means use same regexp used last time."
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1108 (interactive
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1109 (let* ((reversep (>= (prefix-numeric-value current-prefix-arg) 0))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1110 (prompt
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1111 (concat (if reversep "Reverse " "") "Rmail search (regexp): "))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1112 regexp)
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1113 (if rmail-search-last-regexp
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1114 (setq prompt (concat prompt
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1115 "(default "
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1116 rmail-search-last-regexp
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1117 ") ")))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1118 (setq regexp (read-string prompt))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1119 (cond ((not (equal regexp ""))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1120 (setq rmail-search-last-regexp regexp))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1121 ((not rmail-search-last-regexp)
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1122 (error "No previous Rmail search string")))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1123 (list rmail-search-last-regexp
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1124 (prefix-numeric-value current-prefix-arg))))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1125 ;; Don't use save-excursion because that prevents point from moving
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1126 ;; properly in the summary buffer.
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1127 (let ((buffer (current-buffer)))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1128 (unwind-protect
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1129 (progn
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1130 (set-buffer rmail-buffer)
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1131 (rmail-search regexp (- n)))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1132 (set-buffer buffer))))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1133
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1134 (defun rmail-summary-search (regexp &optional n)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1135 "Show message containing next match for REGEXP.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1136 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
1137 backwards (through earlier messages).
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1138 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
1139 (interactive
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1140 (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
1141 (prompt
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1142 (concat (if reversep "Reverse " "") "Rmail search (regexp): "))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1143 regexp)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1144 (if rmail-search-last-regexp
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1145 (setq prompt (concat prompt
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1146 "(default "
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1147 rmail-search-last-regexp
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1148 ") ")))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1149 (setq regexp (read-string prompt))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1150 (cond ((not (equal regexp ""))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1151 (setq rmail-search-last-regexp regexp))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1152 ((not rmail-search-last-regexp)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1153 (error "No previous Rmail search string")))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1154 (list rmail-search-last-regexp
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1155 (prefix-numeric-value current-prefix-arg))))
3862
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1156 ;; Don't use save-excursion because that prevents point from moving
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1157 ;; properly in the summary buffer.
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1158 (let ((buffer (current-buffer)))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1159 (unwind-protect
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1160 (progn
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1161 (set-buffer rmail-buffer)
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1162 (rmail-search regexp n))
d65e83bd1120 (rmail-summary-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3509
diff changeset
1163 (set-buffer buffer))))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1164
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1165 (defun rmail-summary-toggle-header ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1166 "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
1167 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1168 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1169 (set-buffer rmail-buffer)
11175
025aeb70cfed (rmail-summary-toggle-header): Make header visible in message buffer.
Richard M. Stallman <rms@gnu.org>
parents: 10784
diff changeset
1170 (rmail-toggle-header))
025aeb70cfed (rmail-summary-toggle-header): Make header visible in message buffer.
Richard M. Stallman <rms@gnu.org>
parents: 10784
diff changeset
1171 ;; Inside save-excursion, some changes to point in the RMAIL buffer are lost.
025aeb70cfed (rmail-summary-toggle-header): Make header visible in message buffer.
Richard M. Stallman <rms@gnu.org>
parents: 10784
diff changeset
1172 ;; Set point to point-min in the RMAIL buffer, if it is visible.
025aeb70cfed (rmail-summary-toggle-header): Make header visible in message buffer.
Richard M. Stallman <rms@gnu.org>
parents: 10784
diff changeset
1173 (let ((window (get-buffer-window rmail-buffer)))
025aeb70cfed (rmail-summary-toggle-header): Make header visible in message buffer.
Richard M. Stallman <rms@gnu.org>
parents: 10784
diff changeset
1174 (if window
025aeb70cfed (rmail-summary-toggle-header): Make header visible in message buffer.
Richard M. Stallman <rms@gnu.org>
parents: 10784
diff changeset
1175 ;; Using save-window-excursion would lose the new value of point.
025aeb70cfed (rmail-summary-toggle-header): Make header visible in message buffer.
Richard M. Stallman <rms@gnu.org>
parents: 10784
diff changeset
1176 (let ((owin (selected-window)))
025aeb70cfed (rmail-summary-toggle-header): Make header visible in message buffer.
Richard M. Stallman <rms@gnu.org>
parents: 10784
diff changeset
1177 (unwind-protect
025aeb70cfed (rmail-summary-toggle-header): Make header visible in message buffer.
Richard M. Stallman <rms@gnu.org>
parents: 10784
diff changeset
1178 (progn
025aeb70cfed (rmail-summary-toggle-header): Make header visible in message buffer.
Richard M. Stallman <rms@gnu.org>
parents: 10784
diff changeset
1179 (select-window window)
025aeb70cfed (rmail-summary-toggle-header): Make header visible in message buffer.
Richard M. Stallman <rms@gnu.org>
parents: 10784
diff changeset
1180 (goto-char (point-min)))
025aeb70cfed (rmail-summary-toggle-header): Make header visible in message buffer.
Richard M. Stallman <rms@gnu.org>
parents: 10784
diff changeset
1181 (select-window owin))))))
025aeb70cfed (rmail-summary-toggle-header): Make header visible in message buffer.
Richard M. Stallman <rms@gnu.org>
parents: 10784
diff changeset
1182
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1183
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1184 (defun rmail-summary-add-label (label)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1185 "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
1186 Completion is performed over known labels when reading."
3461
1dec1449324d (rmail-summary-expunge-and-save):
Richard M. Stallman <rms@gnu.org>
parents: 3443
diff changeset
1187 (interactive (list (save-excursion
1dec1449324d (rmail-summary-expunge-and-save):
Richard M. Stallman <rms@gnu.org>
parents: 3443
diff changeset
1188 (set-buffer rmail-buffer)
1dec1449324d (rmail-summary-expunge-and-save):
Richard M. Stallman <rms@gnu.org>
parents: 3443
diff changeset
1189 (rmail-read-label "Add label"))))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1190 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1191 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1192 (rmail-add-label label)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1193
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1194 (defun rmail-summary-kill-label (label)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1195 "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
1196 Completion is performed over known labels when reading."
3461
1dec1449324d (rmail-summary-expunge-and-save):
Richard M. Stallman <rms@gnu.org>
parents: 3443
diff changeset
1197 (interactive (list (save-excursion
1dec1449324d (rmail-summary-expunge-and-save):
Richard M. Stallman <rms@gnu.org>
parents: 3443
diff changeset
1198 (set-buffer rmail-buffer)
1dec1449324d (rmail-summary-expunge-and-save):
Richard M. Stallman <rms@gnu.org>
parents: 3443
diff changeset
1199 (rmail-read-label "Kill label"))))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1200 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1201 (set-buffer rmail-buffer)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1202 (rmail-set-label label nil)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1203
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1204 ;;;; *** Rmail Summary Mailing Commands ***
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1205
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1206 (defun rmail-summary-mail ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1207 "Send mail in another window.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1208 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
1209 original message into it."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1210 (interactive)
10784
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1211 (let ((window (get-buffer-window rmail-buffer)))
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1212 (if window
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1213 (select-window window)
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1214 (set-buffer rmail-buffer)))
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1215 (rmail-start-mail nil nil nil nil nil (current-buffer))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1216 (use-local-map (copy-keymap (current-local-map)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1217 (define-key (current-local-map)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1218 "\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
1219
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1220 (defun rmail-summary-continue ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1221 "Continue composing outgoing message previously being composed."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1222 (interactive)
10784
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1223 (let ((window (get-buffer-window rmail-buffer)))
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1224 (if window
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1225 (select-window window)
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1226 (set-buffer rmail-buffer)))
5709
85119c3098a0 Fix rmail summary commands to work with rmail-mail-new-frame.
Karl Heuer <kwzh@gnu.org>
parents: 5678
diff changeset
1227 (rmail-start-mail t))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1228
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1229 (defun rmail-summary-reply (just-sender)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1230 "Reply to the current message.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1231 Normally include CC: to all other recipients of original message;
5709
85119c3098a0 Fix rmail summary commands to work with rmail-mail-new-frame.
Karl Heuer <kwzh@gnu.org>
parents: 5678
diff changeset
1232 prefix argument means ignore them. While composing the reply,
85119c3098a0 Fix rmail summary commands to work with rmail-mail-new-frame.
Karl Heuer <kwzh@gnu.org>
parents: 5678
diff changeset
1233 use \\[mail-yank-original] to yank the original message into it."
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1234 (interactive "P")
10784
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1235 (let ((window (get-buffer-window rmail-buffer)))
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1236 (if window
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1237 (select-window window)
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1238 (set-buffer rmail-buffer)))
5709
85119c3098a0 Fix rmail summary commands to work with rmail-mail-new-frame.
Karl Heuer <kwzh@gnu.org>
parents: 5678
diff changeset
1239 (rmail-reply just-sender)
85119c3098a0 Fix rmail summary commands to work with rmail-mail-new-frame.
Karl Heuer <kwzh@gnu.org>
parents: 5678
diff changeset
1240 (use-local-map (copy-keymap (current-local-map)))
85119c3098a0 Fix rmail summary commands to work with rmail-mail-new-frame.
Karl Heuer <kwzh@gnu.org>
parents: 5678
diff changeset
1241 (define-key (current-local-map)
85119c3098a0 Fix rmail summary commands to work with rmail-mail-new-frame.
Karl Heuer <kwzh@gnu.org>
parents: 5678
diff changeset
1242 "\C-c\C-c" 'rmail-summary-send-and-exit))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1243
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1244 (defun rmail-summary-retry-failure ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1245 "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
1246 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
1247 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
1248 (interactive)
10784
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1249 (let ((window (get-buffer-window rmail-buffer)))
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1250 (if window
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1251 (select-window window)
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1252 (set-buffer rmail-buffer)))
5709
85119c3098a0 Fix rmail summary commands to work with rmail-mail-new-frame.
Karl Heuer <kwzh@gnu.org>
parents: 5678
diff changeset
1253 (rmail-retry-failure)
85119c3098a0 Fix rmail summary commands to work with rmail-mail-new-frame.
Karl Heuer <kwzh@gnu.org>
parents: 5678
diff changeset
1254 (use-local-map (copy-keymap (current-local-map)))
85119c3098a0 Fix rmail summary commands to work with rmail-mail-new-frame.
Karl Heuer <kwzh@gnu.org>
parents: 5678
diff changeset
1255 (define-key (current-local-map)
85119c3098a0 Fix rmail summary commands to work with rmail-mail-new-frame.
Karl Heuer <kwzh@gnu.org>
parents: 5678
diff changeset
1256 "\C-c\C-c" 'rmail-summary-send-and-exit))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1257
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1258 (defun rmail-summary-send-and-exit ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1259 "Send mail reply and return to summary buffer."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1260 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1261 (mail-send-and-exit t))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1262
5006
356f6a751fdf (rmail-summary-forward): Accept prefix arg
Richard M. Stallman <rms@gnu.org>
parents: 4990
diff changeset
1263 (defun rmail-summary-forward (resend)
356f6a751fdf (rmail-summary-forward): Accept prefix arg
Richard M. Stallman <rms@gnu.org>
parents: 4990
diff changeset
1264 "Forward the current message to another user.
356f6a751fdf (rmail-summary-forward): Accept prefix arg
Richard M. Stallman <rms@gnu.org>
parents: 4990
diff changeset
1265 With prefix argument, \"resend\" the message instead of forwarding it;
356f6a751fdf (rmail-summary-forward): Accept prefix arg
Richard M. Stallman <rms@gnu.org>
parents: 4990
diff changeset
1266 see the documentation of `rmail-resend'."
356f6a751fdf (rmail-summary-forward): Accept prefix arg
Richard M. Stallman <rms@gnu.org>
parents: 4990
diff changeset
1267 (interactive "P")
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1268 (save-excursion
10784
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1269 (let ((window (get-buffer-window rmail-buffer)))
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1270 (if window
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1271 (select-window window)
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1272 (set-buffer rmail-buffer)))
5006
356f6a751fdf (rmail-summary-forward): Accept prefix arg
Richard M. Stallman <rms@gnu.org>
parents: 4990
diff changeset
1273 (rmail-forward resend)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1274 (use-local-map (copy-keymap (current-local-map)))
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1275 (define-key (current-local-map)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1276 "\C-c\C-c" 'rmail-summary-send-and-exit)))
9448
99ec41e9cb2e (rmail-summary-resend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9432
diff changeset
1277
99ec41e9cb2e (rmail-summary-resend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9432
diff changeset
1278 (defun rmail-summary-resend ()
99ec41e9cb2e (rmail-summary-resend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9432
diff changeset
1279 "Resend current message using 'rmail-resend'."
99ec41e9cb2e (rmail-summary-resend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9432
diff changeset
1280 (interactive)
99ec41e9cb2e (rmail-summary-resend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9432
diff changeset
1281 (save-excursion
10784
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1282 (let ((window (get-buffer-window rmail-buffer)))
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1283 (if window
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1284 (select-window window)
fdc9df3761d8 (rmail-summary-mail, rmail-summary-continue)
Richard M. Stallman <rms@gnu.org>
parents: 10663
diff changeset
1285 (set-buffer rmail-buffer)))
9448
99ec41e9cb2e (rmail-summary-resend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9432
diff changeset
1286 (call-interactively 'rmail-resend)))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1287
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1288 ;; Summary output commands.
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1289
8911
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1290 (defun rmail-summary-output-to-rmail-file (&optional file-name)
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1291 "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
1292 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
1293 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
1294 buffer visiting that file."
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1295 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1296 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1297 (set-buffer rmail-buffer)
5507
0a6c0e720ece (rmail-summary-by-senders):
Richard M. Stallman <rms@gnu.org>
parents: 5370
diff changeset
1298 (let ((rmail-delete-after-output nil))
8911
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1299 (if file-name
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1300 (rmail-output-to-rmail-file file-name)
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1301 (call-interactively 'rmail-output-to-rmail-file))))
5507
0a6c0e720ece (rmail-summary-by-senders):
Richard M. Stallman <rms@gnu.org>
parents: 5370
diff changeset
1302 (if rmail-delete-after-output
5514
8112b5b2651b (rmail-summary-delete-forward): Fix regexp
Richard M. Stallman <rms@gnu.org>
parents: 5507
diff changeset
1303 (rmail-summary-delete-forward nil)))
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1304
8635
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
1305 (defun rmail-summary-output-menu ()
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
1306 "Output current message to another Rmail file, chosen with a menu.
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
1307 Also set the default for subsequent \\[rmail-output-to-rmail-file] commands.
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
1308 The variables `rmail-secondary-file-directory' and
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
1309 `rmail-secondary-file-regexp' control which files are offered in the menu."
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
1310 (interactive)
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
1311 (save-excursion
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
1312 (set-buffer rmail-buffer)
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
1313 (let ((rmail-delete-after-output nil))
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
1314 (call-interactively 'rmail-output-menu)))
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
1315 (if rmail-delete-after-output
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
1316 (rmail-summary-delete-forward nil)))
a241401a67ff (rmail-summary-output-menu): New command.
Richard M. Stallman <rms@gnu.org>
parents: 8547
diff changeset
1317
2077
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1318 (defun rmail-summary-output ()
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1319 "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
1320 (interactive)
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1321 (save-excursion
6885836c2f98 (rmail-update-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
1322 (set-buffer rmail-buffer)
5507
0a6c0e720ece (rmail-summary-by-senders):
Richard M. Stallman <rms@gnu.org>
parents: 5370
diff changeset
1323 (let ((rmail-delete-after-output nil))
0a6c0e720ece (rmail-summary-by-senders):
Richard M. Stallman <rms@gnu.org>
parents: 5370
diff changeset
1324 (call-interactively 'rmail-output)))
0a6c0e720ece (rmail-summary-by-senders):
Richard M. Stallman <rms@gnu.org>
parents: 5370
diff changeset
1325 (if rmail-delete-after-output
5514
8112b5b2651b (rmail-summary-delete-forward): Fix regexp
Richard M. Stallman <rms@gnu.org>
parents: 5507
diff changeset
1326 (rmail-summary-delete-forward nil)))
8911
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1327
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1328 (defun rmail-summary-construct-io-menu ()
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1329 (let ((files (rmail-find-all-files rmail-secondary-file-directory)))
13001
7946d20948fc (rmail-summary-construct-io-menu): Use all of FILES.
Richard M. Stallman <rms@gnu.org>
parents: 12911
diff changeset
1330 (if files
8911
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1331 (progn
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1332 (define-key rmail-summary-mode-map [menu-bar classify input-menu]
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1333 (cons "Input Rmail File"
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1334 (rmail-list-to-menu "Input Rmail File"
13001
7946d20948fc (rmail-summary-construct-io-menu): Use all of FILES.
Richard M. Stallman <rms@gnu.org>
parents: 12911
diff changeset
1335 files
8911
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1336 'rmail-summary-input)))
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1337 (define-key rmail-summary-mode-map [menu-bar classify output-menu]
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1338 (cons "Output Rmail File"
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1339 (rmail-list-to-menu "Output Rmail File"
13001
7946d20948fc (rmail-summary-construct-io-menu): Use all of FILES.
Richard M. Stallman <rms@gnu.org>
parents: 12911
diff changeset
1340 files
7946d20948fc (rmail-summary-construct-io-menu): Use all of FILES.
Richard M. Stallman <rms@gnu.org>
parents: 12911
diff changeset
1341 'rmail-summary-output-to-rmail-file))))
7946d20948fc (rmail-summary-construct-io-menu): Use all of FILES.
Richard M. Stallman <rms@gnu.org>
parents: 12911
diff changeset
1342 (define-key rmail-summary-mode-map [menu-bar classify input-menu]
7946d20948fc (rmail-summary-construct-io-menu): Use all of FILES.
Richard M. Stallman <rms@gnu.org>
parents: 12911
diff changeset
1343 '("Input Rmail File" . rmail-disable-menu))
7946d20948fc (rmail-summary-construct-io-menu): Use all of FILES.
Richard M. Stallman <rms@gnu.org>
parents: 12911
diff changeset
1344 (define-key rmail-summary-mode-map [menu-bar classify output-menu]
7946d20948fc (rmail-summary-construct-io-menu): Use all of FILES.
Richard M. Stallman <rms@gnu.org>
parents: 12911
diff changeset
1345 '("Output Rmail File" . rmail-disable-menu)))))
8911
3abf3f2ef6cf (rmail-summary-construct-io-menu): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8728
diff changeset
1346
3879
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1347
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1348 ;; Sorting messages in Rmail Summary buffer.
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1349
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1350 (defun rmail-summary-sort-by-date (reverse)
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1351 "Sort messages of current Rmail summary by date.
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1352 If prefix argument REVERSE is non-nil, sort them in reverse order."
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1353 (interactive "P")
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1354 (rmail-sort-from-summary (function rmail-sort-by-date) reverse))
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1355
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1356 (defun rmail-summary-sort-by-subject (reverse)
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1357 "Sort messages of current Rmail summary by subject.
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1358 If prefix argument REVERSE is non-nil, sort them in reverse order."
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1359 (interactive "P")
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1360 (rmail-sort-from-summary (function rmail-sort-by-subject) reverse))
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1361
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1362 (defun rmail-summary-sort-by-author (reverse)
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1363 "Sort messages of current Rmail summary by author.
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1364 If prefix argument REVERSE is non-nil, sort them in reverse order."
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1365 (interactive "P")
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1366 (rmail-sort-from-summary (function rmail-sort-by-author) reverse))
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1367
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1368 (defun rmail-summary-sort-by-recipient (reverse)
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1369 "Sort messages of current Rmail summary by recipient.
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1370 If prefix argument REVERSE is non-nil, sort them in reverse order."
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1371 (interactive "P")
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1372 (rmail-sort-from-summary (function rmail-sort-by-recipient) reverse))
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1373
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1374 (defun rmail-summary-sort-by-correspondent (reverse)
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1375 "Sort messages of current Rmail summary by other correspondent.
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1376 If prefix argument REVERSE is non-nil, sort them in reverse order."
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1377 (interactive "P")
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1378 (rmail-sort-from-summary (function rmail-sort-by-correspondent) reverse))
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1379
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1380 (defun rmail-summary-sort-by-lines (reverse)
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1381 "Sort messages of current Rmail summary by lines of the message.
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1382 If prefix argument REVERSE is non-nil, sort them in reverse order."
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1383 (interactive "P")
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1384 (rmail-sort-from-summary (function rmail-sort-by-lines) reverse))
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1385
6717
2121bf252398 (rmail-summary-sort-by-keywords): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6688
diff changeset
1386 (defun rmail-summary-sort-by-keywords (reverse labels)
2121bf252398 (rmail-summary-sort-by-keywords): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6688
diff changeset
1387 "Sort messages of current Rmail summary by keywords.
2121bf252398 (rmail-summary-sort-by-keywords): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6688
diff changeset
1388 If prefix argument REVERSE is non-nil, sort them in reverse order.
2121bf252398 (rmail-summary-sort-by-keywords): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6688
diff changeset
1389 KEYWORDS is a comma-separated list of labels."
2121bf252398 (rmail-summary-sort-by-keywords): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6688
diff changeset
1390 (interactive "P\nsSort by labels: ")
2121bf252398 (rmail-summary-sort-by-keywords): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6688
diff changeset
1391 (rmail-sort-from-summary
2121bf252398 (rmail-summary-sort-by-keywords): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6688
diff changeset
1392 (function (lambda (reverse)
2121bf252398 (rmail-summary-sort-by-keywords): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6688
diff changeset
1393 (rmail-sort-by-keywords reverse labels)))
2121bf252398 (rmail-summary-sort-by-keywords): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6688
diff changeset
1394 reverse))
2121bf252398 (rmail-summary-sort-by-keywords): New function.
Karl Heuer <kwzh@gnu.org>
parents: 6688
diff changeset
1395
3879
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1396 (defun rmail-sort-from-summary (sortfun reverse)
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1397 "Sort Rmail messages from Summary buffer and update it after sorting."
b8c99f30ca3f (rmail-summary-mode-map): Bind summary sort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3862
diff changeset
1398 (require 'rmailsort)
6582
bac8e17d51b3 (rmail-sort-from-summary): Preserve window selection.
Karl Heuer <kwzh@gnu.org>
parents: 6422
diff changeset
1399 (let ((selwin (selected-window)))
bac8e17d51b3 (rmail-sort-from-summary): Preserve window selection.
Karl Heuer <kwzh@gnu.org>
parents: 6422
diff changeset
1400 (unwind-protect
bac8e17d51b3 (rmail-sort-from-summary): Preserve window selection.
Karl Heuer <kwzh@gnu.org>
parents: 6422
diff changeset
1401 (progn (pop-to-buffer rmail-buffer)
bac8e17d51b3 (rmail-sort-from-summary): Preserve window selection.
Karl Heuer <kwzh@gnu.org>
parents: 6422
diff changeset
1402 (funcall sortfun reverse))
bac8e17d51b3 (rmail-sort-from-summary): Preserve window selection.
Karl Heuer <kwzh@gnu.org>
parents: 6422
diff changeset
1403 (select-window selwin))))
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 130
diff changeset
1404
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 130
diff changeset
1405 ;;; rmailsum.el ends here