annotate lisp/mail/pmailsum.el @ 101365:2f0f7be5cbea

* pmail.el (pmail-buffer-swapped): Mark as permanent local.
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 23 Jan 2009 02:33:37 +0000
parents c837fea020fb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1 ;;; pmailsum.el --- make summary buffers for the mail reader
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3 ;; Copyright (C) 1985, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2003,
100908
a9dc0e7c3f2b Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 100655
diff changeset
4 ;; 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
5
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
6 ;; Maintainer: FSF
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
7 ;; Keywords: mail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
8
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
10
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
14 ;; (at your option) any later version.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
15
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
19 ;; GNU General Public License for more details.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
20
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
23
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
24 ;;; Commentary:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
25
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
26 ;; Extended by Bob Weiner of Motorola
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
27 ;; Provided all commands from pmail-mode in pmail-summary-mode and made key
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
28 ;; bindings in both modes wholly compatible.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
29
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
30 ;;; Code:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
31
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
32 (defvar msgnum)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
33
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
34 ;; For pmail-select-summary
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
35 (require 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
36
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
37 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
38 (defcustom pmail-summary-scroll-between-messages t
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
39 "*Non-nil means Pmail summary scroll commands move between messages."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
40 :type 'boolean
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
41 :group 'pmail-summary)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
42
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
43 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
44 (defcustom pmail-summary-line-count-flag t
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
45 "*Non-nil means Pmail summary should show the number of lines in each message."
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
46 :type 'boolean
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
47 :group 'pmail-summary)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
48
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
49 (defvar pmail-summary-font-lock-keywords
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
50 '(("^.....D.*" . font-lock-string-face) ; Deleted.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
51 ("^.....-.*" . font-lock-type-face) ; Unread.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
52 ;; Neither of the below will be highlighted if either of the above are:
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
53 ("^.....[^D-] \\(......\\)" 1 font-lock-keyword-face) ; Date.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
54 ("{ \\([^\n}]+\\) }" 1 font-lock-comment-face)) ; Labels.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
55 "Additional expressions to highlight in Pmail Summary mode.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
56
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
57 (defvar pmail-summary-redo
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
58 "(FUNCTION . ARGS) to regenerate this Pmail summary buffer.")
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
59
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
60 (defvar pmail-summary-overlay nil)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
61 (put 'pmail-summary-overlay 'permanent-local t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
62
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
63 (defvar pmail-summary-mode-map nil)
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97533
diff changeset
64
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
65 ;; Entry points for making a summary buffer.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
66
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
67 ;; Regenerate the contents of the summary
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
68 ;; using the same selection criterion as last time.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
69 ;; M-x revert-buffer in a summary buffer calls this function.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
70 (defun pmail-update-summary (&rest ignore)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
71 (apply (car pmail-summary-redo) (cdr pmail-summary-redo)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
72
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
73 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
74 (defun pmail-summary ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
75 "Display a summary of all messages, one line per message."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
76 (interactive)
100128
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
77 (pmail-new-summary "All" '(pmail-summary) nil)
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
78 (unless (get-buffer-window pmail-buffer)
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
79 (pmail-summary-beginning-of-message)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
80
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
81 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
82 (defun pmail-summary-by-labels (labels)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
83 "Display a summary of all messages with one or more LABELS.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
84 LABELS should be a string containing the desired labels, separated by commas."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
85 (interactive "sLabels to summarize by: ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
86 (if (string= labels "")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
87 (setq labels (or pmail-last-multi-labels
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
88 (error "No label specified"))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
89 (setq pmail-last-multi-labels labels)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
90 (pmail-new-summary (concat "labels " labels)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
91 (list 'pmail-summary-by-labels labels)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
92 'pmail-message-labels-p
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
93 (concat ", \\(" (mail-comma-list-regexp labels) "\\),")))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
94
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
95 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
96 (defun pmail-summary-by-recipients (recipients &optional primary-only)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
97 "Display a summary of all messages with the given RECIPIENTS.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
98 Normally checks the To, From and Cc fields of headers;
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
99 but if PRIMARY-ONLY is non-nil (prefix arg given),
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
100 only look in the To and From fields.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
101 RECIPIENTS is a string of regexps separated by commas."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
102 (interactive "sRecipients to summarize by: \nP")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
103 (pmail-new-summary
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
104 (concat "recipients " recipients)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
105 (list 'pmail-summary-by-recipients recipients primary-only)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
106 'pmail-message-recipients-p
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
107 (mail-comma-list-regexp recipients) primary-only))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
108
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
109 (defun pmail-message-recipients-p (msg recipients &optional primary-only)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
110 (pmail-apply-in-message msg 'pmail-message-recipients-p-1
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
111 recipients primary-only))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
112
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
113 (defun pmail-message-recipients-p-1 (recipients &optional primary-only)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
114 (narrow-to-region (point) (progn (search-forward "\n\n") (point)))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
115 (or (string-match recipients (or (mail-fetch-field "To") ""))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
116 (string-match recipients (or (mail-fetch-field "From") ""))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
117 (if (not primary-only)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
118 (string-match recipients (or (mail-fetch-field "Cc") "")))))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
119
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
120 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
121 (defun pmail-summary-by-regexp (regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
122 "Display a summary of all messages according to regexp REGEXP.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
123 If the regular expression is found in the header of the message
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
124 \(including in the date and other lines, as well as the subject line),
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
125 Emacs will list the header line in the PMAIL-summary."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
126 (interactive "sRegexp to summarize by: ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
127 (if (string= regexp "")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
128 (setq regexp (or pmail-last-regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
129 (error "No regexp specified"))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
130 (setq pmail-last-regexp regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
131 (pmail-new-summary (concat "regexp " regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
132 (list 'pmail-summary-by-regexp regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
133 'pmail-message-regexp-p
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
134 regexp))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
135
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
136 (defun pmail-message-regexp-p (msg regexp)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
137 "Return t, if for message number MSG, regexp REGEXP matches in the header."
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
138 (pmail-apply-in-message msg 'pmail-message-regexp-p-1 msg regexp))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
139
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
140 (defun pmail-message-regexp-p-1 (msg regexp)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
141 (narrow-to-region (point) (progn (search-forward "\n\n") (point)))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
142 (if pmail-enable-mime
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
143 (funcall pmail-search-mime-header-function msg regexp (point))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
144 (re-search-forward regexp nil t)))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
145
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
146 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
147 (defun pmail-summary-by-topic (subject &optional whole-message)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
148 "Display a summary of all messages with the given SUBJECT.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
149 Normally checks the Subject field of headers;
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
150 but if WHOLE-MESSAGE is non-nil (prefix arg given),
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
151 look in the whole message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
152 SUBJECT is a string of regexps separated by commas."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
153 (interactive
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
154 (let* ((subject (pmail-simplified-subject))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
155 (prompt (concat "Topics to summarize by (regexp"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
156 (if subject ", default current subject" "")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
157 "): ")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
158 (list (read-string prompt nil nil subject) current-prefix-arg)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
159 (pmail-new-summary
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
160 (concat "about " subject)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
161 (list 'pmail-summary-by-topic subject whole-message)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
162 'pmail-message-subject-p
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
163 (mail-comma-list-regexp subject) whole-message))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
164
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
165 (defun pmail-message-subject-p (msg subject &optional whole-message)
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
166 (if whole-message
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
167 (pmail-apply-in-message msg 're-search-forward subject nil t)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
168 (string-match subject (pmail-simplified-subject msg))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
169
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
170 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
171 (defun pmail-summary-by-senders (senders)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
172 "Display a summary of all messages with the given SENDERS.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
173 SENDERS is a string of names separated by commas."
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
174 (interactive "sSenders to summarize by: ")
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
175 (pmail-new-summary
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
176 (concat "senders " senders)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
177 (list 'pmail-summary-by-senders senders)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
178 'pmail-message-senders-p
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
179 (mail-comma-list-regexp senders)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
180
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
181 (defun pmail-message-senders-p (msg senders)
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
182 (string-match senders (or (pmail-get-header "From" msg) "")))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
183
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
184 ;; General making of a summary buffer.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
185
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
186 (defvar pmail-summary-symbol-number 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
187
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
188 (defvar pmail-new-summary-line-count)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
189
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
190 (defun pmail-new-summary (desc redo func &rest args)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
191 "Create a summary of selected messages.
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
192 DESC makes part of the mode line of the summary buffer. REDO is form ...
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
193 For each message, FUNC is applied to the message number and ARGS...
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
194 and if the result is non-nil, that message is included.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
195 nil for FUNCTION means all messages."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
196 (message "Computing summary lines...")
100128
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
197 (unless pmail-buffer
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
198 (error "No PMAIL buffer found"))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
199 (let (mesg was-in-summary)
100128
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
200 (if (eq major-mode 'pmail-summary-mode)
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
201 (setq was-in-summary t))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
202 (with-current-buffer pmail-buffer
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
203 (setq mesg pmail-current-message
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
204 pmail-summary-buffer (pmail-new-summary-1 desc redo func args)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
205 ;; Now display the summary buffer and go to the right place in it.
100128
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
206 (unless was-in-summary
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
207 (if (and (one-window-p)
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
208 pop-up-windows
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
209 (not pop-up-frames))
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
210 ;; If there is just one window, put the summary on the top.
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
211 (progn
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
212 (split-window (selected-window) pmail-summary-window-size)
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
213 (select-window (next-window (frame-first-window)))
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
214 (pop-to-buffer pmail-summary-buffer)
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
215 ;; If pop-to-buffer did not use that window, delete that
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
216 ;; window. (This can happen if it uses another frame.)
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
217 (if (not (eq pmail-summary-buffer
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
218 (window-buffer (frame-first-window))))
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
219 (delete-other-windows)))
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
220 (pop-to-buffer pmail-summary-buffer))
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
221 (set-buffer pmail-buffer)
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
222 ;; This is how pmail makes the summary buffer reappear.
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
223 ;; We do this here to make the window the proper size.
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
224 (pmail-select-summary nil)
e21451392719 (pmail-new-summary): Check for pmail-summary-mode in the current
Chong Yidong <cyd@stupidchicken.com>
parents: 100120
diff changeset
225 (set-buffer pmail-summary-buffer))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
226 (pmail-summary-goto-msg mesg t t)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
227 (pmail-summary-construct-io-menu)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
228 (message "Computing summary lines...done")))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
229
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
230 (defun pmail-new-summary-1 (description form function args)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
231 "Filter messages to obtain summary lines.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
232 DESCRIPTION is added to the mode line.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
233
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
234 Return the summary buffer by invoking FUNCTION on each message
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
235 passing the message number and ARGS...
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
236
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
237 REDO is a form ...
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
238
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
239 The current buffer must be a Pmail buffer either containing a
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
240 collection of mbox formatted messages or displaying a single
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
241 message."
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
242 (let ((summary-msgs ())
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
243 (pmail-new-summary-line-count 0)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
244 (sumbuf (pmail-get-create-summary-buffer)))
100655
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
245 ;; Scan the messages, getting their summary strings
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
246 ;; and putting the list of them in SUMMARY-MSGS.
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
247 (let ((msgnum 1)
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
248 (main-buffer (current-buffer))
100655
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
249 (total pmail-total-messages)
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
250 (inhibit-read-only t))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
251 (save-excursion
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
252 ;; Go where the mbox text is.
100655
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
253 (if (pmail-buffers-swapped-p)
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
254 (set-buffer pmail-view-buffer))
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
255 (let ((old-min (point-min-marker))
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
256 (old-max (point-max-marker)))
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
257 (unwind-protect
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
258 ;; Can't use save-restriction here; that doesn't work if we
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
259 ;; plan to modify text outside the original restriction.
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
260 (save-excursion
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
261 (widen)
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
262 (goto-char (point-min))
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
263 (while (>= total msgnum)
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
264 ;; Go back to the Pmail buffer so
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
265 ;; so FUNCTION and pmail-get-summary can see its local vars.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
266 (with-current-buffer main-buffer
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
267 ;; First test whether to include this message.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
268 (if (or (null function)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
269 (apply function msgnum args))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
270 (setq summary-msgs
100655
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
271 (cons (cons msgnum (pmail-get-summary msgnum))
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
272 summary-msgs))))
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
273 (setq msgnum (1+ msgnum))
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
274 ;; Provide a periodic User progress message.
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
275 (if (zerop (% pmail-new-summary-line-count 10))
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
276 (message "Computing summary lines...%d"
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
277 pmail-new-summary-line-count)))
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
278 (setq summary-msgs (nreverse summary-msgs)))
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
279 (narrow-to-region old-min old-max)))))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
280
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
281 ;; Temporarily, while summary buffer is unfinished,
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
282 ;; we "don't have" a summary.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
283 ;;
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
284 ;; I have not a clue what this clause is doing. If you read this
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
285 ;; chunk of code and have a clue, then please email that clue to
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
286 ;; pmr@pajato.com
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
287 (setq pmail-summary-buffer nil)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
288 (if pmail-enable-mime
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
289 (with-current-buffer pmail-buffer
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
290 (setq pmail-summary-buffer nil)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
291
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
292 (save-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
293 (let ((rbuf (current-buffer))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
294 (total pmail-total-messages))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
295 (set-buffer sumbuf)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
296 ;; Set up the summary buffer's contents.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
297 (let ((buffer-read-only nil))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
298 (erase-buffer)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
299 (while summary-msgs
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
300 (princ (cdr (car summary-msgs)) sumbuf)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
301 (setq summary-msgs (cdr summary-msgs)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
302 (goto-char (point-min)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
303 ;; Set up the rest of its state and local variables.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
304 (setq buffer-read-only t)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
305 (pmail-summary-mode)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
306 (make-local-variable 'minor-mode-alist)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
307 (setq minor-mode-alist (list (list t (concat ": " description))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
308 (setq pmail-buffer rbuf
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
309 pmail-summary-redo form
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
310 pmail-total-messages total)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
311 sumbuf))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
312
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
313 (defun pmail-get-create-summary-buffer ()
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
314 "Obtain a summary buffer by re-using an existing summary
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
315 buffer, or by creating a new summary buffer."
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
316 (if (and pmail-summary-buffer (buffer-name pmail-summary-buffer))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
317 pmail-summary-buffer
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
318 (generate-new-buffer (concat (buffer-name) "-summary"))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
319
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
320
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
321 ;; Low levels of generating a summary.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
322
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
323 (defun pmail-get-summary (msgnum)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
324 "Return the summary line for message MSGNUM.
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
325 The mbox buffer must be current when you call this function
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
326 even if its text is swapped.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
327
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
328 If the message has a summary line already, it will be stored in
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
329 the message as a header and simply returned, otherwise the
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
330 summary line is created, saved in the message header, cached and
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
331 returned.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
332
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
333 The current buffer contains the unrestricted message collection."
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
334 (let ((line (aref pmail-summary-vector (1- msgnum))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
335 (unless line
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
336 ;; Register a summary line for MSGNUM.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
337 (setq pmail-new-summary-line-count (1+ pmail-new-summary-line-count)
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
338 line (pmail-create-summary-line msgnum))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
339 ;; Cache the summary line for use during this Pmail session.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
340 (aset pmail-summary-vector (1- msgnum) line))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
341 line))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
342
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
343 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
344 (defcustom pmail-summary-line-decoder (function identity)
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
345 "*Function to decode a Pmail summary line.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
346 It receives the summary line for one message as a string
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
347 and should return the decoded string.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
348
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
349 By default, it is `identity', which returns the string unaltered."
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
350 :type 'function
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
351 :group 'pmail-summary)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
352
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
353 (defun pmail-create-summary-line (msgnum)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
354 "Return the summary line for message MSGNUM.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
355 Obtain the message summary from the header if it is available
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
356 otherwise create it and store it in the message header.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
357
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
358 The mbox buffer must be current when you call this function
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
359 even if its text is swapped."
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
360 (let ((beg (pmail-msgbeg msgnum))
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
361 (end (pmail-msgend msgnum))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
362 (deleted (pmail-message-deleted-p msgnum))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
363 (unseen (pmail-message-unseen-p msgnum))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
364 lines)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
365 (save-excursion
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
366 ;; Switch to the buffer that has the whole mbox text.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
367 (if (pmail-buffers-swapped-p)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
368 (set-buffer pmail-view-buffer))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
369 ;; Now we can compute the line count.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
370 (if pmail-summary-line-count-flag
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
371 (setq lines (count-lines beg end)))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
372
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
373 ;; Narrow to the message header.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
374 (save-excursion
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
375 (goto-char beg)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
376 (if (search-forward "\n\n" end t)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
377 (save-restriction
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
378 (narrow-to-region beg (point))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
379 ;; Generate a status line from the message.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
380 (pmail-create-summary msgnum deleted unseen lines))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
381 (pmail-error-bad-format msgnum))))))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
382
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
383 (defun pmail-get-summary-labels ()
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
384 "Return a coded string wrapped in curly braces denoting the status labels.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
385
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
386 The current buffer must already be narrowed to the message headers for
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
387 the message being processed."
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
388 (let ((status (mail-fetch-field pmail-attribute-header))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
389 (index 0)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
390 (result "")
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
391 char)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
392 ;; Strip off the read/unread and the deleted attribute which are
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
393 ;; handled separately.
100120
47671319c860 (pmail-get-summary-labels): If no attribute headers are found, use the
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
394 (setq status
47671319c860 (pmail-get-summary-labels): If no attribute headers are found, use the
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
395 (if status
47671319c860 (pmail-get-summary-labels): If no attribute headers are found, use the
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
396 (concat (substring status 0 1) (substring status 2 6))
47671319c860 (pmail-get-summary-labels): If no attribute headers are found, use the
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
397 ""))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
398 (while (< index (length status))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
399 (unless (string= "-" (setq char (substring status index (1+ index))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
400 (setq result (concat result char)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
401 (setq index (1+ index)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
402 (when (> (length result) 0)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
403 (setq result (concat "{" result "}")))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
404 result))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
405
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
406 (defun pmail-create-summary (msgnum deleted unseen lines)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
407 "Return the summary line for message MSGNUM.
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
408 The current buffer should already be narrowed to the header for that message.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
409 It could be either buffer, so don't access Pmail local variables.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
410 DELETED is t if this message is marked deleted.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
411 UNSEEN is t if it is marked unseen.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
412 LINES is the number of lines in the message (if we should display that)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
413 or else nil."
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
414 (goto-char (point-min))
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
415 (let ((line (pmail-header-summary))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
416 (labels (pmail-get-summary-labels))
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
417 pos status prefix basic-start basic-end linecount-string)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
418
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
419 (setq linecount-string
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
420 (cond
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
421 ((not lines) " ")
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
422 ((<= lines 9) (format " [%d]" lines))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
423 ((<= lines 99) (format " [%d]" lines))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
424 ((<= lines 999) (format " [%d]" lines))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
425 ((<= lines 9999) (format " [%dk]" (/ lines 1000)))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
426 ((<= lines 99999) (format " [%dk]" (/ lines 1000)))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
427 (t (format "[%dk]" (/ lines 1000)))))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
428
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
429 (setq status (cond
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
430 (deleted ?D)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
431 (unseen ?-)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
432 (t ? ))
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
433 prefix (format "%5d%c" msgnum status)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
434 basic-start (car line)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
435 basic-end (cadr line))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
436 (funcall pmail-summary-line-decoder
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
437 (concat prefix basic-start linecount-string " "
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
438 labels basic-end))))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
439
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
440 ;;;###autoload
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
441 (defcustom pmail-user-mail-address-regexp nil
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
442 "*Regexp matching user mail addresses.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
443 If non-nil, this variable is used to identify the correspondent
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
444 when receiving new mail. If it matches the address of the sender,
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
445 the recipient is taken as correspondent of a mail.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
446 If nil \(default value\), your `user-login-name' and `user-mail-address'
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
447 are used to exclude yourself as correspondent.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
448
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
449 Usually you don't have to set this variable, except if you collect mails
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
450 sent by you under different user names.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
451 Then it should be a regexp matching your mail addresses.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
452
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
453 Setting this variable has an effect only before reading a mail."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
454 :type '(choice (const :tag "None" nil) regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
455 :group 'pmail-retrieve
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
456 :version "21.1")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
457
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
458 (defun pmail-header-summary ()
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
459 "Return a message summary based on the message headers.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
460 The value is a list of two strings, the first and second parts of the summary.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
461
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
462 The current buffer must already be narrowed to the message headers for
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
463 the message being processed."
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
464 (goto-char (point-min))
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
465 (list
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
466 (concat (save-excursion
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
467 (if (not (re-search-forward "^Date:" nil t))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
468 " "
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
469 (cond ((re-search-forward "\\([^0-9:]\\)\\([0-3]?[0-9]\\)\\([- \t_]+\\)\\([adfjmnos][aceopu][bcglnprtvy]\\)"
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
470 (save-excursion (end-of-line) (point)) t)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
471 (format "%2d-%3s"
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
472 (string-to-number (buffer-substring
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
473 (match-beginning 2)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
474 (match-end 2)))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
475 (buffer-substring
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
476 (match-beginning 4) (match-end 4))))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
477 ((re-search-forward "\\([^a-z]\\)\\([adfjmnos][acepou][bcglnprtvy]\\)\\([-a-z \t_]*\\)\\([0-9][0-9]?\\)"
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
478 (save-excursion (end-of-line) (point)) t)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
479 (format "%2d-%3s"
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
480 (string-to-number (buffer-substring
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
481 (match-beginning 4)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
482 (match-end 4)))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
483 (buffer-substring
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
484 (match-beginning 2) (match-end 2))))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
485 ((re-search-forward "\\(19\\|20\\)\\([0-9][0-9]\\)-\\([01][0-9]\\)-\\([0-3][0-9]\\)"
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
486 (save-excursion (end-of-line) (point)) t)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
487 (format "%2s%2s%2s"
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
488 (buffer-substring
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
489 (match-beginning 2) (match-end 2))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
490 (buffer-substring
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
491 (match-beginning 3) (match-end 3))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
492 (buffer-substring
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
493 (match-beginning 4) (match-end 4))))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
494 (t "??????"))))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
495 " "
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
496 (save-excursion
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
497 (let* ((from (and (re-search-forward "^From:[ \t]*" nil t)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
498 (mail-strip-quoted-names
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
499 (buffer-substring
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
500 (1- (point))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
501 ;; Get all the lines of the From field
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
502 ;; so that we get a whole comment if there is one,
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
503 ;; so that mail-strip-quoted-names can discard it.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
504 (let ((opoint (point)))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
505 (while (progn (forward-line 1)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
506 (looking-at "[ \t]")))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
507 ;; Back up over newline, then trailing spaces or tabs
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
508 (forward-char -1)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
509 (skip-chars-backward " \t")
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
510 (point))))))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
511 len mch lo)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
512 (if (or (null from)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
513 (string-match
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
514 (or pmail-user-mail-address-regexp
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
515 (concat "^\\("
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
516 (regexp-quote (user-login-name))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
517 "\\($\\|@\\)\\|"
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
518 (regexp-quote
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
519 ;; Don't lose if run from init file
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
520 ;; where user-mail-address is not
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
521 ;; set yet.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
522 (or user-mail-address
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
523 (concat (user-login-name) "@"
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
524 (or mail-host-address
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
525 (system-name)))))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
526 "\\>\\)"))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
527 from))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
528 ;; No From field, or it's this user.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
529 (save-excursion
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
530 (goto-char (point-min))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
531 (if (not (re-search-forward "^To:[ \t]*" nil t))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
532 nil
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
533 (setq from
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
534 (concat "to: "
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
535 (mail-strip-quoted-names
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
536 (buffer-substring
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
537 (point)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
538 (progn (end-of-line)
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
539 (skip-chars-backward " \t")
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
540 (point)))))))))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
541 (if (null from)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
542 " "
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
543 (setq len (length from))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
544 (setq mch (string-match "[@%]" from))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
545 (format "%25s"
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
546 (if (or (not mch) (<= len 25))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
547 (substring from (max 0 (- len 25)))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
548 (substring from
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
549 (setq lo (cond ((< (- mch 14) 0) 0)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
550 ((< len (+ mch 11))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
551 (- len 25))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
552 (t (- mch 14))))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
553 (min len (+ lo 25)))))))))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
554 (concat (if (re-search-forward "^Subject:" nil t)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
555 (progn (skip-chars-forward " \t")
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
556 (buffer-substring (point)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
557 (progn (end-of-line)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
558 (point))))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
559 (re-search-forward "[\n][\n]+" nil t)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
560 (buffer-substring (point) (progn (end-of-line) (point))))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
561 "\n")))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
562
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
563 ;; Simple motion in a summary buffer.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
564
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
565 (defun pmail-summary-next-all (&optional number)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
566 (interactive "p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
567 (forward-line (if number number 1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
568 ;; It doesn't look nice to move forward past the last message line.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
569 (and (eobp) (> number 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
570 (forward-line -1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
571 (display-buffer pmail-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
572
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
573 (defun pmail-summary-previous-all (&optional number)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
574 (interactive "p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
575 (forward-line (- (if number number 1)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
576 ;; It doesn't look nice to move forward past the last message line.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
577 (and (eobp) (< number 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
578 (forward-line -1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
579 (display-buffer pmail-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
580
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
581 (defun pmail-summary-next-msg (&optional number)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
582 "Display next non-deleted msg from pmail file.
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
583 With optional prefix argument NUMBER, moves forward this number of non-deleted
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
584 messages, or backward if NUMBER is negative."
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
585 (interactive "p")
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
586 (forward-line 0)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
587 (and (> number 0) (end-of-line))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
588 (let ((count (if (< number 0) (- number) number))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
589 (search (if (> number 0) 're-search-forward 're-search-backward))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
590 (non-del-msg-found nil))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
591 (while (and (> count 0) (setq non-del-msg-found
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
592 (or (funcall search "^.....[^D]" nil t)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
593 non-del-msg-found)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
594 (setq count (1- count))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
595 (beginning-of-line)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
596 (display-buffer pmail-buffer))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
597
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
598 (defun pmail-summary-previous-msg (&optional number)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
599 "Display previous non-deleted msg from pmail file.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
600 With optional prefix argument NUMBER, moves backward this number of
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
601 non-deleted messages."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
602 (interactive "p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
603 (pmail-summary-next-msg (- (if number number 1))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
604
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
605 (defun pmail-summary-next-labeled-message (n labels)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
606 "Show next message with LABELS. Defaults to last labels used.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
607 With prefix argument N moves forward N messages with these labels."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
608 (interactive "p\nsMove to next msg with labels: ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
609 (let (msg)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
610 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
611 (set-buffer pmail-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
612 (pmail-next-labeled-message n labels)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
613 (setq msg pmail-current-message))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
614 (pmail-summary-goto-msg msg)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
615
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
616 (defun pmail-summary-previous-labeled-message (n labels)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
617 "Show previous message with LABELS. Defaults to last labels used.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
618 With prefix argument N moves backward N messages with these labels."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
619 (interactive "p\nsMove to previous msg with labels: ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
620 (let (msg)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
621 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
622 (set-buffer pmail-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
623 (pmail-previous-labeled-message n labels)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
624 (setq msg pmail-current-message))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
625 (pmail-summary-goto-msg msg)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
626
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
627 (defun pmail-summary-next-same-subject (n)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
628 "Go to the next message in the summary having the same subject.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
629 With prefix argument N, do this N times.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
630 If N is negative, go backwards."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
631 (interactive "p")
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
632 (let ((forward (> n 0))
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
633 subject i found)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
634 (with-current-buffer pmail-buffer
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
635 (setq subject (pmail-simplified-subject)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
636 i pmail-current-message))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
637 (save-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
638 (while (and (/= n 0)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
639 (if forward
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
640 (not (eobp))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
641 (not (bobp))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
642 (let (done)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
643 (while (and (not done)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
644 (if forward
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
645 (not (eobp))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
646 (not (bobp))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
647 ;; Advance thru summary.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
648 (forward-line (if forward 1 -1))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
649 ;; Get msg number of this line.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
650 (setq i (string-to-number
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
651 (buffer-substring (point)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
652 (min (point-max) (+ 6 (point))))))
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
653 (setq done (string-equal subject (pmail-simplified-subject i))))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
654 (if done (setq found i)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
655 (setq n (if forward (1- n) (1+ n)))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
656 (if found
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
657 (pmail-summary-goto-msg found)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
658 (error "No %s message with same subject"
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
659 (if forward "following" "previous")))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
660
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
661 (defun pmail-summary-previous-same-subject (n)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
662 "Go to the previous message in the summary having the same subject.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
663 With prefix argument N, do this N times.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
664 If N is negative, go forwards instead."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
665 (interactive "p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
666 (pmail-summary-next-same-subject (- n)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
667
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
668 ;; Delete and undelete summary commands.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
669
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
670 (defun pmail-summary-delete-forward (&optional count)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
671 "Delete this message and move to next nondeleted one.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
672 Deleted messages stay in the file until the \\[pmail-expunge] command is given.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
673 A prefix argument serves as a repeat count;
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
674 a negative argument means to delete and move backward."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
675 (interactive "p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
676 (unless (numberp count) (setq count 1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
677 (let (end del-msg
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
678 (backward (< count 0)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
679 (while (/= count 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
680 (pmail-summary-goto-msg)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
681 (with-current-buffer pmail-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
682 (pmail-delete-message)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
683 (setq del-msg pmail-current-message))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
684 (pmail-summary-mark-deleted del-msg)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
685 (while (and (not (if backward (bobp) (eobp)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
686 (save-excursion (beginning-of-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
687 (looking-at " *[0-9]+D")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
688 (forward-line (if backward -1 1)))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
689 ;; It looks ugly to move to the empty line at end of buffer.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
690 (and (eobp) (not backward)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
691 (forward-line -1))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
692 (setq count
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
693 (if (> count 0) (1- count) (1+ count))))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
694
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
695 (defun pmail-summary-delete-backward (&optional count)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
696 "Delete this message and move to previous nondeleted one.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
697 Deleted messages stay in the file until the \\[pmail-expunge] command is given.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
698 A prefix argument serves as a repeat count;
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
699 a negative argument means to delete and move forward."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
700 (interactive "p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
701 (pmail-summary-delete-forward (- count)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
702
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
703 (defun pmail-summary-mark-deleted (&optional n undel)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
704 ;; Since third arg is t, this only alters the summary, not the Pmail buf.
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
705 (and n (pmail-summary-goto-msg n t t))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
706 (or (eobp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
707 (not (overlay-get pmail-summary-overlay 'face))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
708 (let ((buffer-read-only nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
709 (skip-chars-forward " ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
710 (skip-chars-forward "[0-9]")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
711 (if undel
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
712 (if (looking-at "D")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
713 (progn (delete-char 1) (insert " ")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
714 (delete-char 1)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
715 (insert "D"))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
716 (beginning-of-line))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
717
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
718 (defun pmail-summary-mark-undeleted (n)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
719 (pmail-summary-mark-deleted n t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
720
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
721 (defun pmail-summary-deleted-p (&optional n)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
722 (save-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
723 (and n (pmail-summary-goto-msg n nil t))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
724 (skip-chars-forward " ")
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
725 (skip-chars-forward "[0-9]")
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
726 (looking-at "D")))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
727
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
728 (defun pmail-summary-undelete (&optional arg)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
729 "Undelete current message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
730 Optional prefix ARG means undelete ARG previous messages."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
731 (interactive "p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
732 (if (/= arg 1)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
733 (pmail-summary-undelete-many arg)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
734 (let ((buffer-read-only nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
735 (opoint (point)))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
736 (end-of-line)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
737 (cond ((re-search-backward "\\(^ *[0-9]*\\)\\(D\\)" nil t)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
738 (replace-match "\\1 ")
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
739 (pmail-summary-goto-msg)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
740 (if pmail-enable-mime
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
741 (set-buffer pmail-buffer)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
742 (pop-to-buffer pmail-buffer))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
743 (and (pmail-message-deleted-p pmail-current-message)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
744 (pmail-undelete-previous-message))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
745 (if pmail-enable-mime
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
746 (pop-to-buffer pmail-buffer))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
747 (pop-to-buffer pmail-summary-buffer))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
748 (t (goto-char opoint))))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
749
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
750 (defun pmail-summary-undelete-many (&optional n)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
751 "Undelete all deleted msgs, optional prefix arg N means undelete N prev msgs."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
752 (interactive "P")
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
753 (save-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
754 (set-buffer pmail-buffer)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
755 (let* ((init-msg (if n pmail-current-message pmail-total-messages))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
756 (pmail-current-message init-msg)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
757 (n (or n pmail-total-messages))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
758 (msgs-undeled 0))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
759 (while (and (> pmail-current-message 0)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
760 (< msgs-undeled n))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
761 (if (pmail-message-deleted-p pmail-current-message)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
762 (progn (pmail-set-attribute "deleted" nil)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
763 (setq msgs-undeled (1+ msgs-undeled))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
764 (setq pmail-current-message (1- pmail-current-message)))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
765 (set-buffer pmail-summary-buffer)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
766 (setq pmail-current-message init-msg msgs-undeled 0)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
767 (while (and (> pmail-current-message 0)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
768 (< msgs-undeled n))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
769 (if (pmail-summary-deleted-p pmail-current-message)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
770 (progn (pmail-summary-mark-undeleted pmail-current-message)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
771 (setq msgs-undeled (1+ msgs-undeled))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
772 (setq pmail-current-message (1- pmail-current-message))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
773 (pmail-summary-goto-msg)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
774
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
775 ;; Pmail Summary mode is suitable only for specially formatted data.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
776 (put 'pmail-summary-mode 'mode-class 'special)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
777
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
778 (defun pmail-summary-mode ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
779 "Pmail Summary Mode is invoked from Pmail Mode by using \\<pmail-mode-map>\\[pmail-summary].
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
780 As commands are issued in the summary buffer, they are applied to the
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
781 corresponding mail messages in the pmail buffer.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
782
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
783 All normal editing commands are turned off.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
784 Instead, nearly all the Pmail mode commands are available,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
785 though many of them move only among the messages in the summary.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
786
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
787 These additional commands exist:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
788
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
789 \\[pmail-summary-undelete-many] Undelete all or prefix arg deleted messages.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
790 \\[pmail-summary-wipe] Delete the summary and go to the Pmail buffer.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
791
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
792 Commands for sorting the summary:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
793
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
794 \\[pmail-summary-sort-by-date] Sort by date.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
795 \\[pmail-summary-sort-by-subject] Sort by subject.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
796 \\[pmail-summary-sort-by-author] Sort by author.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
797 \\[pmail-summary-sort-by-recipient] Sort by recipient.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
798 \\[pmail-summary-sort-by-correspondent] Sort by correspondent.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
799 \\[pmail-summary-sort-by-lines] Sort by lines.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
800 \\[pmail-summary-sort-by-labels] Sort by labels."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
801 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
802 (kill-all-local-variables)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
803 (setq major-mode 'pmail-summary-mode)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
804 (setq mode-name "PMAIL Summary")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
805 (setq truncate-lines t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
806 (setq buffer-read-only t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
807 (set-syntax-table text-mode-syntax-table)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
808 (make-local-variable 'pmail-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
809 (make-local-variable 'pmail-total-messages)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
810 (make-local-variable 'pmail-current-message)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
811 (setq pmail-current-message nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
812 (make-local-variable 'pmail-summary-redo)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
813 (setq pmail-summary-redo nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
814 (make-local-variable 'revert-buffer-function)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
815 (make-local-variable 'font-lock-defaults)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
816 (setq font-lock-defaults '(pmail-summary-font-lock-keywords t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
817 (pmail-summary-enable)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
818 (run-mode-hooks 'pmail-summary-mode-hook))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
819
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
820 ;; Summary features need to be disabled during edit mode.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
821 (defun pmail-summary-disable ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
822 (use-local-map text-mode-map)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
823 (remove-hook 'post-command-hook 'pmail-summary-pmail-update t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
824 (setq revert-buffer-function nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
825
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
826 (defun pmail-summary-enable ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
827 (use-local-map pmail-summary-mode-map)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
828 (add-hook 'post-command-hook 'pmail-summary-pmail-update nil t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
829 (setq revert-buffer-function 'pmail-update-summary))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
830
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
831 (defvar pmail-summary-put-back-unseen nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
832 "Used for communicating between calls to `pmail-summary-pmail-update'.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
833 If it moves to a message within an Incremental Search, and removes
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
834 the `unseen' attribute from that message, it sets this flag
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
835 so that if the next motion between messages is in the same Incremental
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
836 Search, the `unseen' attribute is restored.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
837
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
838 ;; Show in Pmail the message described by the summary line that point is on,
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
839 ;; but only if the Pmail buffer is already visible.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
840 ;; This is a post-command-hook in summary buffers.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
841 (defun pmail-summary-pmail-update ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
842 (let (buffer-read-only)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
843 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
844 ;; If at end of buffer, pretend we are on the last text line.
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
845 (if (eobp)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
846 (forward-line -1))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
847 (beginning-of-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
848 (skip-chars-forward " ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
849 (let ((msg-num (string-to-number (buffer-substring
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
850 (point)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
851 (progn (skip-chars-forward "0-9")
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
852 (point))))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
853 ;; Always leave `unseen' removed
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
854 ;; if we get out of isearch mode.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
855 ;; Don't let a subsequent isearch restore that `unseen'.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
856 (if (not isearch-mode)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
857 (setq pmail-summary-put-back-unseen nil))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
858
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
859 (or (eq pmail-current-message msg-num)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
860 (let ((window (get-buffer-window pmail-buffer t))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
861 (owin (selected-window)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
862 (if isearch-mode
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
863 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
864 (set-buffer pmail-buffer)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
865 ;; If we first saw the previous message in this search,
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
866 ;; and we have gone to a different message while searching,
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
867 ;; put back `unseen' on the former one.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
868 (if pmail-summary-put-back-unseen
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
869 (pmail-set-attribute "unseen" t
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
870 pmail-current-message))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
871 ;; Arrange to do that later, for the new current message,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
872 ;; if it still has `unseen'.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
873 (setq pmail-summary-put-back-unseen
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
874 (pmail-message-attr-p msg-num pmail-unseen-attr-index)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
875 (setq pmail-summary-put-back-unseen nil))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
876
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
877 ;; Go to the desired message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
878 (setq pmail-current-message msg-num)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
879
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
880 ;; Update the summary to show the message has been seen.
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
881 (if (= (following-char) ?-)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
882 (progn
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
883 (delete-char 1)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
884 (insert " ")))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
885
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
886 (if window
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
887 ;; Using save-window-excursion would cause the new value
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
888 ;; of point to get lost.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
889 (unwind-protect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
890 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
891 (select-window window)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
892 (pmail-show-message-maybe msg-num t))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
893 (select-window owin))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
894 (if (buffer-name pmail-buffer)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
895 (save-excursion
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
896 (set-buffer pmail-buffer)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
897 (pmail-show-message-maybe msg-num t))))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
898 (pmail-summary-update-highlight nil)))))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
899
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
900 (defun pmail-summary-save-buffer ()
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
901 "Save the buffer associated with this PMAIL summary."
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
902 (interactive)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
903 (save-window-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
904 (save-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
905 (switch-to-buffer pmail-buffer)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
906 (save-buffer))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
907
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
908
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
909 (if pmail-summary-mode-map
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
910 nil
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
911 (setq pmail-summary-mode-map (make-keymap))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
912 (suppress-keymap pmail-summary-mode-map)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
913
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
914 (define-key pmail-summary-mode-map [mouse-2] 'pmail-summary-mouse-goto-message)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
915 (define-key pmail-summary-mode-map "a" 'pmail-summary-add-label)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
916 (define-key pmail-summary-mode-map "b" 'pmail-summary-bury)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
917 (define-key pmail-summary-mode-map "c" 'pmail-summary-continue)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
918 (define-key pmail-summary-mode-map "d" 'pmail-summary-delete-forward)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
919 (define-key pmail-summary-mode-map "\C-d" 'pmail-summary-delete-backward)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
920 (define-key pmail-summary-mode-map "e" 'pmail-summary-edit-current-message)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
921 (define-key pmail-summary-mode-map "f" 'pmail-summary-forward)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
922 (define-key pmail-summary-mode-map "g" 'pmail-summary-get-new-mail)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
923 (define-key pmail-summary-mode-map "h" 'pmail-summary)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
924 (define-key pmail-summary-mode-map "i" 'pmail-summary-input)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
925 (define-key pmail-summary-mode-map "j" 'pmail-summary-goto-msg)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
926 (define-key pmail-summary-mode-map "\C-m" 'pmail-summary-goto-msg)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
927 (define-key pmail-summary-mode-map "k" 'pmail-summary-kill-label)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
928 (define-key pmail-summary-mode-map "l" 'pmail-summary-by-labels)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
929 (define-key pmail-summary-mode-map "\e\C-h" 'pmail-summary)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
930 (define-key pmail-summary-mode-map "\e\C-l" 'pmail-summary-by-labels)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
931 (define-key pmail-summary-mode-map "\e\C-r" 'pmail-summary-by-recipients)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
932 (define-key pmail-summary-mode-map "\e\C-s" 'pmail-summary-by-regexp)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
933 (define-key pmail-summary-mode-map "\e\C-t" 'pmail-summary-by-topic)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
934 (define-key pmail-summary-mode-map "m" 'pmail-summary-mail)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
935 (define-key pmail-summary-mode-map "\M-m" 'pmail-summary-retry-failure)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
936 (define-key pmail-summary-mode-map "n" 'pmail-summary-next-msg)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
937 (define-key pmail-summary-mode-map "\en" 'pmail-summary-next-all)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
938 (define-key pmail-summary-mode-map "\e\C-n" 'pmail-summary-next-labeled-message)
101222
490b85e0b4fc (pmail-summary-mode-map, pmail-summary-output-to-pmail-file): Use
Glenn Morris <rgm@gnu.org>
parents: 100965
diff changeset
939 (define-key pmail-summary-mode-map "o" 'pmail-summary-output)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
940 (define-key pmail-summary-mode-map "\C-o" 'pmail-summary-output)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
941 (define-key pmail-summary-mode-map "p" 'pmail-summary-previous-msg)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
942 (define-key pmail-summary-mode-map "\ep" 'pmail-summary-previous-all)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
943 (define-key pmail-summary-mode-map "\e\C-p" 'pmail-summary-previous-labeled-message)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
944 (define-key pmail-summary-mode-map "q" 'pmail-summary-quit)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
945 (define-key pmail-summary-mode-map "Q" 'pmail-summary-wipe)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
946 (define-key pmail-summary-mode-map "r" 'pmail-summary-reply)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
947 (define-key pmail-summary-mode-map "s" 'pmail-summary-expunge-and-save)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
948 (define-key pmail-summary-mode-map "\es" 'pmail-summary-search)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
949 (define-key pmail-summary-mode-map "t" 'pmail-summary-toggle-header)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
950 (define-key pmail-summary-mode-map "u" 'pmail-summary-undelete)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
951 (define-key pmail-summary-mode-map "\M-u" 'pmail-summary-undelete-many)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
952 (define-key pmail-summary-mode-map "x" 'pmail-summary-expunge)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
953 (define-key pmail-summary-mode-map "w" 'pmail-summary-output-body)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
954 (define-key pmail-summary-mode-map "." 'pmail-summary-beginning-of-message)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
955 (define-key pmail-summary-mode-map "/" 'pmail-summary-end-of-message)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
956 (define-key pmail-summary-mode-map "<" 'pmail-summary-first-message)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
957 (define-key pmail-summary-mode-map ">" 'pmail-summary-last-message)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
958 (define-key pmail-summary-mode-map " " 'pmail-summary-scroll-msg-up)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
959 (define-key pmail-summary-mode-map "\177" 'pmail-summary-scroll-msg-down)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
960 (define-key pmail-summary-mode-map "?" 'describe-mode)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
961 (define-key pmail-summary-mode-map "\C-c\C-n" 'pmail-summary-next-same-subject)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
962 (define-key pmail-summary-mode-map "\C-c\C-p" 'pmail-summary-previous-same-subject)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
963 (define-key pmail-summary-mode-map "\C-c\C-s\C-d"
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
964 'pmail-summary-sort-by-date)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
965 (define-key pmail-summary-mode-map "\C-c\C-s\C-s"
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
966 'pmail-summary-sort-by-subject)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
967 (define-key pmail-summary-mode-map "\C-c\C-s\C-a"
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
968 'pmail-summary-sort-by-author)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
969 (define-key pmail-summary-mode-map "\C-c\C-s\C-r"
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
970 'pmail-summary-sort-by-recipient)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
971 (define-key pmail-summary-mode-map "\C-c\C-s\C-c"
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
972 'pmail-summary-sort-by-correspondent)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
973 (define-key pmail-summary-mode-map "\C-c\C-s\C-l"
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
974 'pmail-summary-sort-by-lines)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
975 (define-key pmail-summary-mode-map "\C-c\C-s\C-k"
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
976 'pmail-summary-sort-by-labels)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
977 (define-key pmail-summary-mode-map "\C-x\C-s" 'pmail-summary-save-buffer)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
978 )
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
979
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
980 ;;; Menu bar bindings.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
981
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
982 (define-key pmail-summary-mode-map [menu-bar] (make-sparse-keymap))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
983
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
984 (define-key pmail-summary-mode-map [menu-bar classify]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
985 (cons "Classify" (make-sparse-keymap "Classify")))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
986
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
987 (define-key pmail-summary-mode-map [menu-bar classify output-menu]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
988 '("Output (Pmail Menu)..." . pmail-summary-output-menu))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
989
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
990 (define-key pmail-summary-mode-map [menu-bar classify input-menu]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
991 '("Input Pmail File (menu)..." . pmail-input-menu))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
992
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
993 (define-key pmail-summary-mode-map [menu-bar classify input-menu]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
994 '(nil))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
995
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
996 (define-key pmail-summary-mode-map [menu-bar classify output-menu]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
997 '(nil))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
998
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
999 (define-key pmail-summary-mode-map [menu-bar classify output-body]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1000 '("Output (body)..." . pmail-summary-output-body))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1001
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1002 (define-key pmail-summary-mode-map [menu-bar classify output-inbox]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1003 '("Output (inbox)..." . pmail-summary-output))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1004
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1005 (define-key pmail-summary-mode-map [menu-bar classify output]
101222
490b85e0b4fc (pmail-summary-mode-map, pmail-summary-output-to-pmail-file): Use
Glenn Morris <rgm@gnu.org>
parents: 100965
diff changeset
1006 '("Output (Pmail)..." . pmail-summary-output))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1007
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1008 (define-key pmail-summary-mode-map [menu-bar classify kill-label]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1009 '("Kill Label..." . pmail-summary-kill-label))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1010
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1011 (define-key pmail-summary-mode-map [menu-bar classify add-label]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1012 '("Add Label..." . pmail-summary-add-label))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1013
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1014 (define-key pmail-summary-mode-map [menu-bar summary]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1015 (cons "Summary" (make-sparse-keymap "Summary")))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1016
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1017 (define-key pmail-summary-mode-map [menu-bar summary senders]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1018 '("By Senders..." . pmail-summary-by-senders))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1019
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1020 (define-key pmail-summary-mode-map [menu-bar summary labels]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1021 '("By Labels..." . pmail-summary-by-labels))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1022
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1023 (define-key pmail-summary-mode-map [menu-bar summary recipients]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1024 '("By Recipients..." . pmail-summary-by-recipients))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1025
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1026 (define-key pmail-summary-mode-map [menu-bar summary topic]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1027 '("By Topic..." . pmail-summary-by-topic))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1028
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1029 (define-key pmail-summary-mode-map [menu-bar summary regexp]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1030 '("By Regexp..." . pmail-summary-by-regexp))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1031
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1032 (define-key pmail-summary-mode-map [menu-bar summary all]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1033 '("All" . pmail-summary))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1034
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1035 (define-key pmail-summary-mode-map [menu-bar mail]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1036 (cons "Mail" (make-sparse-keymap "Mail")))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1037
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1038 (define-key pmail-summary-mode-map [menu-bar mail pmail-summary-get-new-mail]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1039 '("Get New Mail" . pmail-summary-get-new-mail))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1040
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1041 (define-key pmail-summary-mode-map [menu-bar mail lambda]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1042 '("----"))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1043
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1044 (define-key pmail-summary-mode-map [menu-bar mail continue]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1045 '("Continue" . pmail-summary-continue))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1046
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1047 (define-key pmail-summary-mode-map [menu-bar mail resend]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1048 '("Re-send..." . pmail-summary-resend))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1049
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1050 (define-key pmail-summary-mode-map [menu-bar mail forward]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1051 '("Forward" . pmail-summary-forward))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1052
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1053 (define-key pmail-summary-mode-map [menu-bar mail retry]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1054 '("Retry" . pmail-summary-retry-failure))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1055
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1056 (define-key pmail-summary-mode-map [menu-bar mail reply]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1057 '("Reply" . pmail-summary-reply))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1058
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1059 (define-key pmail-summary-mode-map [menu-bar mail mail]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1060 '("Mail" . pmail-summary-mail))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1061
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1062 (define-key pmail-summary-mode-map [menu-bar delete]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1063 (cons "Delete" (make-sparse-keymap "Delete")))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1064
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1065 (define-key pmail-summary-mode-map [menu-bar delete expunge/save]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1066 '("Expunge/Save" . pmail-summary-expunge-and-save))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1067
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1068 (define-key pmail-summary-mode-map [menu-bar delete expunge]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1069 '("Expunge" . pmail-summary-expunge))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1070
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1071 (define-key pmail-summary-mode-map [menu-bar delete undelete]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1072 '("Undelete" . pmail-summary-undelete))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1073
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1074 (define-key pmail-summary-mode-map [menu-bar delete delete]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1075 '("Delete" . pmail-summary-delete-forward))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1076
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1077 (define-key pmail-summary-mode-map [menu-bar move]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1078 (cons "Move" (make-sparse-keymap "Move")))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1079
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1080 (define-key pmail-summary-mode-map [menu-bar move search-back]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1081 '("Search Back..." . pmail-summary-search-backward))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1082
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1083 (define-key pmail-summary-mode-map [menu-bar move search]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1084 '("Search..." . pmail-summary-search))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1085
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1086 (define-key pmail-summary-mode-map [menu-bar move previous]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1087 '("Previous Nondeleted" . pmail-summary-previous-msg))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1088
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1089 (define-key pmail-summary-mode-map [menu-bar move next]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1090 '("Next Nondeleted" . pmail-summary-next-msg))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1091
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1092 (define-key pmail-summary-mode-map [menu-bar move last]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1093 '("Last" . pmail-summary-last-message))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1094
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1095 (define-key pmail-summary-mode-map [menu-bar move first]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1096 '("First" . pmail-summary-first-message))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1097
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1098 (define-key pmail-summary-mode-map [menu-bar move previous]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1099 '("Previous" . pmail-summary-previous-all))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1100
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1101 (define-key pmail-summary-mode-map [menu-bar move next]
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1102 '("Next" . pmail-summary-next-all))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1103
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1104 (defun pmail-summary-mouse-goto-message (event)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1105 "Select the message whose summary line you click on."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1106 (interactive "@e")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1107 (goto-char (posn-point (event-end event)))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1108 (pmail-summary-goto-msg))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1109
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1110 (defun pmail-summary-goto-msg (&optional n nowarn skip-pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1111 "Go to message N in the summary buffer and the Pmail buffer.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1112 If N is nil, use the message corresponding to point in the summary
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1113 and move to that message in the Pmail buffer.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1114
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1115 If NOWARN, don't say anything if N is out of range.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1116 If SKIP-PMAIL, don't do anything to the Pmail buffer."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1117 (interactive "P")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1118 (if (consp n) (setq n (prefix-numeric-value n)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1119 (if (eobp) (forward-line -1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1120 (beginning-of-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1121 (let* ((obuf (current-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1122 (buf pmail-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1123 (cur (point))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1124 message-not-found
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1125 (curmsg (string-to-number
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1126 (buffer-substring (point)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1127 (min (point-max) (+ 6 (point))))))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1128 (total (save-excursion (set-buffer buf) pmail-total-messages)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1129 ;; If message number N was specified, find that message's line
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1130 ;; or set message-not-found.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1131 ;; If N wasn't specified or that message can't be found.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1132 ;; set N by default.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1133 (if (not n)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1134 (setq n curmsg)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1135 (if (< n 1)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1136 (progn (message "No preceding message")
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1137 (setq n 1)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1138 (if (and (> n total)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1139 (> total 0))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1140 (progn (message "No following message")
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1141 (goto-char (point-max))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1142 (pmail-summary-goto-msg nil nowarn skip-pmail)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1143 (goto-char (point-min))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1144 (if (not (re-search-forward (format "^%5d[^0-9]" n) nil t))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1145 (progn (or nowarn (message "Message %d not found" n))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1146 (setq n curmsg)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1147 (setq message-not-found t)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1148 (goto-char cur))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1149 (beginning-of-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1150 (skip-chars-forward " ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1151 (skip-chars-forward "0-9")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1152 (save-excursion (if (= (following-char) ?-)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1153 (let ((buffer-read-only nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1154 (delete-char 1)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1155 (insert " "))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1156 (pmail-summary-update-highlight message-not-found)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1157 (beginning-of-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1158 (if skip-pmail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1159 nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1160 (let ((selwin (selected-window)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1161 (unwind-protect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1162 (progn (pop-to-buffer buf)
100141
7512f1d3a1cb (pmail-summary-goto-msg): Use pmail-show-message-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100128
diff changeset
1163 (pmail-show-message-maybe n))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1164 (select-window selwin)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1165 ;; The actions above can alter the current buffer. Preserve it.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1166 (set-buffer obuf))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1167
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1168 ;; Update the highlighted line in an pmail summary buffer.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1169 ;; That should be current. We highlight the line point is on.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1170 ;; If NOT-FOUND is non-nil, we turn off highlighting.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1171 (defun pmail-summary-update-highlight (not-found)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1172 ;; Make sure we have an overlay to use.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1173 (or pmail-summary-overlay
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1174 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1175 (make-local-variable 'pmail-summary-overlay)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1176 (setq pmail-summary-overlay (make-overlay (point) (point)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1177 ;; If this message is in the summary, use the overlay to highlight it.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1178 ;; Otherwise, don't highlight anything.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1179 (if not-found
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1180 (overlay-put pmail-summary-overlay 'face nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1181 (move-overlay pmail-summary-overlay
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1182 (save-excursion (beginning-of-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1183 (skip-chars-forward " ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1184 (point))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1185 (save-excursion (end-of-line) (point)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1186 (overlay-put pmail-summary-overlay 'face 'highlight)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1187
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1188 (defun pmail-summary-scroll-msg-up (&optional dist)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1189 "Scroll the Pmail window forward.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1190 If the Pmail window is displaying the end of a message,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1191 advance to the next message."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1192 (interactive "P")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1193 (if (eq dist '-)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1194 (pmail-summary-scroll-msg-down nil)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1195 (let ((pmail-buffer-window (get-buffer-window pmail-buffer)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1196 (if pmail-buffer-window
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1197 (if (let ((pmail-summary-window (selected-window)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1198 (select-window pmail-buffer-window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1199 (prog1
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1200 ;; Is EOB visible in the buffer?
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1201 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1202 (let ((ht (window-height (selected-window))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1203 (move-to-window-line (- ht 2))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1204 (end-of-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1205 (eobp)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1206 (select-window pmail-summary-window)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1207 (if (not pmail-summary-scroll-between-messages)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1208 (error "End of buffer")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1209 (pmail-summary-next-msg (or dist 1)))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1210 (let ((other-window-scroll-buffer pmail-buffer))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1211 (scroll-other-window dist)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1212 ;; If it isn't visible at all, show the beginning.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1213 (pmail-summary-beginning-of-message)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1214
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1215 (defun pmail-summary-scroll-msg-down (&optional dist)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1216 "Scroll the Pmail window backward.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1217 If the Pmail window is now displaying the beginning of a message,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1218 move to the previous message."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1219 (interactive "P")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1220 (if (eq dist '-)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1221 (pmail-summary-scroll-msg-up nil)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1222 (let ((pmail-buffer-window (get-buffer-window pmail-buffer)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1223 (if pmail-buffer-window
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1224 (if (let ((pmail-summary-window (selected-window)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1225 (select-window pmail-buffer-window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1226 (prog1
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1227 ;; Is BOB visible in the buffer?
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1228 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1229 (move-to-window-line 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1230 (beginning-of-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1231 (bobp))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1232 (select-window pmail-summary-window)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1233 (if (not pmail-summary-scroll-between-messages)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1234 (error "Beginning of buffer")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1235 (pmail-summary-previous-msg (or dist 1)))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1236 (let ((other-window-scroll-buffer pmail-buffer))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1237 (scroll-other-window-down dist)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1238 ;; If it isn't visible at all, show the beginning.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1239 (pmail-summary-beginning-of-message)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1240
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1241 (defun pmail-summary-beginning-of-message ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1242 "Show current message from the beginning."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1243 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1244 (pmail-summary-show-message 'BEG))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1245
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1246 (defun pmail-summary-end-of-message ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1247 "Show bottom of current message."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1248 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1249 (pmail-summary-show-message 'END))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1250
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1251 (defun pmail-summary-show-message (where)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1252 "Show current mail message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1253 Position it according to WHERE which can be BEG or END"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1254 (if (and (one-window-p) (not pop-up-frames))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1255 ;; If there is just one window, put the summary on the top.
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1256 (let ((buffer pmail-buffer))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1257 (split-window (selected-window) pmail-summary-window-size)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1258 (select-window (frame-first-window))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1259 (pop-to-buffer pmail-buffer)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1260 ;; If pop-to-buffer did not use that window, delete that
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1261 ;; window. (This can happen if it uses another frame.)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1262 (or (eq buffer (window-buffer (next-window (frame-first-window))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1263 (delete-other-windows)))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1264 (pop-to-buffer pmail-buffer))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1265 (cond
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1266 ((eq where 'BEG)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1267 (goto-char (point-min))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1268 (search-forward "\n\n"))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1269 ((eq where 'END)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1270 (goto-char (point-max))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1271 (recenter (1- (window-height))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1272 )
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1273 (pop-to-buffer pmail-summary-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1274
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1275 (defun pmail-summary-bury ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1276 "Bury the Pmail buffer and the Pmail summary buffer."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1277 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1278 (let ((buffer-to-bury (current-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1279 (let (window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1280 (while (setq window (get-buffer-window pmail-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1281 (set-window-buffer window (other-buffer pmail-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1282 (bury-buffer pmail-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1283 (switch-to-buffer (other-buffer buffer-to-bury))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1284 (bury-buffer buffer-to-bury)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1285
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1286 (defun pmail-summary-quit ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1287 "Quit out of Pmail and Pmail summary."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1288 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1289 (pmail-summary-wipe)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1290 (pmail-quit))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1291
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1292 (defun pmail-summary-wipe ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1293 "Kill and wipe away Pmail summary, remaining within Pmail."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1294 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1295 (save-excursion (set-buffer pmail-buffer) (setq pmail-summary-buffer nil))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1296 (let ((local-pmail-buffer pmail-buffer))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1297 (kill-buffer (current-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1298 ;; Delete window if not only one.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1299 (if (not (eq (selected-window) (next-window nil 'no-minibuf)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1300 (delete-window))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1301 ;; Switch windows to the pmail buffer, or switch to it in this window.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1302 (pop-to-buffer local-pmail-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1303
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1304 (defun pmail-summary-expunge ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1305 "Actually erase all deleted messages and recompute summary headers."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1306 (interactive)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1307 (save-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1308 (set-buffer pmail-buffer)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1309 (when (pmail-expunge-confirmed)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1310 (pmail-only-expunge)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1311 (pmail-update-summary))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1312
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1313 (defun pmail-summary-expunge-and-save ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1314 "Expunge and save PMAIL file."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1315 (interactive)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1316 (save-excursion
101339
c837fea020fb (pmail-summary-expunge-and-save): Use pmail-expunge-and-save.
Chong Yidong <cyd@stupidchicken.com>
parents: 101301
diff changeset
1317 (pmail-expunge-and-save))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1318 (pmail-update-summary)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1319 (set-buffer-modified-p nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1320
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1321 (defun pmail-summary-get-new-mail (&optional file-name)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1322 "Get new mail and recompute summary headers.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1323
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1324 Optionally you can specify the file to get new mail from. In this case,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1325 the file of new mail is not changed or deleted. Noninteractively, you can
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1326 pass the inbox file name as an argument. Interactively, a prefix
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1327 argument says to read a file name and use that file as the inbox."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1328 (interactive
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1329 (list (if current-prefix-arg
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1330 (read-file-name "Get new mail from file: "))))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1331 (let (msg)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1332 (save-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1333 (set-buffer pmail-buffer)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1334 (pmail-get-new-mail file-name)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1335 ;; Get the proper new message number.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1336 (setq msg pmail-current-message))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1337 ;; Make sure that message is displayed.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1338 (or (zerop msg)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1339 (pmail-summary-goto-msg msg))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1340
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1341 (defun pmail-summary-input (filename)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1342 "Run Pmail on file FILENAME."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1343 (interactive "FRun pmail on PMAIL file: ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1344 ;; We switch windows here, then display the other Pmail file there.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1345 (pop-to-buffer pmail-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1346 (pmail filename))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1347
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1348 (defun pmail-summary-first-message ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1349 "Show first message in Pmail file from summary buffer."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1350 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1351 (with-no-warnings
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1352 (beginning-of-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1353
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1354 (defun pmail-summary-last-message ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1355 "Show last message in Pmail file from summary buffer."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1356 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1357 (with-no-warnings
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1358 (end-of-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1359 (forward-line -1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1360
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1361 (declare-function pmail-abort-edit "pmailedit" ())
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1362 (declare-function pmail-cease-edit "pmailedit"())
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1363 (declare-function pmail-set-label "pmailkwd" (l state &optional n))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1364 (declare-function pmail-output-read-file-name "pmailout" ())
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1365 (declare-function mail-send-and-exit "sendmail" (&optional arg))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1366
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1367 (defvar pmail-summary-edit-map nil)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1368 (if pmail-summary-edit-map
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1369 nil
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1370 (setq pmail-summary-edit-map
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1371 (nconc (make-sparse-keymap) text-mode-map))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1372 (define-key pmail-summary-edit-map "\C-c\C-c" 'pmail-cease-edit)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1373 (define-key pmail-summary-edit-map "\C-c\C-]" 'pmail-abort-edit))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1374
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1375 (defun pmail-summary-edit-current-message ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1376 "Edit the contents of this message."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1377 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1378 (pop-to-buffer pmail-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1379 (pmail-edit-current-message)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1380 (use-local-map pmail-summary-edit-map))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1381
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1382 (defun pmail-summary-cease-edit ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1383 "Finish editing message, then go back to Pmail summary buffer."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1384 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1385 (pmail-cease-edit)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1386 (pop-to-buffer pmail-summary-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1387
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1388 (defun pmail-summary-abort-edit ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1389 "Abort edit of current message; restore original contents.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1390 Go back to summary buffer."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1391 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1392 (pmail-abort-edit)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1393 (pop-to-buffer pmail-summary-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1394
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1395 (defun pmail-summary-search-backward (regexp &optional n)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1396 "Show message containing next match for REGEXP.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1397 Prefix argument gives repeat count; negative argument means search
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1398 backwards (through earlier messages).
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1399 Interactively, empty argument means use same regexp used last time."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1400 (interactive
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1401 (let* ((reversep (>= (prefix-numeric-value current-prefix-arg) 0))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1402 (prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1403 (concat (if reversep "Reverse " "") "Pmail search (regexp"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1404 regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1405 (setq prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1406 (concat prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1407 (if pmail-search-last-regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1408 (concat ", default "
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1409 pmail-search-last-regexp "): ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1410 "): ")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1411 (setq regexp (read-string prompt))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1412 (cond ((not (equal regexp ""))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1413 (setq pmail-search-last-regexp regexp))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1414 ((not pmail-search-last-regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1415 (error "No previous Pmail search string")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1416 (list pmail-search-last-regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1417 (prefix-numeric-value current-prefix-arg))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1418 ;; Don't use save-excursion because that prevents point from moving
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1419 ;; properly in the summary buffer.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1420 (let ((buffer (current-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1421 (unwind-protect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1422 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1423 (set-buffer pmail-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1424 (pmail-search regexp (- n)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1425 (set-buffer buffer))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1426
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1427 (defun pmail-summary-search (regexp &optional n)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1428 "Show message containing next match for REGEXP.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1429 Prefix argument gives repeat count; negative argument means search
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1430 backwards (through earlier messages).
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1431 Interactively, empty argument means use same regexp used last time."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1432 (interactive
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1433 (let* ((reversep (< (prefix-numeric-value current-prefix-arg) 0))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1434 (prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1435 (concat (if reversep "Reverse " "") "Pmail search (regexp"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1436 regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1437 (setq prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1438 (concat prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1439 (if pmail-search-last-regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1440 (concat ", default "
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1441 pmail-search-last-regexp "): ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1442 "): ")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1443 (setq regexp (read-string prompt))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1444 (cond ((not (equal regexp ""))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1445 (setq pmail-search-last-regexp regexp))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1446 ((not pmail-search-last-regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1447 (error "No previous Pmail search string")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1448 (list pmail-search-last-regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1449 (prefix-numeric-value current-prefix-arg))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1450 ;; Don't use save-excursion because that prevents point from moving
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1451 ;; properly in the summary buffer.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1452 (let ((buffer (current-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1453 (unwind-protect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1454 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1455 (set-buffer pmail-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1456 (pmail-search regexp n))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1457 (set-buffer buffer))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1458
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1459 (defun pmail-summary-toggle-header ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1460 "Show original message header if pruned header currently shown, or vice versa."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1461 (interactive)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1462 (save-window-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1463 (set-buffer pmail-buffer)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1464 (pmail-toggle-header))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1465 ;; Inside save-excursion, some changes to point in the PMAIL buffer are lost.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1466 ;; Set point to point-min in the PMAIL buffer, if it is visible.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1467 (let ((window (get-buffer-window pmail-buffer)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1468 (if window
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1469 ;; Using save-window-excursion would lose the new value of point.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1470 (let ((owin (selected-window)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1471 (unwind-protect
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1472 (progn
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1473 (select-window window)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1474 (goto-char (point-min)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1475 (select-window owin))))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1476
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1477
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1478 (defun pmail-summary-add-label (label)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1479 "Add LABEL to labels associated with current Pmail message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1480 Completion is performed over known labels when reading."
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1481 (interactive (list (save-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1482 (set-buffer pmail-buffer)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1483 (pmail-read-label "Add label"))))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1484 (save-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1485 (set-buffer pmail-buffer)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1486 (pmail-add-label label)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1487
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1488 (defun pmail-summary-kill-label (label)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1489 "Remove LABEL from labels associated with current Pmail message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1490 Completion is performed over known labels when reading."
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1491 (interactive (list (save-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1492 (set-buffer pmail-buffer)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1493 (pmail-read-label "Kill label"))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1494 (save-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1495 (set-buffer pmail-buffer)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1496 (pmail-set-label label nil)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1497
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1498 ;;;; *** Pmail Summary Mailing Commands ***
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1499
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1500 (defun pmail-summary-override-mail-send-and-exit ()
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1501 "Replace bindings to `mail-send-and-exit' with `pmail-summary-send-and-exit'."
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1502 (use-local-map (copy-keymap (current-local-map)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1503 (dolist (key (where-is-internal 'mail-send-and-exit))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1504 (define-key (current-local-map) key 'pmail-summary-send-and-exit)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1505
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1506 (defun pmail-summary-mail ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1507 "Send mail in another window.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1508 While composing the message, use \\[mail-yank-original] to yank the
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1509 original message into it."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1510 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1511 (let ((window (get-buffer-window pmail-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1512 (if window
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1513 (select-window window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1514 (set-buffer pmail-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1515 (pmail-start-mail nil nil nil nil nil (current-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1516 (pmail-summary-override-mail-send-and-exit))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1517
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1518 (defun pmail-summary-continue ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1519 "Continue composing outgoing message previously being composed."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1520 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1521 (let ((window (get-buffer-window pmail-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1522 (if window
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1523 (select-window window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1524 (set-buffer pmail-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1525 (pmail-start-mail t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1526
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1527 (defun pmail-summary-reply (just-sender)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1528 "Reply to the current message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1529 Normally include CC: to all other recipients of original message;
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1530 prefix argument means ignore them. While composing the reply,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1531 use \\[mail-yank-original] to yank the original message into it."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1532 (interactive "P")
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1533 (let ((window (get-buffer-window pmail-buffer)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1534 (if window
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1535 (select-window window)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1536 (set-buffer pmail-buffer)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1537 (pmail-reply just-sender)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1538 (pmail-summary-override-mail-send-and-exit))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1539
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1540 (defun pmail-summary-retry-failure ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1541 "Edit a mail message which is based on the contents of the current message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1542 For a message rejected by the mail system, extract the interesting headers and
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1543 the body of the original message; otherwise copy the current message."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1544 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1545 (let ((window (get-buffer-window pmail-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1546 (if window
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1547 (select-window window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1548 (set-buffer pmail-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1549 (pmail-retry-failure)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1550 (pmail-summary-override-mail-send-and-exit))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1551
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1552 (defun pmail-summary-send-and-exit ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1553 "Send mail reply and return to summary buffer."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1554 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1555 (mail-send-and-exit t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1556
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1557 (defun pmail-summary-forward (resend)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1558 "Forward the current message to another user.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1559 With prefix argument, \"resend\" the message instead of forwarding it;
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1560 see the documentation of `pmail-resend'."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1561 (interactive "P")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1562 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1563 (let ((window (get-buffer-window pmail-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1564 (if window
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1565 (select-window window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1566 (set-buffer pmail-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1567 (pmail-forward resend)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1568 (pmail-summary-override-mail-send-and-exit)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1569
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1570 (defun pmail-summary-resend ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1571 "Resend current message using `pmail-resend'."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1572 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1573 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1574 (let ((window (get-buffer-window pmail-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1575 (if window
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1576 (select-window window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1577 (set-buffer pmail-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1578 (call-interactively 'pmail-resend)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1579
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98019
diff changeset
1580 ;; Summary output commands.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1581
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1582 (defun pmail-summary-output (&optional file-name n)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1583 "Append this message to mail file FILE-NAME.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1584 This works with both mbox format and Babyl format files,
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1585 outputting in the appropriate format for each.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1586 The default file name comes from `pmail-default-file',
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1587 which is updated to the name you use in this command.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1588
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1589 A prefix argument N says to output that many consecutive messages
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1590 from those in the summary, starting with the current one.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1591 Deleted messages are skipped and don't count.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1592 When called from Lisp code, N may be omitted and defaults to 1.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1593
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1594 This command always outputs the complete message header,
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1595 even the header display is currently pruned."
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1596 (interactive
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1597 (progn (require 'pmailout)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1598 (list (pmail-output-read-file-name)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1599 (prefix-numeric-value current-prefix-arg))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1600 (let ((i 0) prev-msg)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1601 (while
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1602 (and (< i n)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1603 (progn (pmail-summary-goto-msg)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1604 (not (eq prev-msg
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1605 (setq prev-msg
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1606 (with-current-buffer pmail-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1607 pmail-current-message))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1608 (setq i (1+ i))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1609 (with-current-buffer pmail-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1610 (let ((pmail-delete-after-output nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1611 (pmail-output file-name 1)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1612 (if pmail-delete-after-output
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1613 (pmail-summary-delete-forward nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1614 (if (< i n)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1615 (pmail-summary-next-msg 1))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1616
101222
490b85e0b4fc (pmail-summary-mode-map, pmail-summary-output-to-pmail-file): Use
Glenn Morris <rgm@gnu.org>
parents: 100965
diff changeset
1617 (defalias 'pmail-summary-output-to-pmail-file 'pmail-summary-output)
490b85e0b4fc (pmail-summary-mode-map, pmail-summary-output-to-pmail-file): Use
Glenn Morris <rgm@gnu.org>
parents: 100965
diff changeset
1618
490b85e0b4fc (pmail-summary-mode-map, pmail-summary-output-to-pmail-file): Use
Glenn Morris <rgm@gnu.org>
parents: 100965
diff changeset
1619 (declare-function pmail-output-as-seen "pmailout"
490b85e0b4fc (pmail-summary-mode-map, pmail-summary-output-to-pmail-file): Use
Glenn Morris <rgm@gnu.org>
parents: 100965
diff changeset
1620 (file-name &optional count noattribute from-gnus))
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1621
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1622 (defun pmail-summary-output-as-seen (&optional file-name n)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1623 "Append this message to system-inbox-format mail file named FILE-NAME.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1624 A prefix argument N says to output that many consecutive messages,
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1625 from the summary, starting with the current one.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1626 Deleted messages are skipped and don't count.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1627 When called from Lisp code, N may be omitted and defaults to 1.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1628
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1629 This outputs the message header as you see it (or would see it)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1630 displayed in Pmail.
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1631
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1632 The default file name comes from `pmail-default-file',
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1633 which is updated to the name you use in this command."
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1634 (interactive
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1635 (progn (require 'pmailout)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1636 (list (pmail-output-read-file-name)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1637 (prefix-numeric-value current-prefix-arg))))
101222
490b85e0b4fc (pmail-summary-mode-map, pmail-summary-output-to-pmail-file): Use
Glenn Morris <rgm@gnu.org>
parents: 100965
diff changeset
1638 (require 'pmailout) ; for pmail-output-as-seen in non-interactive case
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1639 (let ((i 0) prev-msg)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1640 (while
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1641 (and (< i n)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1642 (progn (pmail-summary-goto-msg)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1643 (not (eq prev-msg
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1644 (setq prev-msg
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1645 (with-current-buffer pmail-buffer
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1646 pmail-current-message))))))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1647 (setq i (1+ i))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1648 (with-current-buffer pmail-buffer
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1649 (let ((pmail-delete-after-output nil))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1650 (pmail-output-as-seen file-name 1)))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1651 (if pmail-delete-after-output
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1652 (pmail-summary-delete-forward nil)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1653 (if (< i n)
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1654 (pmail-summary-next-msg 1))))))
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1655
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1656 (defun pmail-summary-output-menu ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1657 "Output current message to another Pmail file, chosen with a menu.
100378
35a95343bc0c All callers to pmail-output-to-pmail-file changed to
Chong Yidong <cyd@stupidchicken.com>
parents: 100291
diff changeset
1658 Also set the default for subsequent \\[pmail-output-to-babyl-file] commands.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1659 The variables `pmail-secondary-file-directory' and
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1660 `pmail-secondary-file-regexp' control which files are offered in the menu."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1661 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1662 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1663 (set-buffer pmail-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1664 (let ((pmail-delete-after-output nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1665 (call-interactively 'pmail-output-menu)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1666 (if pmail-delete-after-output
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1667 (pmail-summary-delete-forward nil)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1668
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1669 (defun pmail-summary-construct-io-menu ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1670 (let ((files (pmail-find-all-files pmail-secondary-file-directory)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1671 (if files
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1672 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1673 (define-key pmail-summary-mode-map [menu-bar classify input-menu]
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1674 (cons "Input Pmail File"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1675 (pmail-list-to-menu "Input Pmail File"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1676 files
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1677 'pmail-summary-input)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1678 (define-key pmail-summary-mode-map [menu-bar classify output-menu]
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1679 (cons "Output Pmail File"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1680 (pmail-list-to-menu "Output Pmail File"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1681 files
100911
21becd9cb5d4 (pmail-message-labels-p): Function moved from pmail.el and rewritten.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1682 'pmail-summary-output))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1683 (define-key pmail-summary-mode-map [menu-bar classify input-menu]
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1684 '("Input Pmail File" . pmail-disable-menu))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1685 (define-key pmail-summary-mode-map [menu-bar classify output-menu]
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1686 '("Output Pmail File" . pmail-disable-menu)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1687
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1688 (defun pmail-summary-output-body (&optional file-name)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1689 "Write this message body to the file FILE-NAME.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1690 FILE-NAME defaults, interactively, from the Subject field of the message."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1691 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1692 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1693 (set-buffer pmail-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1694 (let ((pmail-delete-after-output nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1695 (if file-name
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1696 (pmail-output-body-to-file file-name)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1697 (call-interactively 'pmail-output-body-to-file))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1698 (if pmail-delete-after-output
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1699 (pmail-summary-delete-forward nil)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1700
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1701 ;; Sorting messages in Pmail Summary buffer.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1702
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1703 (defun pmail-summary-sort-by-date (reverse)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1704 "Sort messages of current Pmail summary by date.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1705 If prefix argument REVERSE is non-nil, sort them in reverse order."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1706 (interactive "P")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1707 (pmail-sort-from-summary (function pmail-sort-by-date) reverse))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1708
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1709 (defun pmail-summary-sort-by-subject (reverse)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1710 "Sort messages of current Pmail summary by subject.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1711 If prefix argument REVERSE is non-nil, sort them in reverse order."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1712 (interactive "P")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1713 (pmail-sort-from-summary (function pmail-sort-by-subject) reverse))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1714
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1715 (defun pmail-summary-sort-by-author (reverse)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1716 "Sort messages of current Pmail summary by author.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1717 If prefix argument REVERSE is non-nil, sort them in reverse order."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1718 (interactive "P")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1719 (pmail-sort-from-summary (function pmail-sort-by-author) reverse))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1720
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1721 (defun pmail-summary-sort-by-recipient (reverse)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1722 "Sort messages of current Pmail summary by recipient.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1723 If prefix argument REVERSE is non-nil, sort them in reverse order."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1724 (interactive "P")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1725 (pmail-sort-from-summary (function pmail-sort-by-recipient) reverse))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1726
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1727 (defun pmail-summary-sort-by-correspondent (reverse)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1728 "Sort messages of current Pmail summary by other correspondent.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1729 If prefix argument REVERSE is non-nil, sort them in reverse order."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1730 (interactive "P")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1731 (pmail-sort-from-summary (function pmail-sort-by-correspondent) reverse))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1732
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1733 (defun pmail-summary-sort-by-lines (reverse)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1734 "Sort messages of current Pmail summary by lines of the message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1735 If prefix argument REVERSE is non-nil, sort them in reverse order."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1736 (interactive "P")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1737 (pmail-sort-from-summary (function pmail-sort-by-lines) reverse))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1738
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1739 (defun pmail-summary-sort-by-labels (reverse labels)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1740 "Sort messages of current Pmail summary by labels.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1741 If prefix argument REVERSE is non-nil, sort them in reverse order.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1742 KEYWORDS is a comma-separated list of labels."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1743 (interactive "P\nsSort by labels: ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1744 (pmail-sort-from-summary
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1745 (function (lambda (reverse)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1746 (pmail-sort-by-labels reverse labels)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1747 reverse))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1748
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1749 (defun pmail-sort-from-summary (sortfun reverse)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1750 "Sort Pmail messages from Summary buffer and update it after sorting."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1751 (require 'pmailsort)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1752 (let ((selwin (selected-window)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1753 (unwind-protect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1754 (progn (pop-to-buffer pmail-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1755 (funcall sortfun reverse))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1756 (select-window selwin))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1757
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1758 (provide 'pmailsum)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1759
100655
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
1760 ;; Local Variables:
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
1761 ;; change-log-default-name: "ChangeLog.pmail"
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
1762 ;; End:
4f54978ec0c5 (pmail-message-subject-p): Mark as broken.
Richard M. Stallman <rms@gnu.org>
parents: 100378
diff changeset
1763
97533
ec1125c7ac26 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 97532
diff changeset
1764 ;; arch-tag: 80b0a27a-a50d-4f37-9466-83d32d1e0ca8
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1765 ;;; pmailsum.el ends here