annotate lisp/mail/pmail.el @ 101366:05175041ba3a

(pmail-buffer-swapped): Mark as permanent local.
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 23 Jan 2009 02:33:43 +0000
parents 235db5e6b83d
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 ;;; pmail.el --- main code of "PMAIL" mail reader for Emacs
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, 1986, 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998,
100908
a9dc0e7c3f2b Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 100800
diff changeset
4 ;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
5 ;; 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
6
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
7 ;; Maintainer: FSF
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
8 ;; Keywords: mail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
9
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
10 ;; 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
11
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
12 ;; 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
13 ;; 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
14 ;; 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
15 ;; (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
16
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
17 ;; 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
18 ;; 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
19 ;; 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
20 ;; 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
21
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
22 ;; 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
23 ;; 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
24
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
25 ;;; Commentary:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
26
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
27 ;;; Code:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
28
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
29 ;; Souped up by shane@mit-ajax based on ideas of rlk@athena.mit.edu
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
30 ;; New features include attribute and keyword support, message
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
31 ;; selection by dispatch table, summary by attributes and keywords,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
32 ;; expunging by dispatch table, sticky options for file commands.
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 ;; 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
35 ;; New features include: pmail and pmail-summary buffers remain
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
36 ;; synchronized and key bindings basically operate the same way in both
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
37 ;; buffers, summary by topic or by regular expression, pmail-reply-prefix
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
38 ;; variable, and a bury pmail buffer (wipe) command.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
39 ;;
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
40
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
41 (require 'mail-utils)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
42 (eval-when-compile (require 'mule-util)) ; for detect-coding-with-priority
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
43
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
44 (defconst pmail-attribute-header "X-RMAIL-ATTRIBUTES"
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
45 "The header that stores the Pmail attribute data.")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
46
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
47 (defconst pmail-keyword-header "X-RMAIL-KEYWORDS"
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
48 "The header that stores the Pmail keyword data.")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
49
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
50 ;;; Attribute indexes
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
51
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
52 (defconst pmail-answered-attr-index 0
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
53 "The index for the `answered' attribute.")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
54
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
55 (defconst pmail-deleted-attr-index 1
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
56 "The index for the `deleted' attribute.")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
57
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
58 (defconst pmail-edited-attr-index 2
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
59 "The index for the `edited' attribute.")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
60
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
61 (defconst pmail-filed-attr-index 3
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
62 "The index for the `filed' attribute.")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
63
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
64 (defconst pmail-retried-attr-index 4
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
65 "The index for the `retried' attribute.")
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
66
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
67 (defconst pmail-forwarded-attr-index 5
100756
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
68 "The index for the `forwarded' attribute.")
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
69
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
70 (defconst pmail-unseen-attr-index 6
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
71 "The index for the `unseen' attribute.")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
72
100756
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
73 (defconst pmail-resent-attr-index 6
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
74 "The index for the `resent' attribute.")
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
75
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
76 (defconst pmail-attr-array
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
77 '[(?A "answered")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
78 (?D "deleted")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
79 (?E "edited")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
80 (?F "filed")
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
81 (?R "retried")
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
82 (?S "forwarded")
100756
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
83 (?U "unseen")
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
84 (?r "resent")]
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
85 "An array that provides a mapping between an attribute index,
100584
af07ce58a8d5 (pmail-add-header): Function deleted.
Chong Yidong <cyd@stupidchicken.com>
parents: 100581
diff changeset
86 its character representation and its display representation.")
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
87
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
88 (defvar deleted-head)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
89 (defvar font-lock-fontified)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
90 (defvar mail-abbrev-syntax-table)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
91 (defvar mail-abbrevs)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
92 (defvar messages-head)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
93 (defvar pmail-use-spam-filter)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
94 (defvar rsf-beep)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
95 (defvar rsf-sleep-after-message)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
96 (defvar total-messages)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
97 (defvar tool-bar-map)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
98
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
99 (defvar pmail-header-style 'normal
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
100 "The current header display style choice, one of
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
101 'normal (selected headers) or 'full (all headers).")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
102
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
103 ; These variables now declared in paths.el.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
104 ;(defvar pmail-spool-directory "/usr/spool/mail/"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
105 ; "This is the name of the directory used by the system mailer for\n\
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
106 ;delivering new mail. Its name should end with a slash.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
107 ;(defvar pmail-file-name
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
108 ; (expand-file-name "~/PMAIL")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
109 ; "")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
110
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
111 ;; Temporary support for mbox.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
112 (defcustom pmail-file-name "~/PMAIL"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
113 "*Name of user's primary mail file."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
114 :type 'string
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
115 :group 'rmail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
116 :version "21.1")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
117
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
118 (defgroup pmail nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
119 "Mail reader for Emacs."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
120 :group 'mail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
121
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
122 (defgroup pmail-retrieve nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
123 "Pmail retrieval options."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
124 :prefix "pmail-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
125 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
126
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
127 (defgroup pmail-files nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
128 "Pmail files."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
129 :prefix "pmail-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
130 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
131
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
132 (defgroup pmail-headers nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
133 "Pmail header options."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
134 :prefix "pmail-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
135 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
136
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
137 (defgroup pmail-reply nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
138 "Pmail reply options."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
139 :prefix "pmail-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
140 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
141
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
142 (defgroup pmail-summary nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
143 "Pmail summary options."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
144 :prefix "pmail-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
145 :prefix "pmail-summary-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
146 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
147
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
148 (defgroup pmail-output nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
149 "Output message to a file."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
150 :prefix "pmail-output-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
151 :prefix "pmail-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
152 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
153
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
154 (defgroup pmail-edit nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
155 "Pmail editing."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
156 :prefix "pmail-edit-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
157 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
158
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
159 (defgroup pmail-obsolete nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
160 "Pmail obsolete customization variables."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
161 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
162
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
163 (defcustom pmail-movemail-program nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
164 "If non-nil, the file name of the `movemail' program."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
165 :group 'pmail-retrieve
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
166 :type '(choice (const nil) string))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
167
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
168 (defcustom pmail-pop-password nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
169 "*Password to use when reading mail from POP server.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
170 Please use `pmail-remote-password' instead."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
171 :type '(choice (string :tag "Password")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
172 (const :tag "Not Required" nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
173 :group 'pmail-obsolete)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
174
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
175 (defcustom pmail-pop-password-required nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
176 "*Non-nil if a password is required when reading mail from a POP server.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
177 Please use pmail-remote-password-required instead."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
178 :type 'boolean
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
179 :group 'pmail-obsolete)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
180
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
181 (defcustom pmail-remote-password nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
182 "*Password to use when reading mail from a remote server.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
183 This setting is ignored for mailboxes whose URL already contains a password."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
184 :type '(choice (string :tag "Password")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
185 (const :tag "Not Required" nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
186 :set-after '(pmail-pop-password)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
187 :set #'(lambda (symbol value)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
188 (set-default symbol
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
189 (if (and (not value)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
190 (boundp 'pmail-pop-password)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
191 pmail-pop-password)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
192 pmail-pop-password
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
193 value))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
194 (setq pmail-pop-password nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
195 :group 'pmail-retrieve
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
196 :version "22.1")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
197
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
198 (defcustom pmail-remote-password-required nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
199 "*Non-nil if a password is required when reading mail from a remote server."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
200 :type 'boolean
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
201 :set-after '(pmail-pop-password-required)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
202 :set #'(lambda (symbol value)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
203 (set-default symbol
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
204 (if (and (not value)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
205 (boundp 'pmail-pop-password-required)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
206 pmail-pop-password-required)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
207 pmail-pop-password-required
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
208 value))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
209 (setq pmail-pop-password-required nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
210 :group 'pmail-retrieve
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
211 :version "22.1")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
212
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
213 (defcustom pmail-movemail-flags nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
214 "*List of flags to pass to movemail.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
215 Most commonly used to specify `-g' to enable GSS-API authentication
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
216 or `-k' to enable Kerberos authentication."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
217 :type '(repeat string)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
218 :group 'pmail-retrieve
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
219 :version "20.3")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
220
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
221 (defvar pmail-remote-password-error "invalid usercode or password\\|
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
222 unknown user name or bad password\\|Authentication failed\\|MU_ERR_AUTH_FAILURE"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
223 "Regular expression matching incorrect-password POP or IMAP server error
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
224 messages.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
225 If you get an incorrect-password error that this expression does not match,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
226 please report it with \\[report-emacs-bug].")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
227
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
228 (defvar pmail-encoded-remote-password nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
229
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
230 (defcustom pmail-preserve-inbox nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
231 "*Non-nil means leave incoming mail in the user's inbox--don't delete it."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
232 :type 'boolean
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
233 :group 'pmail-retrieve)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
234
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
235 (defcustom pmail-movemail-search-path nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
236 "*List of directories to search for movemail (in addition to `exec-path')."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
237 :group 'pmail-retrieve
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
238 :type '(repeat (directory)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
239
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
240 (declare-function mail-position-on-field "sendmail" (field &optional soft))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
241 (declare-function mail-text-start "sendmail" ())
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
242 (declare-function rmail-dont-reply-to "mail-utils" (destinations))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
243 (declare-function pmail-update-summary "pmailsum" (&rest ignore))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
244
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
245 (defun pmail-probe (prog)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
246 "Determine what flavor of movemail PROG is.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
247 We do this by executing it with `--version' and analyzing its output."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
248 (with-temp-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
249 (let ((tbuf (current-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
250 (buffer-disable-undo tbuf)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
251 (call-process prog nil tbuf nil "--version")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
252 (if (not (buffer-modified-p tbuf))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
253 ;; Should not happen...
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
254 nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
255 (goto-char (point-min))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
256 (cond
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
257 ((looking-at ".*movemail: invalid option")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
258 'emacs) ;; Possibly...
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
259 ((looking-at "movemail (GNU Mailutils .*)")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
260 'mailutils)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
261 (t
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
262 ;; FIXME:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
263 'emacs))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
264
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
265 (defun pmail-autodetect ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
266 "Determine the file name of the `movemail' program and return its flavor.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
267 If `pmail-movemail-program' is non-nil, use it.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
268 Otherwise, look for `movemail' in the directories in
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
269 `pmail-movemail-search-path', those in `exec-path', and `exec-directory'."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
270 (if pmail-movemail-program
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
271 (pmail-probe pmail-movemail-program)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
272 (catch 'scan
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
273 (dolist (dir (append pmail-movemail-search-path exec-path
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
274 (list exec-directory)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
275 (when (and dir (file-accessible-directory-p dir))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
276 ;; Previously, this didn't have to work on Windows, because
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
277 ;; pmail-insert-inbox-text before r1.439 fell back to using
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
278 ;; (expand-file-name "movemail" exec-directory) and just
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
279 ;; assuming it would work.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
280 ;; http://lists.gnu.org/archive/html/bug-gnu-emacs/2008-02/msg00087.html
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
281 (let ((progname (expand-file-name
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
282 (concat "movemail"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
283 (if (memq system-type '(ms-dos windows-nt))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
284 ".exe")) dir)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
285 (when (and (not (file-directory-p progname))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
286 (file-executable-p progname))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
287 (let ((x (pmail-probe progname)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
288 (when x
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
289 (setq pmail-movemail-program progname)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
290 (throw 'scan x))))))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
291
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
292 (defvar pmail-movemail-variant-in-use nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
293 "The movemail variant currently in use. Known variants are:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
294
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
295 `emacs' Means any implementation, compatible with the native Emacs one.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
296 This is the default;
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
297 `mailutils' Means GNU mailutils implementation, capable of handling full
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
298 mail URLs as the source mailbox.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
299
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
300 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
301 (defun pmail-movemail-variant-p (&rest variants)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
302 "Return t if the current movemail variant is any of VARIANTS.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
303 Currently known variants are 'emacs and 'mailutils."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
304 (when (not pmail-movemail-variant-in-use)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
305 ;; Autodetect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
306 (setq pmail-movemail-variant-in-use (pmail-autodetect)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
307 (not (null (member pmail-movemail-variant-in-use variants))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
308
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
309 ;; Call for effect, to set pmail-movemail-program (if not set by the
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
310 ;; user), and pmail-movemail-variant-in-use. Used by various functions.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
311 ;; I'm not sure if M-x pmail is the only entry point to this package.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
312 ;; If so, this can be moved there.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
313 (pmail-movemail-variant-p)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
314
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
315 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
316 (defcustom pmail-dont-reply-to-names nil "\
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
317 *A regexp specifying addresses to prune from a reply message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
318 A value of nil means exclude your own email address as an address
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
319 plus whatever is specified by `pmail-default-dont-reply-to-names'."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
320 :type '(choice regexp (const :tag "Your Name" nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
321 :group 'pmail-reply)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
322
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
323 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
324 (defvar pmail-default-dont-reply-to-names "\\`info-" "\
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
325 A regular expression specifying part of the default value of the
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
326 variable `pmail-dont-reply-to-names', for when the user does not set
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
327 `pmail-dont-reply-to-names' explicitly. (The other part of the default
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
328 value is the user's email address and name.)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
329 It is useful to set this variable in the site customization file.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
330
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
331 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
332 (defcustom pmail-ignored-headers
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
333 (concat "^via:\\|^mail-from:\\|^origin:\\|^references:\\|^sender:"
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
334 "\\|^status:\\|^received:\\|^x400-originator:\\|^x400-recipients:"
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
335 "\\|^x400-received:\\|^x400-mts-identifier:\\|^x400-content-type:"
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
336 "\\|^\\(resent-\\|\\)message-id:\\|^summary-line:\\|^resent-date:"
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
337 "\\|^nntp-posting-host:\\|^path:\\|^x-char.*:\\|^x-face:\\|^face:"
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
338 "\\|^x-mailer:\\|^delivered-to:\\|^lines:"
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
339 "\\|^content-transfer-encoding:\\|^x-coding-system:"
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
340 "\\|^return-path:\\|^errors-to:\\|^return-receipt-to:"
101074
cc1abbe3dfe5 (pmail-ignored-headers): Hide more fields.
Richard M. Stallman <rms@gnu.org>
parents: 100913
diff changeset
341 "\\|^precedence:\\|^mime-version:"
cc1abbe3dfe5 (pmail-ignored-headers): Hide more fields.
Richard M. Stallman <rms@gnu.org>
parents: 100913
diff changeset
342 "\\|^list-owner:\\|^list-help:\\|^list-post:\\|^list-subscribe:"
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
343 "\\|^list-id:\\|^list-unsubscribe:\\|^list-archive:"
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
344 "\\|^content-length:\\|^nntp-posting-date:\\|^user-agent"
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
345 "\\|^importance:\\|^envelope-to:\\|^delivery-date\\|^openpgp:"
101074
cc1abbe3dfe5 (pmail-ignored-headers): Hide more fields.
Richard M. Stallman <rms@gnu.org>
parents: 100913
diff changeset
346 "\\|^mbox-line:\\|^cancel-lock:"
cc1abbe3dfe5 (pmail-ignored-headers): Hide more fields.
Richard M. Stallman <rms@gnu.org>
parents: 100913
diff changeset
347 "\\|^DomainKey-Signature:\\|^dkim-signature:"
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
348 "\\|^resent-face:\\|^resent-x.*:\\|^resent-organization:\\|^resent-openpgp:"
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
349 "\\|^x-.*:")
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
350 "*Regexp to match header fields that Pmail should normally hide.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
351 \(See also `pmail-nonignored-headers', which overrides this regexp.)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
352 This variable is used for reformatting the message header,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
353 which normally happens once for each message,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
354 when you view the message for the first time in Pmail.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
355 To make a change in this variable take effect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
356 for a message that you have already viewed,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
357 go to that message and type \\[pmail-toggle-header] twice."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
358 :type 'regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
359 :group 'pmail-headers)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
360
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
361 (defcustom pmail-nonignored-headers "^x-spam-status:"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
362 "*Regexp to match X header fields that Pmail should show.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
363 This regexp overrides `pmail-ignored-headers'; if both this regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
364 and that one match a certain header field, Pmail shows the field.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
365 If this is nil, ignore all header fields in `pmail-ignored-headers'.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
366
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
367 This variable is used for reformatting the message header,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
368 which normally happens once for each message,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
369 when you view the message for the first time in Pmail.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
370 To make a change in this variable take effect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
371 for a message that you have already viewed,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
372 go to that message and type \\[pmail-toggle-header] twice."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
373 :type '(choice (const nil) (regexp))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
374 :group 'pmail-headers)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
375
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
376 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
377 (defcustom pmail-displayed-headers nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
378 "*Regexp to match Header fields that Pmail should display.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
379 If nil, display all header fields except those matched by
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
380 `pmail-ignored-headers'."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
381 :type '(choice regexp (const :tag "All"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
382 :group 'pmail-headers)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
383
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
384 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
385 (defcustom pmail-retry-ignored-headers "^x-authentication-warning:" "\
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
386 *Headers that should be stripped when retrying a failed message."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
387 :type '(choice regexp (const nil :tag "None"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
388 :group 'pmail-headers)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
389
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
390 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
391 (defcustom pmail-highlighted-headers "^From:\\|^Subject:" "\
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
392 *Regexp to match Header fields that Pmail should normally highlight.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
393 A value of nil means don't highlight."
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
394 :type 'regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
395 :group 'pmail-headers)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
396
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
397 (defface pmail-highlight
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
398 '((t (:inherit highlight)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
399 "Face to use for highlighting the most important header fields."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
400 :group 'pmail-headers
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
401 :version "22.1")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
402
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
403 (defface pmail-header-name
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
404 '((t (:inherit font-lock-function-name-face)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
405 "Face to use for highlighting the header names."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
406 :group 'pmail-headers
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
407 :version "23.1")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
408
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
409 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
410 (defcustom 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
411 *Non-nil means automatically delete a message that is copied to a file."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
412 :type 'boolean
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
413 :group 'pmail-files)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
414
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
415 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
416 (defcustom pmail-primary-inbox-list nil "\
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
417 *List of files which are inboxes for user's primary mail file `~/PMAIL'.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
418 nil means the default, which is (\"/usr/spool/mail/$USER\")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
419 \(the name varies depending on the operating system,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
420 and the value of the environment variable MAIL overrides it)."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
421 ;; Don't use backquote here, because we don't want to need it
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
422 ;; at load time.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
423 :type (list 'choice '(const :tag "Default" nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
424 (list 'repeat ':value (list (or (getenv "MAIL")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
425 (concat "/var/spool/mail/"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
426 (getenv "USER"))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
427 'file))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
428 :group 'pmail-retrieve
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
429 :group 'pmail-files)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
430
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
431 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
432 (defcustom pmail-mail-new-frame nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
433 "*Non-nil means Pmail makes a new frame for composing outgoing mail.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
434 This is handy if you want to preserve the window configuration of
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
435 the frame where you have the PMAIL buffer displayed."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
436 :type 'boolean
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
437 :group 'pmail-reply)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
438
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
439 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
440 (defcustom 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
441 "*Directory for additional secondary Pmail files."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
442 :type 'directory
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
443 :group 'pmail-files)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
444 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
445 (defcustom pmail-secondary-file-regexp "\\.xmail$"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
446 "*Regexp for which files are secondary Pmail files."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
447 :type 'regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
448 :group 'pmail-files)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
449
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
450 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
451 (defcustom pmail-confirm-expunge 'y-or-n-p
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
452 "*Whether and how to ask for confirmation before expunging deleted messages."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
453 :type '(choice (const :tag "No confirmation" nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
454 (const :tag "Confirm with y-or-n-p" y-or-n-p)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
455 (const :tag "Confirm with yes-or-no-p" yes-or-no-p))
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 :group 'pmail-files)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
458
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
459 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
460 (defvar pmail-mode-hook nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
461 "List of functions to call when Pmail is invoked.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
462
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
463 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
464 (defvar pmail-get-new-mail-hook nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
465 "List of functions to call when Pmail has retrieved new mail.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
466
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
467 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
468 (defcustom pmail-show-message-hook nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
469 "List of functions to call when Pmail displays a message."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
470 :type 'hook
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
471 :options '(goto-address)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
472 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
473
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
474 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
475 (defvar pmail-quit-hook nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
476 "List of functions to call when quitting out of Pmail.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
477
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
478 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
479 (defvar pmail-delete-message-hook nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
480 "List of functions to call when Pmail deletes a message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
481 When the hooks are called, the message has been marked deleted but is
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
482 still the current message 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
483
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
484 ;; These may be altered by site-init.el to match the format of mmdf files
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
485 ;; delimiting used on a given host (delim1 and delim2 from the config
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
486 ;; files).
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
487
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
488 (defvar pmail-mmdf-delim1 "^\001\001\001\001\n"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
489 "Regexp marking the start of an mmdf message.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
490 (defvar pmail-mmdf-delim2 "^\001\001\001\001\n"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
491 "Regexp marking the end of an mmdf message.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
492
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
493 (defcustom pmail-message-filter nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
494 "If non-nil, a filter function for new messages in PMAIL.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
495 Called with region narrowed to the message, including headers,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
496 before obeying `pmail-ignored-headers'."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
497 :group 'pmail-headers
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
498 :type '(choice (const nil) function))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
499
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
500 (defcustom pmail-automatic-folder-directives nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
501 "List of directives specifying where to put a message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
502 Each element of the list is of the form:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
503
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
504 (FOLDERNAME FIELD REGEXP [ FIELD REGEXP ] ... )
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
505
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
506 Where FOLDERNAME is the name of a BABYL format folder to put the
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
507 message. If any of the field regexp's are nil, then it is ignored.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
508
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
509 If FOLDERNAME is \"/dev/null\", it is deleted.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
510 If FOLDERNAME is nil then it is deleted, and skipped.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
511
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
512 FIELD is the plain text name of a field in the message, such as
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
513 \"subject\" or \"from\". A FIELD of \"to\" will automatically include
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
514 all text from the \"cc\" field as well.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
515
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
516 REGEXP is an expression to match in the preceeding specified FIELD.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
517 FIELD/REGEXP pairs continue in the list.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
518
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
519 examples:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
520 (\"/dev/null\" \"from\" \"@spam.com\") ; delete all mail from spam.com
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
521 (\"RMS\" \"from\" \"rms@\") ; save all mail from RMS."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
522 :group 'pmail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
523 :version "21.1"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
524 :type '(repeat (sexp :tag "Directive")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
525
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
526 (defvar pmail-reply-prefix "Re: "
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
527 "String to prepend to Subject line when replying to a message.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
529 ;; Some mailers use "Re(2):" or "Re^2:" or "Re: Re:" or "Re[2]:".
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
530 ;; This pattern should catch all the common variants.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
531 ;; rms: I deleted the change to delete tags in square brackets
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
532 ;; because they mess up RT tags.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
533 (defvar pmail-reply-regexp "\\`\\(Re\\(([0-9]+)\\|\\[[0-9]+\\]\\|\\^[0-9]+\\)?: *\\)*"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
534 "Regexp to delete from Subject line before inserting `pmail-reply-prefix'.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
535
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
536 (defcustom pmail-display-summary nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
537 "*If non-nil, Pmail always displays the summary buffer."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
538 :group 'pmail-summary
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
539 :type 'boolean)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
540
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
541 (defvar pmail-inbox-list nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
542 (put 'pmail-inbox-list 'permanent-local t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
543
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
544 (defvar pmail-buffer nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
545 "The PMAIL buffer related to the current buffer.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
546 In an PMAIL buffer, this holds the PMAIL buffer itself.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
547 In a summary buffer, this holds the PMAIL buffer it is a summary for.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
548 (put 'pmail-buffer 'permanent-local t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
549
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
550 ;; Message counters and markers. Deleted flags.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
551
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
552 (defvar 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
553 (put 'pmail-current-message 'permanent-local t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
554
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
555 (defvar pmail-total-messages nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
556 (put 'pmail-total-messages 'permanent-local t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
557
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
558 (defvar pmail-message-vector nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
559 (put 'pmail-message-vector 'permanent-local t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
560
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
561 (defvar pmail-deleted-vector nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
562 (put 'pmail-deleted-vector 'permanent-local t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
563
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
564 (defvar pmail-msgref-vector nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
565 "In an Pmail buffer, a vector whose Nth element is a list (N).
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
566 When expunging renumbers messages, these lists are modified
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
567 by substituting the new message number into the existing list.")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
568 (put 'pmail-msgref-vector 'permanent-local t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
569
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
570 (defvar pmail-overlay-list nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
571 (put 'pmail-overlay-list 'permanent-local t)
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 ;; These are used by autoloaded pmail-summary.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
574
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
575 (defvar pmail-summary-buffer nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
576 (put 'pmail-summary-buffer 'permanent-local t)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
577 (defvar pmail-summary-vector nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
578 (put 'pmail-summary-vector 'permanent-local t)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
579
101341
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
580 ;; Pmail buffer swapping variables.
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
581
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
582 (defvar pmail-buffer-swapped nil
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
583 "If non-nil, `pmail-buffer' is swapped with `pmail-view-buffer'.")
101366
05175041ba3a (pmail-buffer-swapped): Mark as permanent local.
Chong Yidong <cyd@stupidchicken.com>
parents: 101341
diff changeset
584 (put 'pmail-buffer-swapped 'permanent-local t)
101341
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
585
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
586 (defvar pmail-view-buffer nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
587 "Buffer which holds PMAIL message for MIME displaying.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
588 (put 'pmail-view-buffer 'permanent-local t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
589
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
590 ;; `Sticky' default variables.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
591
101302
f91a3fe4adb9 (pmail-last-label, pmail-last-multi-labels):
Glenn Morris <rgm@gnu.org>
parents: 101256
diff changeset
592 ;; Last individual label specified to a or k.
f91a3fe4adb9 (pmail-last-label, pmail-last-multi-labels):
Glenn Morris <rgm@gnu.org>
parents: 101256
diff changeset
593 (defvar pmail-last-label nil)
f91a3fe4adb9 (pmail-last-label, pmail-last-multi-labels):
Glenn Morris <rgm@gnu.org>
parents: 101256
diff changeset
594
f91a3fe4adb9 (pmail-last-label, pmail-last-multi-labels):
Glenn Morris <rgm@gnu.org>
parents: 101256
diff changeset
595 ;; Last set of values specified to C-M-n, C-M-p, C-M-s or C-M-l.
f91a3fe4adb9 (pmail-last-label, pmail-last-multi-labels):
Glenn Morris <rgm@gnu.org>
parents: 101256
diff changeset
596 (defvar pmail-last-multi-labels nil)
f91a3fe4adb9 (pmail-last-label, pmail-last-multi-labels):
Glenn Morris <rgm@gnu.org>
parents: 101256
diff changeset
597
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
598 (defvar pmail-last-regexp nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
599 (put 'pmail-last-regexp 'permanent-local t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
600
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
601 (defcustom pmail-default-file "~/xmail"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
602 "*Default file name for \\[pmail-output]."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
603 :type 'file
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
604 :group 'pmail-files)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
605 (defcustom pmail-default-body-file "~/mailout"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
606 "*Default file name for \\[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
607 :type 'file
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
608 :group 'pmail-files
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
609 :version "20.3")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
610
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
611 ;; Mule and MIME related variables.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
612
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
613 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
614 (defvar pmail-file-coding-system nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
615 "Coding system used in PMAIL file.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
616
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
617 This is set to nil by default.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
618
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
619 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
620 (defcustom pmail-enable-mime nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
621 "*If non-nil, PMAIL uses MIME feature.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
622 If the value is t, PMAIL automatically shows MIME decoded message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
623 If the value is neither t nor nil, PMAIL does not show MIME decoded message
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
624 until a user explicitly requires it.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
625
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
626 Even if the value is non-nil, you can't use MIME feature
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
627 if the feature specified by `pmail-mime-feature' is not available
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
628 in your session."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
629 :type '(choice (const :tag "on" t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
630 (const :tag "off" nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
631 (other :tag "when asked" ask))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
632 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
633
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
634 (defvar pmail-enable-mime-composing nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
635 "*If non-nil, PMAIL uses `pmail-insert-mime-forwarded-message-function' to forward.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
636
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
637 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
638 (defvar pmail-show-mime-function nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
639 "Function to show MIME decoded message of PMAIL file.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
640 This function is called when `pmail-enable-mime' is non-nil.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
641 It is called with no argument.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
642
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
643 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
644 (defvar pmail-insert-mime-forwarded-message-function nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
645 "Function to insert a message in MIME format so it can be forwarded.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
646 This function is called if `pmail-enable-mime' or
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
647 `pmail-enable-mime-composing' is non-nil.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
648 It is called with one argument FORWARD-BUFFER, which is a
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
649 buffer containing the message to forward. The current buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
650 is the outgoing mail buffer.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
651
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
652 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
653 (defvar pmail-insert-mime-resent-message-function nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
654 "Function to insert a message in MIME format so it can be resent.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
655 This function is called if `pmail-enable-mime' is non-nil.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
656 It is called with one argument FORWARD-BUFFER, which is a
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
657 buffer containing the message to forward. The current buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
658 is the outgoing mail buffer.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
659
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
660 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
661 (defvar pmail-search-mime-message-function nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
662 "Function to check if a regexp matches a MIME message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
663 This function is called if `pmail-enable-mime' is non-nil.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
664 It is called with two arguments MSG and REGEXP, where
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
665 MSG is the message number, REGEXP is the regular expression.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
666
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
667 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
668 (defvar pmail-search-mime-header-function nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
669 "Function to check if a regexp matches a header of MIME message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
670 This function is called if `pmail-enable-mime' is non-nil.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
671 It is called with three arguments MSG, REGEXP, and LIMIT, where
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
672 MSG is the message number,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
673 REGEXP is the regular expression,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
674 LIMIT is the position specifying the end of header.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
675
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
676 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
677 (defvar pmail-mime-feature 'pmail-mime
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
678 "Feature to require to load MIME support in Pmail.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
679 When starting Pmail, if `pmail-enable-mime' is non-nil,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
680 this feature is required with `require'.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
681
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
682 The default value is `pmail-mime'. This feature is provided by
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
683 the pmail-mime package available at <http://www.m17n.org/pmail-mime/>.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
684
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
685 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
686 (defvar pmail-decode-mime-charset t
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
687 "*Non-nil means a message is decoded by MIME's charset specification.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
688 If this variable is nil, or the message has not MIME specification,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
689 the message is decoded as normal way.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
690
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
691 If the variable `pmail-enable-mime' is non-nil, this variables is
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
692 ignored, and all the decoding work is done by a feature specified by
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
693 the variable `pmail-mime-feature'.")
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 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
696 (defvar pmail-mime-charset-pattern
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
697 (concat "^content-type:[ \t]*text/plain;"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
698 "\\(?:[ \t\n]*\\(?:format\\|delsp\\)=\"?[-a-z0-9]+\"?;\\)*"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
699 "[ \t\n]*charset=\"?\\([^ \t\n\";]+\\)\"?")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
700 "Regexp to match MIME-charset specification in a header of message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
701 The first parenthesized expression should match the MIME-charset name.")
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
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
704 ;;; Regexp matching the delimiter of messages in UNIX mail format
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
705 ;;; (UNIX From lines), minus the initial ^. Note that if you change
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
706 ;;; this expression, you must change the code in pmail-nuke-pinhead-header
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
707 ;;; that knows the exact ordering of the \\( \\) subexpressions.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
708 (defvar pmail-unix-mail-delimiter
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
709 (let ((time-zone-regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
710 (concat "\\([A-Z]?[A-Z]?[A-Z][A-Z]\\( DST\\)?"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
711 "\\|[-+]?[0-9][0-9][0-9][0-9]"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
712 "\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
713 "\\) *")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
714 (concat
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
715 "From "
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
716
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
717 ;; Many things can happen to an RFC 822 mailbox before it is put into
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
718 ;; a `From' line. The leading phrase can be stripped, e.g.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
719 ;; `Joe <@w.x:joe@y.z>' -> `<@w.x:joe@y.z>'. The <> can be stripped, e.g.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
720 ;; `<@x.y:joe@y.z>' -> `@x.y:joe@y.z'. Everything starting with a CRLF
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
721 ;; can be removed, e.g.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
722 ;; From: joe@y.z (Joe K
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
723 ;; User)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
724 ;; can yield `From joe@y.z (Joe K Fri Mar 22 08:11:15 1996', and
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
725 ;; From: Joe User
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
726 ;; <joe@y.z>
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
727 ;; can yield `From Joe User Fri Mar 22 08:11:15 1996'.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
728 ;; The mailbox can be removed or be replaced by white space, e.g.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
729 ;; From: "Joe User"{space}{tab}
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
730 ;; <joe@y.z>
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
731 ;; can yield `From {space}{tab} Fri Mar 22 08:11:15 1996',
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
732 ;; where {space} and {tab} represent the Ascii space and tab characters.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
733 ;; We want to match the results of any of these manglings.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
734 ;; The following regexp rejects names whose first characters are
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
735 ;; obviously bogus, but after that anything goes.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
736 "\\([^\0-\b\n-\r\^?].*\\)? "
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
737
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
738 ;; The time the message was sent.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
739 "\\([^\0-\r \^?]+\\) +" ; day of the week
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
740 "\\([^\0-\r \^?]+\\) +" ; month
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
741 "\\([0-3]?[0-9]\\) +" ; day of month
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
742 "\\([0-2][0-9]:[0-5][0-9]\\(:[0-6][0-9]\\)?\\) *" ; time of day
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
743
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
744 ;; Perhaps a time zone, specified by an abbreviation, or by a
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
745 ;; numeric offset.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
746 time-zone-regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
747
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
748 ;; The year.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
749 " \\([0-9][0-9]+\\) *"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
750
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
751 ;; On some systems the time zone can appear after the year, too.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
752 time-zone-regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
753
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
754 ;; Old uucp cruft.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
755 "\\(remote from .*\\)?"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
756
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
757 "\n"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
758 nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
759
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
760 (defvar pmail-font-lock-keywords
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
761 ;; These are all matched case-insensitively.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
762 (eval-when-compile
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
763 (let* ((cite-chars "[>|}]")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
764 (cite-prefix "a-z")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
765 (cite-suffix (concat cite-prefix "0-9_.@-`'\"")))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
766 (list '("^\\(From\\|Sender\\|Resent-From\\):"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
767 . 'pmail-header-name)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
768 '("^Reply-To:.*$" . 'pmail-header-name)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
769 '("^Subject:" . 'pmail-header-name)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
770 '("^X-Spam-Status:" . 'pmail-header-name)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
771 '("^\\(To\\|Apparently-To\\|Cc\\|Newsgroups\\):"
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
772 . 'pmail-header-name)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
773 ;; Use MATCH-ANCHORED to effectively anchor the regexp left side.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
774 `(,cite-chars
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
775 (,(concat "\\=[ \t]*"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
776 "\\(\\(\\([" cite-prefix "]+[" cite-suffix "]*\\)?"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
777 "\\(" cite-chars "[ \t]*\\)\\)+\\)"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
778 "\\(.*\\)")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
779 (beginning-of-line) (end-of-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
780 (1 font-lock-comment-delimiter-face nil t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
781 (5 font-lock-comment-face nil t)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
782 '("^\\(X-[a-z0-9-]+\\|In-reply-to\\|Date\\):.*\\(\n[ \t]+.*\\)*$"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
783 . 'pmail-header-name))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
784 "Additional expressions to highlight in Pmail mode.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
785
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
786 ;; Perform BODY 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
787 ;; in such a way that its cursor is properly updated in its own window.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
788 (defmacro pmail-select-summary (&rest body)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
789 `(let ((total pmail-total-messages))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
790 (if (pmail-summary-displayed)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
791 (let ((window (selected-window)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
792 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
793 (unwind-protect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
794 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
795 (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
796 ;; pmail-total-messages is a buffer-local var
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
797 ;; 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
798 ;; This way we make it available for the body
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
799 ;; even tho the pmail buffer is not current.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
800 (let ((pmail-total-messages total))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
801 ,@body))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
802 (select-window window))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
803 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
804 (set-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
805 (let ((pmail-total-messages total))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
806 ,@body)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
807 (pmail-maybe-display-summary)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
808
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
809 ;;;; *** Pmail Mode ***
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
810
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
811 ;; This variable is dynamically bound. The defvar is here to placate
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
812 ;; the byte compiler.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
813
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
814 (defvar pmail-enable-multibyte nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
815
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
816
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
817 (defun pmail-require-mime-maybe ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
818 "Require `pmail-mime-feature' if that is non-nil.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
819 Signal an error and set `pmail-mime-feature' to nil if the feature
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
820 isn't provided."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
821 (when pmail-enable-mime
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
822 (condition-case err
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
823 (require pmail-mime-feature)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
824 (error
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
825 (display-warning
100437
3f79b3dad1ed * pmail.el (pmail-require-mime-maybe): Fix arguments of `display-warning'.
Juanma Barranquero <lekktu@gmail.com>
parents: 100435
diff changeset
826 'pmail
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
827 (format "Although MIME support is requested
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
828 by setting `pmail-enable-mime' to non-nil, the required feature
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
829 `%s' (the value of `pmail-mime-feature')
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
830 is not available in the current session.
100437
3f79b3dad1ed * pmail.el (pmail-require-mime-maybe): Fix arguments of `display-warning'.
Juanma Barranquero <lekktu@gmail.com>
parents: 100435
diff changeset
831 So, the MIME support is turned off for the moment."
3f79b3dad1ed * pmail.el (pmail-require-mime-maybe): Fix arguments of `display-warning'.
Juanma Barranquero <lekktu@gmail.com>
parents: 100435
diff changeset
832 pmail-mime-feature)
3f79b3dad1ed * pmail.el (pmail-require-mime-maybe): Fix arguments of `display-warning'.
Juanma Barranquero <lekktu@gmail.com>
parents: 100435
diff changeset
833 :warning)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
834 (setq pmail-enable-mime nil)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
835
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
836
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
837 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
838 (defun pmail (&optional file-name-arg)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
839 "Read and edit incoming mail.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
840 Moves messages into file named by `pmail-file-name' (a babyl format file)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
841 and edits that file in PMAIL Mode.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
842 Type \\[describe-mode] once editing that file, for a list of PMAIL commands.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
843
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
844 May be called with file name as argument; then performs pmail editing on
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
845 that file, but does not copy any new mail into the file.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
846 Interactively, if you supply a prefix argument, then you
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
847 have a chance to specify a file name with the minibuffer.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
848
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
849 If `pmail-display-summary' is non-nil, make a summary for this PMAIL file."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
850 (interactive (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
851 (list (read-file-name "Run 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
852 (pmail-require-mime-maybe)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
853 (let* ((file-name (expand-file-name (or file-name-arg pmail-file-name)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
854 ;; Use find-buffer-visiting, not get-file-buffer, for those users
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
855 ;; who have find-file-visit-truename set to t.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
856 (existed (find-buffer-visiting file-name))
99528
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
857 run-mail-hook mail-buf msg-shown)
98789
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
858 ;; Determine if an existing mail file has been changed behind the
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
859 ;; scene...
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
860 (if (and existed (not (verify-visited-file-modtime existed)))
98789
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
861 ;; The mail file has been changed. Revisit it and reset the
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
862 ;; message state variables when in pmail mode.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
863 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
864 (find-file file-name)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
865 (when (and (verify-visited-file-modtime existed)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
866 (eq major-mode 'pmail-mode))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
867 (pmail-set-message-counters)))
98789
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
868 ;; The mail file is either unchanged or not visited. Visit it.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
869 (switch-to-buffer
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
870 (let ((enable-local-variables nil))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
871 (find-file-noselect file-name))))
98789
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
872 ;; Insure that the collection and view buffers are in sync and
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
873 ;; insure that a message is not being edited.
100640
40652147be0c (pmail-swap-buffers-maybe): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents: 100630
diff changeset
874 (if (eq major-mode 'pmail-mode)
40652147be0c (pmail-swap-buffers-maybe): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents: 100630
diff changeset
875 (pmail-swap-buffers-maybe))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
876 (if (eq major-mode 'pmail-edit-mode)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
877 (error "Exit Pmail Edit mode before getting new mail"))
100620
65cf390be440 (pmail): Ensure that pmail-mode-hook is run.
Chong Yidong <cyd@stupidchicken.com>
parents: 100584
diff changeset
878 (or (and existed (> (buffer-size) 0))
65cf390be440 (pmail): Ensure that pmail-mode-hook is run.
Chong Yidong <cyd@stupidchicken.com>
parents: 100584
diff changeset
879 (setq run-mail-hook t))
98707
9a09eaf25d36 (pmail): Check for babyl conversion early; ignore multibyte.
Paul Reilly <pmr@pajato.com>
parents: 98625
diff changeset
880 ;; Insure that the Rmail file is in mbox format, the buffer is in
98789
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
881 ;; Pmail mode and has been scanned to find all the messages
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
882 ;; (setting the global message variables in the process).
98707
9a09eaf25d36 (pmail): Check for babyl conversion early; ignore multibyte.
Paul Reilly <pmr@pajato.com>
parents: 98625
diff changeset
883 (pmail-convert-file-maybe)
9a09eaf25d36 (pmail): Check for babyl conversion early; ignore multibyte.
Paul Reilly <pmr@pajato.com>
parents: 98625
diff changeset
884 (unless (eq major-mode 'pmail-mode)
9a09eaf25d36 (pmail): Check for babyl conversion early; ignore multibyte.
Paul Reilly <pmr@pajato.com>
parents: 98625
diff changeset
885 (pmail-mode-2))
9a09eaf25d36 (pmail): Check for babyl conversion early; ignore multibyte.
Paul Reilly <pmr@pajato.com>
parents: 98625
diff changeset
886 (goto-char (point-max))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
887 (pmail-maybe-set-message-counters)
99528
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
888 (setq mail-buf pmail-buffer)
98707
9a09eaf25d36 (pmail): Check for babyl conversion early; ignore multibyte.
Paul Reilly <pmr@pajato.com>
parents: 98625
diff changeset
889 ;; Show the first unread message and process summary mode.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
890 (unwind-protect
98789
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
891 ;; Only get new mail when there is not a file name argument.
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
892 (unless file-name-arg
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
893 (pmail-get-new-mail))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
894 (progn
99528
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
895 (set-buffer mail-buf)
98789
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
896 (pmail-show-message-maybe (pmail-first-unseen-message))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
897 (if pmail-display-summary (pmail-summary))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
898 (pmail-construct-io-menu)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
899 (if run-mail-hook
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
900 (run-hooks 'pmail-mode-hook))))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
901
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
902 (defun pmail-convert-file-maybe ()
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
903 "Determine if the file needs to be converted to mbox format."
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
904 (widen)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
905 (goto-char (point-min))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
906 ;; Detect previous Babyl format files.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
907 (cond ((looking-at "BABYL OPTIONS:")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
908 ;; The file is Babyl version 5. Use unrmail to convert
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
909 ;; it.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
910 (pmail-convert-babyl-to-mbox))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
911 ((looking-at "Version: 5\n")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
912 ;; Losing babyl file made by old version of Pmail. Fix the
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
913 ;; babyl file header and use unrmail to convert to mbox
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
914 ;; format.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
915 (let ((buffer-read-only nil))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
916 (insert "BABYL OPTIONS: -*- pmail -*-\n")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
917 (pmail-convert-babyl-to-mbox)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
918 ((equal (point-min) (point-max))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
919 (message "Empty Pmail file."))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
920 ((looking-at "From "))
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
921 (t (error "Invalid mbox file"))))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
922
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
923 (defun pmail-error-bad-format (&optional msgnum)
100340
c06b84bf19a5 (pmail-insert-pmail-file-header): Function deleted.
Chong Yidong <cyd@stupidchicken.com>
parents: 100337
diff changeset
924 "Report that the buffer is not in the mbox file format.
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
925 MSGNUM, if present, indicates the malformed message."
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
926 (if msgnum
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
927 (error "Message %d is not a valid RFC2822 message" msgnum)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
928 (error "Message is not a valid RFC2822 message")))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
929
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
930 (defun pmail-convert-babyl-to-mbox ()
100255
173f33792438 (pmail-convert-babyl-to-mbox): Reinitialize pmail-mode variables after
Chong Yidong <cyd@stupidchicken.com>
parents: 100224
diff changeset
931 "Convert the mail file from Babyl version 5 to mbox.
173f33792438 (pmail-convert-babyl-to-mbox): Reinitialize pmail-mode variables after
Chong Yidong <cyd@stupidchicken.com>
parents: 100224
diff changeset
932 This function also reinitializes local variables used by Pmail."
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
933 (let ((old-file (make-temp-file "pmail"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
934 (new-file (make-temp-file "pmail")))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
935 (unwind-protect
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
936 (progn
100255
173f33792438 (pmail-convert-babyl-to-mbox): Reinitialize pmail-mode variables after
Chong Yidong <cyd@stupidchicken.com>
parents: 100224
diff changeset
937 (kill-all-local-variables)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
938 (write-region (point-min) (point-max) old-file)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
939 (unrmail old-file new-file)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
940 (message "Replacing BABYL format with mbox format...")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
941 (let ((inhibit-read-only t))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
942 (erase-buffer)
98789
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
943 (insert-file-contents-literally new-file)
100255
173f33792438 (pmail-convert-babyl-to-mbox): Reinitialize pmail-mode variables after
Chong Yidong <cyd@stupidchicken.com>
parents: 100224
diff changeset
944 (pmail-mode-1)
173f33792438 (pmail-convert-babyl-to-mbox): Reinitialize pmail-mode variables after
Chong Yidong <cyd@stupidchicken.com>
parents: 100224
diff changeset
945 (pmail-perm-variables)
173f33792438 (pmail-convert-babyl-to-mbox): Reinitialize pmail-mode variables after
Chong Yidong <cyd@stupidchicken.com>
parents: 100224
diff changeset
946 (pmail-variables)
98789
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
947 (goto-char (point-max))
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
948 (pmail-set-message-counters))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
949 (message "Replacing BABYL format with mbox format...done"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
950 (delete-file old-file)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
951 (delete-file new-file))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
952
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
953 (defun pmail-get-coding-system ()
100340
c06b84bf19a5 (pmail-insert-pmail-file-header): Function deleted.
Chong Yidong <cyd@stupidchicken.com>
parents: 100337
diff changeset
954 "Return a suitable coding system to use for the current mail message.
c06b84bf19a5 (pmail-insert-pmail-file-header): Function deleted.
Chong Yidong <cyd@stupidchicken.com>
parents: 100337
diff changeset
955 The buffer is expected to be narrowed to just the header of the message."
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
956 (let ((content-type-header (mail-fetch-field "content-type"))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
957 separator)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
958 (save-excursion
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
959 (setq separator (search-forward "\n\n")))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
960 (if (and content-type-header
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
961 (string-match pmail-mime-charset-pattern content-type-header))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
962 (substring content-type-header (match-beginning 1) (match-end 1))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
963 'undecided)))
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
964
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
965 ;;; Set up Pmail mode keymaps
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
966
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
967 (defvar pmail-mode-map nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
968 (if pmail-mode-map
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
969 nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
970 (setq pmail-mode-map (make-keymap))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
971 (suppress-keymap pmail-mode-map)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
972 (define-key pmail-mode-map "a" 'pmail-add-label)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
973 (define-key pmail-mode-map "b" 'pmail-bury)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
974 (define-key pmail-mode-map "c" 'pmail-continue)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
975 (define-key pmail-mode-map "d" 'pmail-delete-forward)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
976 (define-key pmail-mode-map "\C-d" 'pmail-delete-backward)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
977 (define-key pmail-mode-map "e" 'pmail-edit-current-message)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
978 (define-key pmail-mode-map "f" 'pmail-forward)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
979 (define-key pmail-mode-map "g" 'pmail-get-new-mail)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
980 (define-key pmail-mode-map "h" 'pmail-summary)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
981 (define-key pmail-mode-map "i" 'pmail-input)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
982 (define-key pmail-mode-map "j" 'pmail-show-message-maybe)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
983 (define-key pmail-mode-map "k" 'pmail-kill-label)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
984 (define-key pmail-mode-map "l" 'pmail-summary-by-labels)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
985 (define-key pmail-mode-map "\e\C-h" 'pmail-summary)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
986 (define-key pmail-mode-map "\e\C-l" 'pmail-summary-by-labels)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
987 (define-key pmail-mode-map "\e\C-r" 'pmail-summary-by-recipients)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
988 (define-key pmail-mode-map "\e\C-s" 'pmail-summary-by-regexp)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
989 (define-key pmail-mode-map "\e\C-t" 'pmail-summary-by-topic)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
990 (define-key pmail-mode-map "m" 'pmail-mail)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
991 (define-key pmail-mode-map "\em" 'pmail-retry-failure)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
992 (define-key pmail-mode-map "n" 'pmail-next-undeleted-message)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
993 (define-key pmail-mode-map "\en" 'pmail-next-message)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
994 (define-key pmail-mode-map "\e\C-n" 'pmail-next-labeled-message)
100756
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
995 (define-key pmail-mode-map "o" 'pmail-output)
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
996 (define-key pmail-mode-map "\C-o" 'pmail-output-as-seen)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
997 (define-key pmail-mode-map "p" 'pmail-previous-undeleted-message)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
998 (define-key pmail-mode-map "\ep" 'pmail-previous-message)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
999 (define-key pmail-mode-map "\e\C-p" 'pmail-previous-labeled-message)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1000 (define-key pmail-mode-map "q" 'pmail-quit)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1001 (define-key pmail-mode-map "r" 'pmail-reply)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1002 ;; I find I can't live without the default M-r command -- rms.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1003 ;; (define-key pmail-mode-map "\er" 'pmail-search-backwards)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1004 (define-key pmail-mode-map "s" 'pmail-expunge-and-save)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1005 (define-key pmail-mode-map "\es" 'pmail-search)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1006 (define-key pmail-mode-map "t" 'pmail-toggle-header)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1007 (define-key pmail-mode-map "u" 'pmail-undelete-previous-message)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1008 (define-key pmail-mode-map "w" 'pmail-output-body-to-file)
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1009 (define-key pmail-mode-map "\C-c\C-w" 'pmail-widen)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1010 (define-key pmail-mode-map "x" 'pmail-expunge)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1011 (define-key pmail-mode-map "." 'pmail-beginning-of-message)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1012 (define-key pmail-mode-map "/" 'pmail-end-of-message)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1013 (define-key pmail-mode-map "<" 'pmail-first-message)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1014 (define-key pmail-mode-map ">" 'pmail-last-message)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1015 (define-key pmail-mode-map " " 'scroll-up)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1016 (define-key pmail-mode-map "\177" 'scroll-down)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1017 (define-key pmail-mode-map "?" 'describe-mode)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1018 (define-key pmail-mode-map "\C-c\C-s\C-d" 'pmail-sort-by-date)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1019 (define-key pmail-mode-map "\C-c\C-s\C-s" 'pmail-sort-by-subject)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1020 (define-key pmail-mode-map "\C-c\C-s\C-a" 'pmail-sort-by-author)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1021 (define-key pmail-mode-map "\C-c\C-s\C-r" 'pmail-sort-by-recipient)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1022 (define-key pmail-mode-map "\C-c\C-s\C-c" 'pmail-sort-by-correspondent)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1023 (define-key pmail-mode-map "\C-c\C-s\C-l" 'pmail-sort-by-lines)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1024 (define-key pmail-mode-map "\C-c\C-s\C-k" 'pmail-sort-by-labels)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1025 (define-key pmail-mode-map "\C-c\C-n" 'pmail-next-same-subject)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1026 (define-key pmail-mode-map "\C-c\C-p" 'pmail-previous-same-subject)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1027 )
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1028
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1029 (define-key pmail-mode-map [menu-bar] (make-sparse-keymap))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1030
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1031 (define-key pmail-mode-map [menu-bar classify]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1032 (cons "Classify" (make-sparse-keymap "Classify")))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1033
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1034 (define-key pmail-mode-map [menu-bar classify input-menu]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1035 nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1036
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1037 (define-key pmail-mode-map [menu-bar classify output-menu]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1038 nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1039
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1040 (define-key pmail-mode-map [menu-bar classify output-body]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1041 '("Output body to file..." . pmail-output-body-to-file))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1042
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1043 (define-key pmail-mode-map [menu-bar classify output-inbox]
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1044 '("Output..." . pmail-output))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1045
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1046 (define-key pmail-mode-map [menu-bar classify output]
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1047 '("Output as seen..." . pmail-output-as-seen))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1048
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1049 (define-key pmail-mode-map [menu-bar classify kill-label]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1050 '("Kill Label..." . pmail-kill-label))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1051
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1052 (define-key pmail-mode-map [menu-bar classify add-label]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1053 '("Add Label..." . pmail-add-label))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1054
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1055 (define-key pmail-mode-map [menu-bar summary]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1056 (cons "Summary" (make-sparse-keymap "Summary")))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1057
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1058 (define-key pmail-mode-map [menu-bar summary senders]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1059 '("By Senders..." . pmail-summary-by-senders))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1060
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1061 (define-key pmail-mode-map [menu-bar summary labels]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1062 '("By Labels..." . pmail-summary-by-labels))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1063
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1064 (define-key pmail-mode-map [menu-bar summary recipients]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1065 '("By Recipients..." . pmail-summary-by-recipients))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1066
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1067 (define-key pmail-mode-map [menu-bar summary topic]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1068 '("By Topic..." . pmail-summary-by-topic))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1069
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1070 (define-key pmail-mode-map [menu-bar summary regexp]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1071 '("By Regexp..." . pmail-summary-by-regexp))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1072
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1073 (define-key pmail-mode-map [menu-bar summary all]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1074 '("All" . pmail-summary))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1075
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1076 (define-key pmail-mode-map [menu-bar mail]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1077 (cons "Mail" (make-sparse-keymap "Mail")))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1078
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1079 (define-key pmail-mode-map [menu-bar mail pmail-get-new-mail]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1080 '("Get New Mail" . pmail-get-new-mail))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1081
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1082 (define-key pmail-mode-map [menu-bar mail lambda]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1083 '("----"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1084
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1085 (define-key pmail-mode-map [menu-bar mail continue]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1086 '("Continue" . pmail-continue))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1087
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1088 (define-key pmail-mode-map [menu-bar mail resend]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1089 '("Re-send..." . pmail-resend))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1090
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1091 (define-key pmail-mode-map [menu-bar mail forward]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1092 '("Forward" . pmail-forward))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1093
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1094 (define-key pmail-mode-map [menu-bar mail retry]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1095 '("Retry" . pmail-retry-failure))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1096
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1097 (define-key pmail-mode-map [menu-bar mail reply]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1098 '("Reply" . pmail-reply))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1099
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1100 (define-key pmail-mode-map [menu-bar mail mail]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1101 '("Mail" . pmail-mail))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1102
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1103 (define-key pmail-mode-map [menu-bar delete]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1104 (cons "Delete" (make-sparse-keymap "Delete")))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1105
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1106 (define-key pmail-mode-map [menu-bar delete expunge/save]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1107 '("Expunge/Save" . pmail-expunge-and-save))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1108
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1109 (define-key pmail-mode-map [menu-bar delete expunge]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1110 '("Expunge" . pmail-expunge))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1111
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1112 (define-key pmail-mode-map [menu-bar delete undelete]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1113 '("Undelete" . pmail-undelete-previous-message))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1114
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1115 (define-key pmail-mode-map [menu-bar delete delete]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1116 '("Delete" . pmail-delete-forward))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1117
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1118 (define-key pmail-mode-map [menu-bar move]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1119 (cons "Move" (make-sparse-keymap "Move")))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1120
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1121 (define-key pmail-mode-map [menu-bar move search-back]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1122 '("Search Back..." . pmail-search-backwards))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1123
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1124 (define-key pmail-mode-map [menu-bar move search]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1125 '("Search..." . pmail-search))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1126
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1127 (define-key pmail-mode-map [menu-bar move previous]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1128 '("Previous Nondeleted" . pmail-previous-undeleted-message))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1129
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1130 (define-key pmail-mode-map [menu-bar move next]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1131 '("Next Nondeleted" . pmail-next-undeleted-message))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1132
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1133 (define-key pmail-mode-map [menu-bar move last]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1134 '("Last" . pmail-last-message))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1135
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1136 (define-key pmail-mode-map [menu-bar move first]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1137 '("First" . pmail-first-message))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1138
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1139 (define-key pmail-mode-map [menu-bar move previous]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1140 '("Previous" . pmail-previous-message))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1141
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1142 (define-key pmail-mode-map [menu-bar move next]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1143 '("Next" . pmail-next-message))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1144
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1145 ;; Pmail toolbar
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1146 (defvar pmail-tool-bar-map
98625
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1147 (let ((map (make-sparse-keymap)))
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1148 (tool-bar-local-item-from-menu 'pmail-get-new-mail "mail/inbox"
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1149 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1150 (tool-bar-local-item-from-menu 'pmail-next-undeleted-message "right-arrow"
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1151 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1152 (tool-bar-local-item-from-menu 'pmail-previous-undeleted-message "left-arrow"
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1153 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1154 (tool-bar-local-item-from-menu 'pmail-search "search"
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1155 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1156 (tool-bar-local-item-from-menu 'pmail-input "open"
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1157 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1158 (tool-bar-local-item-from-menu 'pmail-mail "mail/compose"
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1159 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1160 (tool-bar-local-item-from-menu 'pmail-reply "mail/reply-all"
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1161 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1162 (tool-bar-local-item-from-menu 'pmail-forward "mail/forward"
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1163 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1164 (tool-bar-local-item-from-menu 'pmail-delete-forward "close"
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1165 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1166 (tool-bar-local-item-from-menu 'pmail-output "mail/move"
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1167 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1168 (tool-bar-local-item-from-menu 'pmail-output-body-to-file "mail/save"
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1169 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1170 (tool-bar-local-item-from-menu 'pmail-expunge "delete"
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1171 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1172 map))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1173
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1174
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1175
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1176 ;; Pmail 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
1177 (put 'pmail-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
1178
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1179 (defun pmail-mode-kill-summary ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1180 (if pmail-summary-buffer (kill-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
1181
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1182 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1183 (defun pmail-mode ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1184 "Pmail Mode is used by \\<pmail-mode-map>\\[pmail] for editing Pmail files.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1185 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
1186 Instead, these commands are available:
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 \\[pmail-beginning-of-message] Move point to front of this message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1189 \\[pmail-end-of-message] Move point to bottom of this message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1190 \\[scroll-up] Scroll to next screen of this message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1191 \\[scroll-down] Scroll to previous screen of this message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1192 \\[pmail-next-undeleted-message] Move to Next non-deleted message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1193 \\[pmail-previous-undeleted-message] Move to Previous non-deleted message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1194 \\[pmail-next-message] Move to Next message whether deleted or not.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1195 \\[pmail-previous-message] Move to Previous message whether deleted or not.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1196 \\[pmail-first-message] Move to the first message in Pmail file.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1197 \\[pmail-last-message] Move to the last message in Pmail file.
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
1198 \\[pmail-show-message-maybe] Jump to message specified by numeric position in file.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1199 \\[pmail-search] Search for string and show message it is found in.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1200 \\[pmail-delete-forward] Delete this message, move to next nondeleted.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1201 \\[pmail-delete-backward] Delete this message, move to previous nondeleted.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1202 \\[pmail-undelete-previous-message] Undelete message. Tries current message, then earlier messages
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1203 till a deleted message is found.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1204 \\[pmail-edit-current-message] Edit the current message. \\[pmail-cease-edit] to return to Pmail.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1205 \\[pmail-expunge] Expunge deleted messages.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1206 \\[pmail-expunge-and-save] Expunge and save the file.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1207 \\[pmail-quit] Quit Pmail: expunge, save, then switch to another buffer.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1208 \\[save-buffer] Save without expunging.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1209 \\[pmail-get-new-mail] Move new mail from system spool directory into this file.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1210 \\[pmail-mail] Mail a message (same as \\[mail-other-window]).
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1211 \\[pmail-continue] Continue composing outgoing message started before.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1212 \\[pmail-reply] Reply to this message. Like \\[pmail-mail] but initializes some fields.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1213 \\[pmail-retry-failure] Send this message again. Used on a mailer failure message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1214 \\[pmail-forward] Forward this message to another user.
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1215 \\[pmail-output] Output (append) this message to another mail file.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1216 \\[pmail-output-as-seen] Output (append) this message to file as it's displayed.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1217 \\[pmail-output-body-to-file] Save message body to a file. Default filename comes from Subject line.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1218 \\[pmail-input] Input Pmail file. Run Pmail on that file.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1219 \\[pmail-add-label] Add label to message. It will be displayed in the mode line.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1220 \\[pmail-kill-label] Kill label. Remove a label from current message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1221 \\[pmail-next-labeled-message] Move to Next message with specified label
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1222 (label defaults to last one specified).
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1223 Standard labels: filed, unseen, answered, forwarded, deleted.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1224 Any other label is present only if you add it with \\[pmail-add-label].
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1225 \\[pmail-previous-labeled-message] Move to Previous message with specified label
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1226 \\[pmail-summary] Show headers buffer, with a one line summary of each message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1227 \\[pmail-summary-by-labels] Summarize only messages with particular label(s).
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1228 \\[pmail-summary-by-recipients] Summarize only messages with particular recipient(s).
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1229 \\[pmail-summary-by-regexp] Summarize only messages with particular regexp(s).
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1230 \\[pmail-summary-by-topic] Summarize only messages with subject line regexp(s).
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1231 \\[pmail-toggle-header] Toggle display of complete header."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1232 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1233 (let ((finding-pmail-file (not (eq major-mode 'pmail-mode))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1234 (pmail-mode-2)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1235 (when (and finding-pmail-file
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1236 (null coding-system-for-read)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1237 default-enable-multibyte-characters)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1238 (let ((pmail-enable-multibyte t))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1239 (pmail-require-mime-maybe)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1240 (pmail-convert-file-maybe)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1241 (goto-char (point-max))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1242 (set-buffer-multibyte t)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1243 (pmail-set-message-counters)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
1244 (pmail-show-message-maybe pmail-total-messages)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1245 (when finding-pmail-file
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1246 (when pmail-display-summary
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1247 (pmail-summary))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1248 (pmail-construct-io-menu))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1249 (run-mode-hooks 'pmail-mode-hook)))
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-mode-2 ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1252 (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
1253 (pmail-mode-1)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1254 (pmail-perm-variables)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1255 (pmail-variables))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1256
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1257 (defun pmail-mode-1 ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1258 (setq major-mode 'pmail-mode)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1259 (setq mode-name "PMAIL")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1260 (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
1261 ;; No need to auto save PMAIL files in normal circumstances
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1262 ;; because they contain no info except attribute changes
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1263 ;; and deletion of messages.
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1264 ;; The one exception is when messages are copied into another mbox buffer.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1265 ;; pmail-output enables auto save when you do that.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1266 (setq buffer-auto-save-file-name nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1267 (use-local-map pmail-mode-map)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1268 (set-syntax-table text-mode-syntax-table)
99528
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1269 (setq local-abbrev-table text-mode-abbrev-table)
101341
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
1270 ;; Functions to support buffer swapping:
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
1271 (add-hook 'write-region-annotate-functions
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
1272 'pmail-write-region-annotate nil t)
99528
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1273 (add-hook 'kill-buffer-hook 'pmail-mode-kill-buffer-hook nil t)
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1274 (add-hook 'change-major-mode-hook 'pmail-change-major-mode-hook nil t))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1275
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1276 (defun pmail-generate-viewer-buffer ()
99528
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1277 "Return a reusable buffer suitable for viewing messages.
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1278 Create the buffer if necessary."
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1279 (let* ((suffix (file-name-nondirectory (or buffer-file-name (buffer-name))))
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1280 (name (format " *message-viewer %s*" suffix))
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1281 (buf (get-buffer name)))
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1282 (unless buf
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1283 (generate-new-buffer name))))
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1284
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1285 (defun pmail-change-major-mode-hook ()
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1286 ;; Bring the actual Pmail messages back into the main buffer.
101341
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
1287 (when (pmail-buffers-swapped-p)
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
1288 (setq pmail-buffer-swapped nil)
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
1289 (let ((modp (buffer-modified-p)))
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
1290 (buffer-swap-text pmail-view-buffer)
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
1291 (set-buffer-modified-p modp))))
99528
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1292
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1293 (defun pmail-buffers-swapped-p ()
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1294 "Return non-nil if the message collection is in `pmail-view-buffer'."
101341
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
1295 ;; This is analogous to tar-data-swapped-p in tar-mode.el.
99528
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1296 (and (buffer-live-p pmail-view-buffer)
101341
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
1297 pmail-buffer-swapped))
99528
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1298
101077
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
1299 (defun pmail-swap-buffers-maybe ()
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
1300 "Determine if the Pmail buffer is showing a message.
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
1301 If so restore the actual mbox message collection."
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
1302 (with-current-buffer pmail-buffer
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
1303 (when (pmail-buffers-swapped-p)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
1304 (let ((modp (buffer-modified-p)))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
1305 (buffer-swap-text pmail-view-buffer)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
1306 (set-buffer-modified-p modp))
101341
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
1307 (setq pmail-buffer-swapped nil))))
101077
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
1308
99528
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1309 (defun pmail-mode-kill-buffer-hook ()
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1310 (if (buffer-live-p pmail-view-buffer) (kill-buffer pmail-view-buffer)))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1311
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1312 ;; Set up the permanent locals associated with an Pmail file.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1313 (defun pmail-perm-variables ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1314 (make-local-variable 'pmail-last-regexp)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1315 (make-local-variable 'pmail-deleted-vector)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1316 (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
1317 (setq pmail-buffer (current-buffer))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1318 (set-buffer-multibyte nil)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1319 (make-local-variable 'pmail-view-buffer)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
1320 (save-excursion
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
1321 (setq pmail-view-buffer (pmail-generate-viewer-buffer))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
1322 (set-buffer pmail-view-buffer)
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1323 (setq buffer-undo-list t)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
1324 (set-buffer-multibyte t))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1325 (make-local-variable 'pmail-summary-buffer)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1326 (make-local-variable 'pmail-summary-vector)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1327 (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
1328 (make-local-variable 'pmail-total-messages)
99528
9fb927515941 Add support for save-buffer.
Paul Reilly <pmr@pajato.com>
parents: 98789
diff changeset
1329 (setq pmail-total-messages 0)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1330 (make-local-variable 'pmail-overlay-list)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1331 (setq pmail-overlay-list nil)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1332 (make-local-variable 'pmail-message-vector)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1333 (make-local-variable 'pmail-msgref-vector)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1334 (make-local-variable 'pmail-inbox-list)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1335 ;; Provide default set of inboxes for primary mail file ~/PMAIL.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1336 (and (null pmail-inbox-list)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1337 (or (equal buffer-file-name (expand-file-name pmail-file-name))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1338 (equal buffer-file-truename
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1339 (abbreviate-file-name (file-truename pmail-file-name))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1340 (setq pmail-inbox-list
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1341 (or pmail-primary-inbox-list
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1342 (list (or (getenv "MAIL")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1343 (concat rmail-spool-directory
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1344 (user-login-name)))))))
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1345 (set (make-local-variable 'tool-bar-map) pmail-tool-bar-map))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1346
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1347 ;; Set up the non-permanent locals associated with Pmail mode.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1348 (defun pmail-variables ()
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1349 ;; Turn off undo. We turn it back on in pmail-edit.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1350 (setq buffer-undo-list t)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1351 ;; Don't let a local variables list in a message cause confusion.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1352 (make-local-variable 'local-enable-local-variables)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1353 (setq local-enable-local-variables nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1354 (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
1355 (setq revert-buffer-function 'pmail-revert)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1356 (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
1357 (setq font-lock-defaults
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1358 '(pmail-font-lock-keywords
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1359 t t nil nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1360 (font-lock-maximum-size . nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1361 (font-lock-fontify-buffer-function . pmail-fontify-buffer-function)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1362 (font-lock-unfontify-buffer-function . pmail-unfontify-buffer-function)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1363 (font-lock-inhibit-thing-lock . (lazy-lock-mode fast-lock-mode))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1364 (make-local-variable 'require-final-newline)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1365 (setq require-final-newline nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1366 (make-local-variable 'version-control)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1367 (setq version-control 'never)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1368 (make-local-variable 'kill-buffer-hook)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1369 (add-hook 'kill-buffer-hook 'pmail-mode-kill-summary)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1370 (make-local-variable 'file-precious-flag)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1371 (setq file-precious-flag t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1372 (make-local-variable 'desktop-save-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1373 (setq desktop-save-buffer t))
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1374
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1375 ;; Handle M-x revert-buffer done in an pmail-mode buffer.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1376 (defun pmail-revert (arg noconfirm)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1377 (set-buffer pmail-buffer)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1378 (let* ((revert-buffer-function (default-value 'revert-buffer-function))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1379 (pmail-enable-multibyte enable-multibyte-characters)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1380 ;; See similar code in `pmail'.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1381 (coding-system-for-read (and pmail-enable-multibyte 'raw-text)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1382 ;; Call our caller again, but this time it does the default thing.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1383 (when (revert-buffer arg noconfirm)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1384 ;; If the user said "yes", and we changed something,
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1385 ;; reparse the messages.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1386 (set-buffer pmail-buffer)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1387 (pmail-mode-2)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1388 ;; Convert all or part to Babyl file if possible.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1389 (pmail-convert-file-maybe)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1390 ;; We have read the file as raw-text, so the buffer is set to
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1391 ;; unibyte. Make it multibyte if necessary.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1392 (if (and pmail-enable-multibyte
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1393 (not enable-multibyte-characters))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1394 (set-buffer-multibyte t))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1395 (goto-char (point-max))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1396 (pmail-set-message-counters)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
1397 (pmail-show-message-maybe pmail-total-messages)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1398 (run-hooks 'pmail-mode-hook))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1399
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1400 (defun pmail-expunge-and-save ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1401 "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
1402 (interactive)
100581
a9602a27b979 (pmail-expunge-and-save): Call pmail-swap-buffers-maybe before
Chong Yidong <cyd@stupidchicken.com>
parents: 100580
diff changeset
1403 (set-buffer pmail-buffer)
100297
0a269d00caef (pmail-expunge): Pass new optional arg to pmail-only-expunge.
Chong Yidong <cyd@stupidchicken.com>
parents: 100290
diff changeset
1404 (pmail-expunge t)
100581
a9602a27b979 (pmail-expunge-and-save): Call pmail-swap-buffers-maybe before
Chong Yidong <cyd@stupidchicken.com>
parents: 100580
diff changeset
1405 (pmail-swap-buffers-maybe)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1406 (save-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1407 (if (pmail-summary-exists)
100581
a9602a27b979 (pmail-expunge-and-save): Call pmail-swap-buffers-maybe before
Chong Yidong <cyd@stupidchicken.com>
parents: 100580
diff changeset
1408 (pmail-select-summary (set-buffer-modified-p nil))
a9602a27b979 (pmail-expunge-and-save): Call pmail-swap-buffers-maybe before
Chong Yidong <cyd@stupidchicken.com>
parents: 100580
diff changeset
1409 (pmail-show-message)))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1410
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1411 (defun pmail-quit ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1412 "Quit out of PMAIL.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1413 Hook `pmail-quit-hook' is run after expunging."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1414 (interactive)
100581
a9602a27b979 (pmail-expunge-and-save): Call pmail-swap-buffers-maybe before
Chong Yidong <cyd@stupidchicken.com>
parents: 100580
diff changeset
1415 (set-buffer pmail-buffer)
a9602a27b979 (pmail-expunge-and-save): Call pmail-swap-buffers-maybe before
Chong Yidong <cyd@stupidchicken.com>
parents: 100580
diff changeset
1416 (pmail-expunge t)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1417 (pmail-swap-buffers-maybe)
100581
a9602a27b979 (pmail-expunge-and-save): Call pmail-swap-buffers-maybe before
Chong Yidong <cyd@stupidchicken.com>
parents: 100580
diff changeset
1418 (save-buffer)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1419 (when (boundp 'pmail-quit-hook)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1420 (run-hooks 'pmail-quit-hook))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1421 ;; Don't switch to the summary buffer even if it was recently visible.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1422 (when pmail-summary-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1423 (replace-buffer-in-windows pmail-summary-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1424 (bury-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
1425 (if pmail-enable-mime
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1426 (let ((obuf pmail-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1427 (ovbuf pmail-view-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1428 (set-buffer pmail-view-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1429 (quit-window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1430 (replace-buffer-in-windows ovbuf)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1431 (replace-buffer-in-windows obuf)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1432 (bury-buffer obuf))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1433 (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
1434 (quit-window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1435 (replace-buffer-in-windows obuf))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1436
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1437 (defun pmail-bury ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1438 "Bury current Pmail buffer and its summary buffer."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1439 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1440 ;; This let var was called pmail-buffer, but that interfered
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1441 ;; with the buffer-local var used in summary buffers.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1442 (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
1443 (if (pmail-summary-exists)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1444 (let (window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1445 (while (setq window (get-buffer-window pmail-summary-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1446 (quit-window nil window))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1447 (bury-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
1448 (quit-window)))
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1449
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1450 (defun pmail-duplicate-message ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1451 "Create a duplicated copy 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
1452 The duplicate copy goes into the Pmail file just after the
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1453 original copy."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1454 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1455 (widen)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1456 (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
1457 (number pmail-current-message)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1458 (string (buffer-substring (pmail-msgbeg pmail-current-message)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1459 (pmail-msgend pmail-current-message))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1460 (goto-char (pmail-msgend pmail-current-message))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1461 (insert string)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1462 (pmail-forget-messages)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
1463 (pmail-show-message-maybe number)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1464 (message "Message duplicated")))
101077
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
1465
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1466 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1467 (defun pmail-input (filename)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1468 "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
1469 (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
1470 (pmail filename))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1471
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1472 ;; This used to scan subdirectories recursively, but someone pointed out
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1473 ;; that if the user wants that, person can put all the files in one dir.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1474 ;; And the recursive scan was slow. So I took it out.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1475 ;; rms, Sep 1996.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1476 (defun pmail-find-all-files (start)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1477 "Return list of file in dir START that match `pmail-secondary-file-regexp'."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1478 (if (file-accessible-directory-p start)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1479 ;; Don't sort here.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1480 (let* ((case-fold-search t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1481 (files (directory-files start t pmail-secondary-file-regexp)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1482 ;; Sort here instead of in directory-files
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1483 ;; because this list is usually much shorter.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1484 (sort files 'string<))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1485
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1486 (defun pmail-list-to-menu (menu-name l action &optional full-name)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1487 (let ((menu (make-sparse-keymap menu-name)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1488 (mapc
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1489 (lambda (item)
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1490 (let (command)
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1491 (if (consp item)
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1492 (setq command
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1493 (pmail-list-to-menu
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1494 (car item) (cdr item) action
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1495 (if full-name
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1496 (concat full-name "/"
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1497 (car item))
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1498 (car item)))
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1499 name (car item))
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1500 (setq name item)
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1501 (setq command
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1502 (list 'lambda () '(interactive)
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1503 (list action
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1504 (expand-file-name
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1505 (if full-name
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1506 (concat full-name "/" item)
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1507 item)
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1508 pmail-secondary-file-directory)))))
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1509 (define-key menu (vector (intern name))
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1510 (cons name command))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1511 (reverse l))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1512 menu))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1513
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1514 ;; This command is always "disabled" when it appears in a menu.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1515 (put 'pmail-disable-menu 'menu-enable ''nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1516
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1517 (defun pmail-construct-io-menu ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1518 (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
1519 (if files
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1520 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1521 (define-key pmail-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
1522 (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
1523 (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
1524 files
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1525 'pmail-input)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1526 (define-key pmail-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
1527 (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
1528 (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
1529 files
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1530 'pmail-output))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1531
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1532 (define-key pmail-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
1533 '("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
1534 (define-key pmail-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
1535 '("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
1536
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1537
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1538 ;;;; *** Pmail input ***
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1539
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1540 (declare-function rmail-spam-filter "rmail-spam-filter" (msg))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1541 (declare-function pmail-summary-goto-msg "pmailsum" (&optional n nowarn skip-pmail))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1542 (declare-function pmail-summary-mark-undeleted "pmailsum" (n))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1543 (declare-function pmail-summary-mark-deleted "pmailsum" (&optional n undel))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1544 (declare-function rfc822-addresses "rfc822" (header-text))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1545 (declare-function mail-abbrev-make-syntax-table "mailabbrev.el" ())
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1546 (declare-function mail-sendmail-delimit-header "sendmail" ())
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1547 (declare-function mail-header-end "sendmail" ())
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1548
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1549 ;; RLK feature not added in this version:
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1550 ;; argument specifies inbox file or files in various ways.
98051
c4cf87cdb0a4 (rmail-spam-filter): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 98048
diff changeset
1551
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1552 (defun pmail-get-new-mail (&optional file-name)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1553 "Move any new mail from this PMAIL file's inbox files.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1554 The inbox files can be specified with the file's Mail: option. The
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1555 variable `pmail-primary-inbox-list' specifies the inboxes for your
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1556 primary PMAIL file if it has no Mail: option. By default, this is
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1557 your /usr/spool/mail/$USER.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1558
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1559 You can also specify the file to get new mail from. In this case, the
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1560 file of new mail is not changed or deleted. Noninteractively, you can
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1561 pass the inbox file name as an argument. Interactively, a prefix
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1562 argument causes us to read a file name and use that file as the inbox.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1563
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1564 If the variable `pmail-preserve-inbox' is non-nil, new mail will
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1565 always be left in inbox files rather than deleted.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1566
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1567 This function runs `pmail-get-new-mail-hook' before saving the updated file.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1568 It returns t if it got any new messages."
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1569 (interactive
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1570 (list (if current-prefix-arg
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1571 (read-file-name "Get new mail from file: "))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1572 (run-hooks 'pmail-before-get-new-mail-hook)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1573 ;; If the disk file has been changed from under us,
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1574 ;; revert to it before we get new mail.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1575 (or (verify-visited-file-modtime (current-buffer))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1576 (find-file (buffer-file-name)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1577 (set-buffer pmail-buffer)
100580
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1578 (pmail-swap-buffers-maybe)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1579 (pmail-maybe-set-message-counters)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1580 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1581 ;; Get rid of all undo records for this buffer.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1582 (or (eq buffer-undo-list t)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1583 (setq buffer-undo-list nil))
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1584 (let ((all-files (if file-name (list file-name) pmail-inbox-list))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1585 (pmail-enable-multibyte (default-value 'enable-multibyte-characters))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1586 found)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1587 (unwind-protect
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1588 (when all-files
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1589 (let ((opoint (point))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1590 ;; If buffer has not changed yet, and has not been
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1591 ;; saved yet, don't replace the old backup file now.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1592 (make-backup-files (and make-backup-files (buffer-modified-p)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1593 (buffer-read-only nil)
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1594 ;; Don't make undo records while getting mail.
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1595 (buffer-undo-list t)
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1596 delete-files success files file-last-names)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1597 ;; Pull files off all-files onto files as long as there is
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1598 ;; no name conflict. A conflict happens when two inbox
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1599 ;; file names have the same last component.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1600 (while (and all-files
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1601 (not (member (file-name-nondirectory (car all-files))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1602 file-last-names)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1603 (setq files (cons (car all-files) files)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1604 file-last-names
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1605 (cons (file-name-nondirectory (car all-files)) files))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1606 (setq all-files (cdr all-files)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1607 ;; Put them back in their original order.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1608 (setq files (nreverse files))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1609 (goto-char (point-max))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1610 (skip-chars-backward " \t\n") ; just in case of brain damage
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1611 (delete-region (point) (point-max)) ; caused by require-final-newline
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1612 (setq found (pmail-get-new-mail-1 file-name files delete-files))))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1613 found)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1614 ;; Don't leave the buffer screwed up if we get a disk-full error.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1615 (or found (pmail-show-message-maybe))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1616
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1617 (defun pmail-get-new-mail-1 (file-name files delete-files)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1618 "Return t if new messages are detected without error, nil otherwise."
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1619 (save-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1620 (save-restriction
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1621 (let ((new-messages 0)
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1622 (spam-filter-p (and (featurep 'rmail-spam-filter)
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1623 pmail-use-spam-filter))
100580
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1624 (blurb "")
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1625 result success suffix)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1626 (narrow-to-region (point) (point))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1627 ;; Read in the contents of the inbox files, renaming them as
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1628 ;; necessary, and adding to the list of files to delete
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1629 ;; eventually.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1630 (if file-name
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1631 (pmail-insert-inbox-text files nil)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1632 (setq delete-files (pmail-insert-inbox-text files t)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1633 ;; Scan the new text and convert each message to
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1634 ;; Pmail/mbox format.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1635 (goto-char (point-min))
100580
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1636 (skip-chars-forward " \n")
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1637 (narrow-to-region (point) (point-max))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1638 (unwind-protect
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1639 (setq new-messages (pmail-add-mbox-headers)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1640 success t)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1641 ;; Try to delete the garbage just inserted.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1642 (or success (delete-region (point-min) (point-max)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1643 ;; If we could not convert the file's inboxes, rename the
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1644 ;; files we tried to read so we won't over and over again.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1645 (if (and (not file-name) (not success))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1646 (let ((delfiles delete-files)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1647 (count 0))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1648 (while delfiles
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1649 (while (file-exists-p (format "PMAILOSE.%d" count))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1650 (setq count (1+ count)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1651 (rename-file (car delfiles) (format "PMAILOSE.%d" count))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1652 (setq delfiles (cdr delfiles))))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1653 ;; Determine if there are messages.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1654 (unless (zerop new-messages)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1655 ;; There are. Process them.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1656 (goto-char (point-min))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1657 (pmail-count-new-messages)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1658 (run-hooks 'pmail-get-new-mail-hook)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1659 (save-buffer))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1660 ;; Delete the old files, now that the Pmail file is saved.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1661 (while delete-files
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1662 (condition-case ()
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1663 ;; First, try deleting.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1664 (condition-case ()
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1665 (delete-file (car delete-files))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1666 (file-error
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1667 ;; If we can't delete it, truncate it.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1668 (write-region (point) (point) (car delete-files))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1669 (file-error nil))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1670 (setq delete-files (cdr delete-files)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1671 (if (zerop new-messages)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1672 (when (or file-name pmail-inbox-list)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1673 (message "(No new mail has arrived)"))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1674 ;; Generate the spam message.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1675 (setq blurb (if spam-filter-p
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1676 (pmail-get-new-mail-filter-spam new-messages)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1677 "")))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1678 (if (pmail-summary-exists)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1679 (pmail-select-summary (pmail-update-summary)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1680 (setq suffix (if (= 1 new-messages) "" "s"))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1681 (message "%d new message%s read%s" new-messages suffix blurb)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1682 (when spam-filter-p
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1683 (if rsf-beep (beep t))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1684 (sleep-for rsf-sleep-after-message))
100437
3f79b3dad1ed * pmail.el (pmail-require-mime-maybe): Fix arguments of `display-warning'.
Juanma Barranquero <lekktu@gmail.com>
parents: 100435
diff changeset
1685
98789
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
1686 ;; Establish the return value and move to the first new
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
1687 ;; message unless we have other unseen messages before it.
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
1688 (setq result (> new-messages 0))
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
1689 (when result
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
1690 (pmail-show-message-maybe (pmail-first-unseen-message)))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1691 (run-hooks 'pmail-after-get-new-mail-hook)
98789
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
1692 result))))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1693
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1694 (defun pmail-get-new-mail-filter-spam (new-message-count)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1695 "Process new messages for spam."
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1696 (let* ((old-messages (- pmail-total-messages new-message-count))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1697 (rsf-number-of-spam 0)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1698 (rsf-scanned-message-number (1+ old-messages))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1699 ;; save deletion flags of old messages: vector starts at zero
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1700 ;; (is one longer that no of messages), therefore take 1+
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1701 ;; old-messages
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1702 (save-deleted (substring pmail-deleted-vector 0 (1+ old-messages)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1703 blurb)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1704 ;; set all messages to undeleted
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1705 (setq pmail-deleted-vector (make-string (1+ pmail-total-messages) ?\ ))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1706 (while (<= rsf-scanned-message-number pmail-total-messages)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1707 (progn
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1708 (if (not (rmail-spam-filter rsf-scanned-message-number))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1709 (progn (setq rsf-number-of-spam (1+ rsf-number-of-spam))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1710 (setq rsf-scanned-message-number (1+ rsf-scanned-message-number))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1711 (if (> rsf-number-of-spam 0)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1712 (progn
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1713 (when (pmail-expunge-confirmed)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1714 (pmail-only-expunge t))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1715 (setq pmail-deleted-vector
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1716 (concat save-deleted
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1717 (make-string (- pmail-total-messages old-messages) ?\ )))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1718 ;; Generate a return value message based on the number of spam
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1719 ;; messages found.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1720 (cond
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1721 ((zerop rsf-number-of-spam) "")
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1722 ((= 1 new-message-count) ", and appears to be spam")
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1723 ((= rsf-number-of-spam new-message-count) ", and all appear to be spam")
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1724 ((> rsf-number-of-spam 1)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1725 (format ", and %d appear to be spam" rsf-number-of-spam))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1726 (t ", and 1 appears to be spam"))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1727
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1728 (defun pmail-parse-url (file)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1729 "Parse the supplied URL. Return (list MAILBOX-NAME REMOTE PASSWORD GOT-PASSWORD)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1730 WHERE MAILBOX-NAME is the name of the mailbox suitable as argument to the
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1731 actual version of `movemail', REMOTE is non-nil if MAILBOX-NAME refers to
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1732 a remote mailbox, PASSWORD is the password if it should be
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1733 supplied as a separate argument to `movemail' or nil otherwise, GOT-PASSWORD
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1734 is non-nil if the user has supplied the password interactively.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1735 "
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1736 (cond
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1737 ((string-match "^\\([^:]+\\)://\\(\\([^:@]+\\)\\(:\\([^@]+\\)\\)?@\\)?.*" file)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1738 (let (got-password supplied-password
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1739 (proto (match-string 1 file))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1740 (user (match-string 3 file))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1741 (pass (match-string 5 file))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1742 (host (substring file (or (match-end 2)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1743 (+ 3 (match-end 1))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1744
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1745 (if (not pass)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1746 (when pmail-remote-password-required
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1747 (setq got-password (not (pmail-have-password)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1748 (setq supplied-password (pmail-get-remote-password
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1749 (string-equal proto "imap"))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1750 ;; The password is embedded. Strip it out since movemail
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1751 ;; does not really like it, in spite of the movemail spec.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1752 (setq file (concat proto "://" user "@" host)))
100437
3f79b3dad1ed * pmail.el (pmail-require-mime-maybe): Fix arguments of `display-warning'.
Juanma Barranquero <lekktu@gmail.com>
parents: 100435
diff changeset
1753
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1754 (if (pmail-movemail-variant-p 'emacs)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1755 (if (string-equal proto "pop")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1756 (list (concat "po:" user ":" host)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1757 t
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1758 (or pass supplied-password)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1759 got-password)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1760 (error "Emacs movemail does not support %s protocol" proto))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1761 (list file
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1762 (or (string-equal proto "pop") (string-equal proto "imap"))
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
1763 (or supplied-password pass)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1764 got-password))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1765
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1766 ((string-match "^po:\\([^:]+\\)\\(:\\(.*\\)\\)?" file)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1767 (let (got-password supplied-password
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1768 (proto "pop")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1769 (user (match-string 1 file))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1770 (host (match-string 3 file)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1771
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1772 (when pmail-remote-password-required
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1773 (setq got-password (not (pmail-have-password)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1774 (setq supplied-password (pmail-get-remote-password nil)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1775
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1776 (list file "pop" supplied-password got-password)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1777
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1778 (t
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1779 (list file nil nil nil))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1780
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1781 (defun pmail-insert-inbox-text (files renamep)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1782 ;; Detect a locked file now, so that we avoid moving mail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1783 ;; out of the real inbox file. (That could scare people.)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1784 (or (memq (file-locked-p buffer-file-name) '(nil t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1785 (error "PMAIL file %s is locked"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1786 (file-name-nondirectory buffer-file-name)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1787 (let (file tofile delete-files movemail popmail got-password password)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1788 (while files
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1789 ;; Handle remote mailbox names specially; don't expand as filenames
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1790 ;; in case the userid contains a directory separator.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1791 (setq file (car files))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1792 (let ((url-data (pmail-parse-url file)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1793 (setq file (nth 0 url-data))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1794 (setq popmail (nth 1 url-data))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1795 (setq password (nth 2 url-data))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1796 (setq got-password (nth 3 url-data)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1797
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1798 (if popmail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1799 (setq renamep t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1800 (setq file (file-truename
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1801 (substitute-in-file-name (expand-file-name file)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1802 (setq tofile (expand-file-name
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1803 ;; Generate name to move to from inbox name,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1804 ;; in case of multiple inboxes that need moving.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1805 (concat ".newmail-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1806 (file-name-nondirectory
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
1807 (if (memq system-type '(windows-nt cygwin ms-dos))
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
1808 ;; cannot have colons in file name
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
1809 (replace-regexp-in-string ":" "-" file)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1810 file)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1811 ;; Use the directory of this pmail file
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1812 ;; because it's a nuisance to use the homedir
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1813 ;; if that is on a full disk and this pmail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1814 ;; file isn't.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1815 (file-name-directory
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1816 (expand-file-name buffer-file-name))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1817 ;; Always use movemail to rename the file,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1818 ;; since there can be mailboxes in various directories.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1819 (when (not popmail)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1820 ;; On some systems, /usr/spool/mail/foo is a directory
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1821 ;; and the actual inbox is /usr/spool/mail/foo/foo.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1822 (if (file-directory-p file)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1823 (setq file (expand-file-name (user-login-name)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1824 file))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1825 (cond (popmail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1826 (message "Getting mail from the remote server ..."))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1827 ((and (file-exists-p tofile)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1828 (/= 0 (nth 7 (file-attributes tofile))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1829 (message "Getting mail from %s..." tofile))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1830 ((and (file-exists-p file)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1831 (/= 0 (nth 7 (file-attributes file))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1832 (message "Getting mail from %s..." file)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1833 ;; Set TOFILE if have not already done so, and
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1834 ;; rename or copy the file FILE to TOFILE if and as appropriate.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1835 (cond ((not renamep)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1836 (setq tofile file))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1837 ((or (file-exists-p tofile) (and (not popmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1838 (not (file-exists-p file))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1839 nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1840 (t
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1841 (with-temp-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1842 (let ((errors (current-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1843 (buffer-disable-undo errors)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1844 (let ((args
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1845 (append
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
1846 (list (or pmail-movemail-program "movemail") nil errors nil)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1847 (if pmail-preserve-inbox
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1848 (list "-p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1849 nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1850 (if (pmail-movemail-variant-p 'mailutils)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1851 (append (list "--emacs") pmail-movemail-flags)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1852 pmail-movemail-flags)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1853 (list file tofile)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1854 (if password (list password) nil))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1855 (apply 'call-process args))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1856 (if (not (buffer-modified-p errors))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1857 ;; No output => movemail won
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1858 nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1859 (set-buffer errors)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1860 (subst-char-in-region (point-min) (point-max)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1861 ?\n ?\ )
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1862 (goto-char (point-max))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1863 (skip-chars-backward " \t")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1864 (delete-region (point) (point-max))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1865 (goto-char (point-min))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1866 (if (looking-at "movemail: ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1867 (delete-region (point-min) (match-end 0)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1868 (beep t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1869 ;; If we just read the password, most likely it is
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1870 ;; wrong. Otherwise, see if there is a specific
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1871 ;; reason to think that the problem is a wrong passwd.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1872 (if (or got-password
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1873 (re-search-forward pmail-remote-password-error
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1874 nil t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1875 (pmail-set-remote-password nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1876
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1877 ;; If using Mailutils, remove initial error code
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1878 ;; abbreviation
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1879 (when (pmail-movemail-variant-p 'mailutils)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1880 (goto-char (point-min))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1881 (when (looking-at "[A-Z][A-Z0-9_]*:")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1882 (delete-region (point-min) (match-end 0))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1883
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1884 (message "movemail: %s"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1885 (buffer-substring (point-min)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1886 (point-max)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1887
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1888 (sit-for 3)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1889 nil)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1890
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1891 ;; At this point, TOFILE contains the name to read:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1892 ;; Either the alternate name (if we renamed)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1893 ;; or the actual inbox (if not renaming).
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1894 (if (file-exists-p tofile)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1895 (let ((coding-system-for-read 'no-conversion)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1896 size)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1897 (goto-char (point-max))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1898 (setq size (nth 1 (insert-file-contents tofile)))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1899 ;; Determine if a pair of newline message separators need
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1900 ;; to be added to the new collection of messages. This is
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1901 ;; the case for all new message collections added to a
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1902 ;; non-empty mail file.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1903 (unless (zerop size)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1904 (save-restriction
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1905 (let ((start (point-min)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1906 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1907 (unless (eq start (point-min))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1908 (goto-char start)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1909 (insert "\n\n")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1910 (setq size (+ 2 size))))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1911 (goto-char (point-max))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1912 (or (= (preceding-char) ?\n)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1913 (zerop size)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1914 (insert ?\n))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1915 (if (not (and pmail-preserve-inbox (string= file tofile)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1916 (setq delete-files (cons tofile delete-files)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1917 (message "")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1918 (setq files (cdr files)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1919 delete-files))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1920
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1921 ;; Decode the region specified by FROM and TO by CODING.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1922 ;; If CODING is nil or an invalid coding system, decode by `undecided'.
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
1923 (defun pmail-decode-region (from to coding &optional destination)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1924 (if (or (not coding) (not (coding-system-p coding)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1925 (setq coding 'undecided))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1926 ;; Use -dos decoding, to remove ^M characters left from base64 or
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1927 ;; rogue qp-encoded text.
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
1928 (decode-coding-region
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
1929 from to (coding-system-change-eol-conversion coding 1) destination)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1930 ;; Don't reveal the fact we used -dos decoding, as users generally
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1931 ;; will not expect the PMAIL buffer to use DOS EOL format.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1932 (setq buffer-file-coding-system
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1933 (setq last-coding-system-used
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1934 (coding-system-change-eol-conversion coding 0))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1935
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1936 (defun pmail-add-mbox-headers ()
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1937 "Validate the RFC2822 format for the new messages.
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1938 Point should be at the first new message.
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1939 An error is signalled if the new messages are not RFC2822
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1940 compliant.
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1941 Unless an Rmail attribute header already exists, add it to the
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
1942 new messages. Return the number of new messages."
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1943 (save-excursion
100580
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1944 (save-restriction
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1945 (let ((count 0)
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1946 (start (point))
100756
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
1947 (value "------U-")
100580
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1948 limit)
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1949 ;; Detect an empty inbox file.
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1950 (unless (= start (point-max))
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1951 ;; Scan the new messages to establish a count and to insure that
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1952 ;; an attribute header is present.
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1953 (while (looking-at "From ")
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1954 ;; Determine if a new attribute header needs to be added to
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1955 ;; the message.
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1956 (if (search-forward "\n\n" nil t)
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1957 (progn
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1958 (setq count (1+ count))
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1959 (narrow-to-region start (point))
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1960 (unless (mail-fetch-field pmail-attribute-header)
100584
af07ce58a8d5 (pmail-add-header): Function deleted.
Chong Yidong <cyd@stupidchicken.com>
parents: 100581
diff changeset
1961 (backward-char 1)
af07ce58a8d5 (pmail-add-header): Function deleted.
Chong Yidong <cyd@stupidchicken.com>
parents: 100581
diff changeset
1962 (insert pmail-attribute-header ": " value "\n"))
100580
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1963 (widen))
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1964 (pmail-error-bad-format))
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1965 ;; Move to the next message.
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1966 (if (search-forward "\n\nFrom " nil 'move)
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1967 (forward-char -5))
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1968 (setq start (point))))
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
1969 count))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1970
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1971 (defun pmail-get-header (name &optional msgnum)
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1972 "Return the value of message header NAME, nil if it has none.
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1973 MSGNUM specifies the message number to get it from.
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1974 If MSGNUM is nil, use the current message."
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1975 (with-current-buffer pmail-buffer
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1976 (or msgnum (setq msgnum pmail-current-message))
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1977 (when (> msgnum 0)
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1978 (let (msgbeg end)
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1979 (setq msgbeg (pmail-msgbeg msgnum))
100654
2fedbb810d01 (pmail-display-labels): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100648
diff changeset
1980 ;; All access to the buffer's local variables is now finished...
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1981 (save-excursion
100654
2fedbb810d01 (pmail-display-labels): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100648
diff changeset
1982 ;; ... so it is ok to go to a different buffer.
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1983 (if (pmail-buffers-swapped-p) (set-buffer pmail-view-buffer))
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1984 (save-restriction
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1985 (widen)
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1986 (save-excursion
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1987 (goto-char msgbeg)
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1988 (setq end (search-forward "\n\n" nil t))
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1989 (if end
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1990 (progn
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1991 (narrow-to-region msgbeg end)
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1992 (mail-fetch-field name))
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1993 (pmail-error-bad-format msgnum)))))))))
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
1994
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1995 (defun pmail-set-header (name &optional msgnum value)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1996 "Store VALUE in message header NAME, nil if it has none.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1997 MSGNUM specifies the message number to operate on.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1998 If MSGNUM is nil, use the current message."
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
1999 (with-current-buffer pmail-buffer
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2000 (or msgnum (setq msgnum pmail-current-message))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2001 (when (> msgnum 0)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2002 (let (msgbeg end)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2003 (setq msgbeg (pmail-msgbeg msgnum))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2004 ;; All access to the buffer's local variables is now finished...
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2005 (save-excursion
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2006 ;; ... so it is ok to go to a different buffer.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2007 (if (pmail-buffers-swapped-p) (set-buffer pmail-view-buffer))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2008 (save-restriction
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2009 (widen)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2010 (save-excursion
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2011 (goto-char msgbeg)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2012 (setq end (search-forward "\n\n" nil t))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2013 (if end (setq end (1- end)))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2014 (if end
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2015 (progn
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2016 (narrow-to-region msgbeg end)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2017 (goto-char msgbeg)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2018 (if (re-search-forward (concat "^"
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2019 (regexp-quote name)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2020 ":")
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2021 nil t)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2022 (progn
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2023 (delete-region (point) (line-end-position))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2024 (insert " " value))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2025 (goto-char end)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2026 (insert name ": " value "\n")))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2027 (pmail-error-bad-format msgnum)))))))))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2028
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2029 ;;;; *** Pmail Attributes and Keywords ***
100437
3f79b3dad1ed * pmail.el (pmail-require-mime-maybe): Fix arguments of `display-warning'.
Juanma Barranquero <lekktu@gmail.com>
parents: 100435
diff changeset
2030
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2031 (defun pmail-get-attr-names (&optional msg)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2032 "Return the message attributes in a comma separated string.
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2033 MSG specifies the message number to get it from.
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2034 If MSG is nil, use the current message."
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2035 (let ((value (pmail-get-header pmail-attribute-header msg))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2036 result temp)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2037 (dotimes (index (length value))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2038 (setq temp (and (not (= ?- (aref value index)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2039 (nth 1 (aref pmail-attr-array index)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2040 result
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2041 (cond
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2042 ((and temp result) (format "%s, %s" result temp))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2043 (temp temp)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2044 (t result))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2045 result))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2046
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2047 (defun pmail-get-keywords (&optional msg)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2048 "Return the message keywords in a comma separated string.
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2049 MSG, if non-nil, identifies the message number to use.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2050 If nil, that means the current message."
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2051 (pmail-get-header pmail-keyword-header msg))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2052
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2053 (defun pmail-get-labels (&optional msg)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2054 "Return a string with the labels (attributes and keywords) of msg MSG.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2055 It is put in comma-separated form.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2056 MSG, if non-nil, identifies the message number to use.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2057 If nil, that means the current message."
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2058 (let (blurb attr-names keywords)
100654
2fedbb810d01 (pmail-display-labels): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100648
diff changeset
2059 ;; Combine the message attributes and keywords
2fedbb810d01 (pmail-display-labels): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100648
diff changeset
2060 ;; into a comma-separated list.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2061 (setq attr-names (pmail-get-attr-names pmail-current-message)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2062 keywords (pmail-get-keywords pmail-current-message))
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2063 (if (string= keywords "")
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2064 (setq keywords nil))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2065 (cond
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2066 ((and attr-names keywords) (concat " " attr-names ", " keywords))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2067 (attr-names (concat " " attr-names))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2068 (keywords (concat " " keywords))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2069 (t ""))))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2070
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2071 (defun pmail-display-labels ()
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2072 "Update the current messages's attributes and keywords in mode line."
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2073 (let ((blurb (pmail-get-labels)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2074 (setq mode-line-process
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2075 (format " %d/%d%s"
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2076 pmail-current-message pmail-total-messages blurb))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2077 ;; If pmail-enable-mime is non-nil, we may have to update
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2078 ;; `mode-line-process' of pmail-view-buffer too.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2079 (if (and pmail-enable-mime
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2080 (not (eq (current-buffer) pmail-view-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2081 (buffer-live-p pmail-view-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2082 (let ((mlp mode-line-process))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2083 (with-current-buffer pmail-view-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2084 (setq mode-line-process mlp))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2085
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2086 (defun pmail-get-attr-value (attr state)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2087 "Return the character value for ATTR.
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2088 ATTR is a (numeric) index, an offset into the mbox attribute
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2089 header value. STATE is one of nil, t, or a character value."
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2090 (cond
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2091 ((numberp state) state)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2092 ((not state) ?-)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2093 (t (nth 0 (aref pmail-attr-array attr)))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2094
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2095 (defun pmail-set-attribute (attr state &optional msgnum)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2096 "Turn an attribute of a message on or off according to STATE.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2097 STATE is either nil or the character (numeric) value associated
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2098 with the state (nil represents off and non-nil represents on).
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2099 ATTR is the index of the attribute. MSGNUM is message number to
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2100 change; nil means current message."
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2101 (with-current-buffer pmail-buffer
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2102 (let ((value (pmail-get-attr-value attr state))
100654
2fedbb810d01 (pmail-display-labels): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100648
diff changeset
2103 (inhibit-read-only t)
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2104 limit
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2105 altered
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2106 msgbeg)
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2107 (or msgnum (setq msgnum pmail-current-message))
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2108 (when (> msgnum 0)
100654
2fedbb810d01 (pmail-display-labels): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100648
diff changeset
2109 ;; The "deleted" attribute is also stored in a special vector
2fedbb810d01 (pmail-display-labels): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100648
diff changeset
2110 ;; so update that too.
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2111 (if (= attr pmail-deleted-attr-index)
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2112 (pmail-set-message-deleted-p msgnum state))
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2113 (setq msgbeg (pmail-msgbeg msgnum))
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2114
100654
2fedbb810d01 (pmail-display-labels): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100648
diff changeset
2115 ;; All access to the buffer's local variables is now finished...
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2116 (unwind-protect
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2117 (save-excursion
100654
2fedbb810d01 (pmail-display-labels): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100648
diff changeset
2118 ;; ... so it is ok to go to a different buffer.
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2119 (if (pmail-buffers-swapped-p) (set-buffer pmail-view-buffer))
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2120 (save-restriction
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2121 (widen)
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2122 (save-excursion
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2123 ;; Determine if the current state is the desired state.
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2124 (goto-char msgbeg)
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2125 (save-excursion
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2126 (setq limit (search-forward "\n\n" nil t)))
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2127 (if (search-forward (concat pmail-attribute-header ": ") limit t)
100654
2fedbb810d01 (pmail-display-labels): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100648
diff changeset
2128 ;; If this message already records attributes,
2fedbb810d01 (pmail-display-labels): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100648
diff changeset
2129 ;; just change the value for this one.
100756
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2130 (let ((missing (- (+ (point) attr) (line-end-position))))
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2131 ;; Position point at this attribute,
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2132 ;; adding attributes if necessary.
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2133 (if (> missing 0)
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2134 (progn
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2135 (end-of-line)
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2136 (insert-char ?- missing)
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2137 (backward-char 1))
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2138 (forward-char attr))
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2139 ;; Change this attribute.
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2140 (when (/= value (char-after))
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2141 (setq altered t)
100756
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2142 (delete-char 1)
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2143 (insert value)))
100654
2fedbb810d01 (pmail-display-labels): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100648
diff changeset
2144 ;; Otherwise add a header line to record the attributes
100756
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2145 ;; and set all but this one to no.
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2146 (let ((header-value "--------"))
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2147 (aset header-value attr value)
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2148 (goto-char (if limit (- limit 1) (point-max)))
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2149 (setq altered (/= value ?-))
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2150 (insert pmail-attribute-header ": " header-value "\n"))))))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2151 (if (= msgnum pmail-current-message)
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2152 (pmail-display-labels))))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2153 ;; If we made a significant change in an attribute,
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2154 ;; mark pmail-buffer modified, so it will be (1) saved
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2155 ;; and (2) displayed in the mode line.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2156 (if altered
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2157 (set-buffer-modified-p t)))))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2158
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2159 (defun pmail-message-attr-p (msg attrs)
100654
2fedbb810d01 (pmail-display-labels): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100648
diff changeset
2160 "Return t if the attributes header for message MSG matches regexp ATTRS.
2fedbb810d01 (pmail-display-labels): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100648
diff changeset
2161 This function assumes the Pmail buffer is unswapped."
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2162 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2163 (save-restriction
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2164 (let ((start (pmail-msgbeg msg))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2165 limit)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2166 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2167 (goto-char start)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2168 (setq limit (search-forward "\n\n" (pmail-msgend msg) t))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2169 (goto-char start)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2170 (and limit
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2171 (search-forward (concat pmail-attribute-header ": ") limit t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2172 (looking-at attrs))))))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2173
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2174 (defun pmail-message-unseen-p (msgnum)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2175 "Test the unseen attribute for message MSGNUM.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2176 Return non-nil if the unseen attribute is set, nil otherwise."
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2177 (pmail-message-attr-p msgnum "......U"))
101302
f91a3fe4adb9 (pmail-last-label, pmail-last-multi-labels):
Glenn Morris <rgm@gnu.org>
parents: 101256
diff changeset
2178
101303
0dafb06ce90e Restore comment lost in previous change.
Glenn Morris <rgm@gnu.org>
parents: 101302
diff changeset
2179 ;; Return t if the attributes/keywords line of msg number MSG
0dafb06ce90e Restore comment lost in previous change.
Glenn Morris <rgm@gnu.org>
parents: 101302
diff changeset
2180 ;; contains a match for the regexp LABELS.
101302
f91a3fe4adb9 (pmail-last-label, pmail-last-multi-labels):
Glenn Morris <rgm@gnu.org>
parents: 101256
diff changeset
2181 (defun pmail-message-labels-p (msg labels)
f91a3fe4adb9 (pmail-last-label, pmail-last-multi-labels):
Glenn Morris <rgm@gnu.org>
parents: 101256
diff changeset
2182 (string-match labels (pmail-get-labels msg)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2183
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2184 ;;;; *** Pmail Message Selection And Support ***
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2185
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2186 (defun pmail-msgend (n)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2187 (marker-position (aref pmail-message-vector (1+ n))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2188
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2189 (defun pmail-msgbeg (n)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2190 (marker-position (aref pmail-message-vector n)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2191
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2192 (defun pmail-apply-in-message (msgnum function &rest args)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2193 "Call FUNCTION on ARGS while narrowed to message MSGNUM.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2194 Point is at the start of the message.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2195 This returns what the call to FUNCTION returns.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2196 If MSGNUM is nil, use the current message."
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2197 (with-current-buffer pmail-buffer
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2198 (or msgnum (setq msgnum pmail-current-message))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2199 (when (> msgnum 0)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2200 (let (msgbeg msgend)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2201 (setq msgbeg (pmail-msgbeg msgnum))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2202 (setq msgend (pmail-msgend msgnum))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2203 ;; All access to the pmail-buffer's local variables is now finished...
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2204 (save-excursion
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2205 ;; ... so it is ok to go to a different buffer.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2206 (if (pmail-buffers-swapped-p) (set-buffer pmail-view-buffer))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2207 (save-restriction
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2208 (widen)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2209 (save-excursion
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2210 (goto-char msgbeg)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2211 (save-restriction
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2212 (narrow-to-region msgbeg msgend)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2213 (apply function args)))))))))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2214
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2215 (defun pmail-widen-to-current-msgbeg (function)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2216 "Call FUNCTION with point at start of internal data of current message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2217 Assumes that bounds were previously narrowed to display the message in Pmail.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2218 The bounds are widened enough to move point where desired, then narrowed
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2219 again afterward.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2220
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2221 FUNCTION may not change the visible text of the message, but it may
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2222 change the invisible header text."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2223 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2224 (unwind-protect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2225 (progn
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2226 (narrow-to-region (pmail-msgbeg pmail-current-message)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2227 (point-max))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2228 (goto-char (point-min))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2229 (funcall function))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2230 ;; Note: we don't use save-restriction because that does not work right
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2231 ;; if changes are made outside the saved restriction
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2232 ;; before that restriction is restored.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2233 (narrow-to-region (pmail-msgbeg pmail-current-message)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2234 (pmail-msgend pmail-current-message)))))
101077
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2235
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2236 ;; Manage the message vectors and counters.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2237
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2238 (defun pmail-forget-messages ()
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2239 (unwind-protect
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2240 (if (vectorp pmail-message-vector)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2241 (let* ((i 0)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2242 (v pmail-message-vector)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2243 (n (length v)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2244 (while (< i n)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2245 (move-marker (aref v i) nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2246 (setq i (1+ i)))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2247 (setq pmail-message-vector nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2248 (setq pmail-msgref-vector nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2249 (setq pmail-deleted-vector nil)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2250
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2251 (defun pmail-maybe-set-message-counters ()
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2252 (if (not (and pmail-deleted-vector
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2253 pmail-message-vector
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2254 pmail-current-message
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2255 pmail-total-messages))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2256 (pmail-set-message-counters)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2257
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2258 (defun pmail-count-new-messages (&optional nomsg)
100580
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
2259 "Count the number of new messages.
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
2260 The buffer should be narrowed to include only the new messages.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2261 Output a helpful message unless NOMSG is non-nil."
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2262 (let* ((case-fold-search nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2263 (total-messages 0)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2264 (messages-head nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2265 (deleted-head nil))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2266 (or nomsg (message "Counting new messages..."))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2267 (goto-char (point-max))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2268 ;; Put at the end of messages-head
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2269 ;; the entry for message N+1, which marks
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2270 ;; the end of message N. (N = number of messages).
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2271 (setq messages-head (list (point-marker)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2272 (pmail-set-message-counters-counter (point-min))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2273 (setq pmail-current-message (1+ pmail-total-messages))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2274 (setq pmail-total-messages
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2275 (+ pmail-total-messages total-messages))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2276 (setq pmail-message-vector
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2277 (vconcat pmail-message-vector (cdr messages-head)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2278 (aset pmail-message-vector
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2279 pmail-current-message (car messages-head))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2280 (setq pmail-deleted-vector
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2281 (concat pmail-deleted-vector deleted-head))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2282 (setq pmail-summary-vector
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2283 (vconcat pmail-summary-vector (make-vector total-messages nil)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2284 (setq pmail-msgref-vector
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2285 (vconcat pmail-msgref-vector (make-vector total-messages nil)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2286 ;; Fill in the new elements of pmail-msgref-vector.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2287 (let ((i (1+ (- pmail-total-messages total-messages))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2288 (while (<= i pmail-total-messages)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2289 (aset pmail-msgref-vector i (list i))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2290 (setq i (1+ i))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2291 (goto-char (point-min))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2292 (or nomsg (message "Counting new messages...done (%d)" total-messages))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2293
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2294 (defun pmail-set-message-counters ()
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2295 (pmail-forget-messages)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2296 (save-excursion
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2297 (save-restriction
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2298 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2299 (let* ((point-save (point))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2300 (total-messages 0)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2301 (messages-after-point)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2302 (case-fold-search nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2303 (messages-head nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2304 (deleted-head nil))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2305 ;; Determine how many messages follow point.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2306 (message "Counting messages...")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2307 (goto-char (point-max))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2308 ;; Put at the end of messages-head
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2309 ;; the entry for message N+1, which marks
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2310 ;; the end of message N. (N = number of messages).
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2311 (setq messages-head (list (point-marker)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2312 (pmail-set-message-counters-counter (min (point) point-save))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2313 (setq messages-after-point total-messages)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2314
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2315 ;; Determine how many precede point.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2316 (pmail-set-message-counters-counter)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2317 (setq pmail-total-messages total-messages)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2318 (setq pmail-current-message
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2319 (min total-messages
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2320 (max 1 (- total-messages messages-after-point))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2321 (setq pmail-message-vector
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2322 (apply 'vector (cons (point-min-marker) messages-head))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2323 pmail-deleted-vector (concat "0" deleted-head)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2324 pmail-summary-vector (make-vector pmail-total-messages nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2325 pmail-msgref-vector (make-vector (1+ pmail-total-messages) nil))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2326 (let ((i 0))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2327 (while (<= i pmail-total-messages)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2328 (aset pmail-msgref-vector i (list i))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2329 (setq i (1+ i))))
101256
f77a0ad64329 (buffer-swapped-with): Mark as permanent local.
Richard M. Stallman <rms@gnu.org>
parents: 101077
diff changeset
2330 (let ((i 0))
f77a0ad64329 (buffer-swapped-with): Mark as permanent local.
Richard M. Stallman <rms@gnu.org>
parents: 101077
diff changeset
2331 (while (<= i pmail-total-messages)
f77a0ad64329 (buffer-swapped-with): Mark as permanent local.
Richard M. Stallman <rms@gnu.org>
parents: 101077
diff changeset
2332 (pmail-set-message-deleted-p i (pmail-message-attr-p i ".D"))
f77a0ad64329 (buffer-swapped-with): Mark as permanent local.
Richard M. Stallman <rms@gnu.org>
parents: 101077
diff changeset
2333 (setq i (1+ i))))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2334 (message "Counting messages...done")))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2335
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2336
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2337 (defsubst pmail-collect-deleted (message-end)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2338 "Collect the message deletion flags for each message.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2339 MESSAGE-END is the buffer position corresponding to the end of
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2340 the message. Point is at the beginning of the message."
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2341 ;; NOTE: This piece of code will be executed on a per-message basis.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2342 ;; In the face of thousands of messages, it has to be as fast as
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2343 ;; possible, hence some brute force constant use is employed in
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2344 ;; addition to inlining.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2345 (save-excursion
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2346 (setq deleted-head
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2347 (cons (if (and (search-forward (concat pmail-attribute-header ": ") message-end t)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2348 (looking-at "?D"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2349 ?D
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2350 ?\ ) deleted-head))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2351
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2352 (defun pmail-set-message-counters-counter (&optional stop)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2353 ;; Collect the start position for each message into 'messages-head.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2354 (let ((start (point)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2355 (while (search-backward "\n\nFrom " stop t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2356 (forward-char 2)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2357 (pmail-collect-deleted start)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2358 (setq messages-head (cons (point-marker) messages-head)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2359 total-messages (1+ total-messages)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2360 start (point))
100580
bdc51ab0f703 (pmail-get-new-mail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100437
diff changeset
2361 ;; Show progress after every 20 messages or so.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2362 (if (zerop (% total-messages 20))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2363 (message "Counting messages...%d" total-messages)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2364 ;; Handle the first message, maybe.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2365 (if stop
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2366 (goto-char stop)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2367 (goto-char (point-min)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2368 (unless (not (looking-at "From "))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2369 (pmail-collect-deleted start)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2370 (setq messages-head (cons (point-marker) messages-head)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2371 total-messages (1+ total-messages)))))
101077
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2372
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2373 ;; Display a message.
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2374
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2375 ;;;; *** Pmail Message Formatting and Header Manipulation ***
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2376
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2377 (defun pmail-toggle-header (&optional arg)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2378 "Show original message header if pruned header currently shown, or vice versa.
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2379 With argument ARG, show the message header pruned if ARG is greater than zero;
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2380 otherwise, show it in full."
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2381 (interactive "P")
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2382 (setq pmail-header-style
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2383 (cond
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2384 ((and (numberp arg) (> arg 0)) 'normal)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2385 ((eq pmail-header-style 'full) 'normal)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2386 (t 'full)))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2387 (pmail-show-message-maybe))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2388
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2389 (defun pmail-beginning-of-message ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2390 "Show current message starting from the beginning."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2391 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2392 (let ((pmail-show-message-hook
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2393 (list (function (lambda ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2394 (goto-char (point-min)))))))
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2395 (pmail-show-message-maybe pmail-current-message)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2396
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2397 (defun pmail-end-of-message ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2398 "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
2399 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2400 (let ((pmail-show-message-hook
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2401 (list (function (lambda ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2402 (goto-char (point-max))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2403 (recenter (1- (window-height))))))))
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2404 (pmail-show-message-maybe pmail-current-message)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2405
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2406 (defun pmail-unknown-mail-followup-to ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2407 "Handle a \"Mail-Followup-To\" header field with an unknown mailing list.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2408 Ask the user whether to add that list name to `mail-mailing-lists'."
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2409 (save-restriction
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2410 (let ((mail-followup-to (mail-fetch-field "mail-followup-to" nil t)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2411 (when mail-followup-to
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2412 (let ((addresses
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2413 (split-string
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2414 (mail-strip-quoted-names mail-followup-to)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2415 ",[[:space:]]+" t)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2416 (dolist (addr addresses)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2417 (when (and (not (member addr mail-mailing-lists))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2418 (not
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2419 ;; taken from pmailsum.el
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2420 (string-match
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2421 (or pmail-user-mail-address-regexp
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2422 (concat "^\\("
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2423 (regexp-quote (user-login-name))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2424 "\\($\\|@\\)\\|"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2425 (regexp-quote
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2426 (or user-mail-address
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2427 (concat (user-login-name) "@"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2428 (or mail-host-address
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2429 (system-name)))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2430 "\\>\\)"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2431 addr))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2432 (y-or-n-p
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2433 (format "Add `%s' to `mail-mailing-lists'? "
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2434 addr)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2435 (customize-save-variable 'mail-mailing-lists
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2436 (cons addr mail-mailing-lists)))))))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2437
100756
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2438 (defun pmail-widen ()
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2439 "Display the entire mailbox file."
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2440 (interactive)
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2441 (pmail-swap-buffers-maybe)
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2442 (widen))
101077
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2443
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2444 (defun pmail-show-message-maybe (&optional n no-summary)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2445 "Show message number N (prefix argument), counting from start of file.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2446 If summary buffer is currently displayed, update current message there also."
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2447 (interactive "p")
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2448 (or (eq major-mode 'pmail-mode)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2449 (switch-to-buffer pmail-buffer))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2450 (pmail-swap-buffers-maybe)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2451 (pmail-maybe-set-message-counters)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2452 (widen)
98789
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
2453 (let ((msgnum (or n pmail-current-message))
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
2454 blurb)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2455 (if (zerop pmail-total-messages)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2456 (save-excursion
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2457 (with-current-buffer pmail-view-buffer
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2458 (erase-buffer)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2459 (setq blurb "No mail.")))
98789
e94744a9d7b1 (pmail): Remove a redundant message counter reset call; try to
Paul Reilly <pmr@pajato.com>
parents: 98707
diff changeset
2460 (setq blurb (pmail-show-message msgnum))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2461 (when mail-mailing-lists
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2462 (pmail-unknown-mail-followup-to))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2463 (if transient-mark-mode (deactivate-mark))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2464 ;; If there is a summary buffer, try to move to this message
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2465 ;; in that buffer. But don't complain if this message
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2466 ;; is not mentioned in the summary.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2467 ;; Don't do this at all if we were called on behalf
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2468 ;; of cursor motion in the summary buffer.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2469 (and (pmail-summary-exists) (not no-summary)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2470 (let ((curr-msg pmail-current-message))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2471 (pmail-select-summary
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2472 (pmail-summary-goto-msg curr-msg t t))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2473 (with-current-buffer pmail-buffer
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2474 (pmail-auto-file)))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2475 (if blurb
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2476 (message blurb))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2477
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2478 (defun pmail-is-text-p ()
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2479 "Return t if the region contains a text message, nil otherwise."
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2480 (save-excursion
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2481 (let ((text-regexp "\\(text\\|message\\)/")
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2482 (content-type-header (mail-fetch-field "content-type")))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2483 ;; The message is text if either there is no content type header
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2484 ;; (a default of "text/plain; charset=US-ASCII" is assumed) or
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2485 ;; the base content type is either text or message.
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2486 (or (not content-type-header)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2487 (string-match text-regexp content-type-header)))))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2488
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2489 (defun pmail-show-message (&optional msg)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2490 "Show message MSG using a special view buffer.
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2491 Return text to display in the minibuffer if MSG is out of
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2492 range (displaying a reasonable choice as well), nil otherwise.
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2493 The current mail message becomes the message displayed."
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2494 (let ((mbox-buf pmail-buffer)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2495 (view-buf pmail-view-buffer)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2496 blurb beg end body-start coding-system character-coding is-text-message)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2497 (if (not msg)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2498 (setq msg pmail-current-message))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2499 (cond ((<= msg 0)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2500 (setq msg 1
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2501 pmail-current-message 1
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2502 blurb "No previous message"))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2503 ((> msg pmail-total-messages)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2504 (setq msg pmail-total-messages
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2505 pmail-current-message pmail-total-messages
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2506 blurb "No following message"))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2507 (t (setq pmail-current-message msg)))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2508 (with-current-buffer pmail-buffer
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2509 ;; Mark the message as seen, bracket the message in the mail
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2510 ;; buffer and determine the coding system the transfer encoding.
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2511 (pmail-set-attribute pmail-unseen-attr-index nil)
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
2512 (pmail-swap-buffers-maybe)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2513 (setq beg (pmail-msgbeg msg)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2514 end (pmail-msgend msg))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2515 (narrow-to-region beg end)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2516 (goto-char beg)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2517 (setq body-start (search-forward "\n\n" nil t))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2518 (narrow-to-region beg (point))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2519 (goto-char beg)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2520 (setq character-coding (mail-fetch-field "content-transfer-encoding")
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2521 is-text-message (pmail-is-text-p)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2522 coding-system (pmail-get-coding-system))
100756
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2523 (if character-coding
d9d23e4f6b00 (pmail-forwarded-attr-index): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 100657
diff changeset
2524 (setq character-coding (downcase character-coding)))
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2525 (narrow-to-region beg end)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2526 ;; Decode the message body into an empty view buffer using a
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2527 ;; unibyte temporary buffer where the character decoding takes
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2528 ;; place.
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2529 (with-current-buffer pmail-view-buffer
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2530 (erase-buffer))
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2531 (if (null character-coding)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2532 ;; Do it directly since that is fast.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2533 (pmail-decode-region body-start end coding-system view-buf)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2534 ;; Can this be done directly, skipping the temp buffer?
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2535 (with-temp-buffer
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2536 (set-buffer-multibyte nil)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2537 (insert-buffer-substring mbox-buf body-start end)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2538 (cond
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2539 ((string= character-coding "quoted-printable")
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2540 (mail-unquote-printable-region (point-min) (point-max)))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2541 ((and (string= character-coding "base64") is-text-message)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2542 (base64-decode-region (point-min) (point-max)))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2543 ((eq character-coding 'uuencode)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2544 (error "Not supported yet"))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2545 (t))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2546 (pmail-decode-region (point-min) (point-max)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2547 coding-system view-buf)))
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2548 ;; Copy the headers to the front of the message view buffer.
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2549 (with-current-buffer pmail-view-buffer
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2550 (goto-char (point-min)))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2551 (pmail-copy-headers beg end)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2552 ;; Add the separator (blank line) between headers and body;
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2553 ;; highlight the message, activate any URL like text and add
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2554 ;; special highlighting for and quoted material.
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2555 (with-current-buffer pmail-view-buffer
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2556 (insert "\n")
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2557 (goto-char (point-min))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2558 (pmail-highlight-headers)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2559 ;(pmail-activate-urls)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2560 ;(pmail-process-quoted-material)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2561 )
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2562 ;; Update the mode-line with message status information and swap
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2563 ;; the view buffer/mail buffer contents.
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2564 (pmail-display-labels)
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2565 (let ((modp (buffer-modified-p)))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2566 (buffer-swap-text pmail-view-buffer)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2567 (set-buffer-modified-p modp))
101341
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
2568 (setq pmail-buffer-swapped t)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2569 (run-hooks 'pmail-show-message-hook))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2570 blurb))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2571
101077
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2572 (defun pmail-copy-headers (beg end &optional ignored-headers)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2573 "Copy displayed header fields to the message viewer buffer.
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2574 BEG and END marks the start and end positions of the message in
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2575 the mbox buffer. If the optional argument IGNORED-HEADERS is
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2576 non-nil, ignore all header fields whose names match that regexp.
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2577 Otherwise, if `rmail-displayed-headers' is non-nil, copy only
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2578 those header fields whose names match that regexp. Otherwise,
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2579 copy all header fields whose names do not match
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2580 `rmail-ignored-headers' (unless they also match
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2581 `rmail-nonignored-headers')."
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2582 (let ((header-start-regexp "\n[^ \t]")
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2583 lim)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2584 (with-current-buffer pmail-buffer
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2585 (when (search-forward "\n\n" nil t)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2586 (forward-char -1)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2587 (save-restriction
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2588 ;; Put point right after the From header line.
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2589 (narrow-to-region beg (point))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2590 (goto-char (point-min))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2591 (unless (re-search-forward header-start-regexp nil t)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2592 (pmail-error-bad-format))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2593 (forward-char -1)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2594 (cond
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2595 ;; Handle the case where all headers should be copied.
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2596 ((eq pmail-header-style 'full)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2597 (prepend-to-buffer pmail-view-buffer beg (point-max)))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2598 ;; Handle the case where the headers matching the diplayed
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2599 ;; headers regexp should be copied.
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2600 ((and pmail-displayed-headers (null ignored-headers))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2601 (while (not (eobp))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2602 (save-excursion
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2603 (setq lim (if (re-search-forward header-start-regexp nil t)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2604 (1+ (match-beginning 0))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2605 (point-max))))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2606 (when (looking-at pmail-displayed-headers)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2607 (append-to-buffer pmail-view-buffer (point) lim))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2608 (goto-char lim)))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2609 ;; Handle the ignored headers.
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2610 ((or ignored-headers (setq ignored-headers pmail-ignored-headers))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2611 (while (and ignored-headers (not (eobp)))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2612 (save-excursion
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2613 (setq lim (if (re-search-forward header-start-regexp nil t)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2614 (1+ (match-beginning 0))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2615 (point-max))))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2616 (if (and (looking-at ignored-headers)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2617 (not (looking-at pmail-nonignored-headers)))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2618 (goto-char lim)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2619 (append-to-buffer pmail-view-buffer (point) lim)
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2620 (goto-char lim))))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2621 (t (error "No headers selected for display!"))))))))
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2622
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2623 ;; Find all occurrences of certain fields, and highlight them.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2624 (defun pmail-highlight-headers ()
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2625 ;; Do this only if the system supports faces.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2626 (if (and (fboundp 'internal-find-face)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2627 pmail-highlighted-headers)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2628 (save-excursion
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2629 (search-forward "\n\n" nil 'move)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2630 (save-restriction
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2631 (narrow-to-region (point-min) (point))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2632 (let ((case-fold-search t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2633 (inhibit-read-only t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2634 ;; Highlight with boldface if that is available.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2635 ;; Otherwise use the `highlight' face.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2636 (face (or 'pmail-highlight
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2637 (if (face-differs-from-default-p 'bold)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2638 'bold 'highlight)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2639 ;; List of overlays to reuse.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2640 (overlays pmail-overlay-list))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2641 (goto-char (point-min))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2642 (while (re-search-forward pmail-highlighted-headers nil t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2643 (skip-chars-forward " \t")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2644 (let ((beg (point))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2645 overlay)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2646 (while (progn (forward-line 1)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2647 (looking-at "[ \t]")))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2648 ;; Back up over newline, then trailing spaces or tabs
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2649 (forward-char -1)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2650 (while (member (preceding-char) '(? ?\t))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2651 (forward-char -1))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2652 (if overlays
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2653 ;; Reuse an overlay we already have.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2654 (progn
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2655 (setq overlay (car overlays)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2656 overlays (cdr overlays))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2657 (overlay-put overlay 'face face)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2658 (move-overlay overlay beg (point)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2659 ;; Make a new overlay and add it to
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2660 ;; pmail-overlay-list.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2661 (setq overlay (make-overlay beg (point)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2662 (overlay-put overlay 'face face)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2663 (setq pmail-overlay-list
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2664 (cons overlay pmail-overlay-list))))))))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2665
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2666 (defun pmail-auto-file ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2667 "Automatically move a message into a sub-folder based on criteria.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2668 Called when a new message is displayed."
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2669 (if (or (zerop pmail-total-messages)
101256
f77a0ad64329 (buffer-swapped-with): Mark as permanent local.
Richard M. Stallman <rms@gnu.org>
parents: 101077
diff changeset
2670 (pmail-message-attr-p pmail-current-message "...F")
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2671 (not (string= (buffer-file-name)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2672 (expand-file-name pmail-file-name))))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2673 ;; Do nothing if the message has already been filed or if there
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2674 ;; are no messages.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2675 nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2676 ;; Find out some basics (common fields)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2677 (let ((from (mail-fetch-field "from"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2678 (subj (mail-fetch-field "subject"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2679 (to (concat (mail-fetch-field "to") "," (mail-fetch-field "cc")))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2680 (d pmail-automatic-folder-directives)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2681 (directive-loop nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2682 (folder nil))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2683 (while d
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2684 (setq folder (car (car d))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2685 directive-loop (cdr (car d)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2686 (while (and (car directive-loop)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2687 (let ((f (cond
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2688 ((string= (car directive-loop) "from") from)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2689 ((string= (car directive-loop) "to") to)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2690 ((string= (car directive-loop) "subject") subj)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2691 (t (mail-fetch-field (car directive-loop))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2692 (and f (string-match (car (cdr directive-loop)) f))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2693 (setq directive-loop (cdr (cdr directive-loop))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2694 ;; If there are no directives left, then it was a complete match.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2695 (if (null directive-loop)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2696 (if (null folder)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2697 (pmail-delete-forward)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2698 (if (string= "/dev/null" folder)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2699 (pmail-delete-message)
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2700 (pmail-output folder 1 t)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2701 (setq d nil))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2702 (setq d (cdr d))))))
101077
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2703
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2704 ;; Simple message motion commands.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2705
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2706 (defun pmail-next-message (n)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2707 "Show following message whether deleted or not.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2708 With prefix arg N, moves forward N messages, or backward if N is negative."
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2709 (interactive "p")
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2710 (set-buffer pmail-buffer)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2711 (pmail-maybe-set-message-counters)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2712 (pmail-show-message-maybe (+ pmail-current-message n)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2713
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2714 (defun pmail-previous-message (n)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2715 "Show previous message whether deleted or not.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2716 With prefix arg N, moves backward N messages, or forward if N is negative."
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2717 (interactive "p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2718 (pmail-next-message (- n)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2719
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2720 (defun pmail-next-undeleted-message (n)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2721 "Show following non-deleted message.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2722 With prefix arg N, moves forward N non-deleted messages,
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2723 or backward if N is negative.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2724
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2725 Returns t if a new message is being shown, nil otherwise."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2726 (interactive "p")
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2727 (set-buffer pmail-buffer)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2728 (pmail-maybe-set-message-counters)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2729 (let ((lastwin pmail-current-message)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2730 (current pmail-current-message))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2731 (while (and (> n 0) (< current pmail-total-messages))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2732 (setq current (1+ current))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2733 (if (not (pmail-message-deleted-p current))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2734 (setq lastwin current n (1- n))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2735 (while (and (< n 0) (> current 1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2736 (setq current (1- current))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2737 (if (not (pmail-message-deleted-p current))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2738 (setq lastwin current n (1+ n))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2739 (if (/= lastwin pmail-current-message)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2740 (progn (pmail-show-message-maybe lastwin)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2741 t)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2742 (if (< n 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2743 (message "No previous nondeleted message"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2744 (if (> n 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2745 (message "No following nondeleted message"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2746 nil)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2747
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2748 (defun pmail-previous-undeleted-message (n)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2749 "Show previous non-deleted message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2750 With prefix argument N, moves backward N non-deleted messages,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2751 or forward if N is negative."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2752 (interactive "p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2753 (pmail-next-undeleted-message (- n)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2754
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2755 (defun pmail-first-message ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2756 "Show first message in file."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2757 (interactive)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2758 (pmail-maybe-set-message-counters)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2759 (pmail-show-message-maybe (< 1 pmail-total-messages)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2760
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2761 (defun pmail-last-message ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2762 "Show last message in file."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2763 (interactive)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2764 (pmail-maybe-set-message-counters)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2765 (pmail-show-message-maybe pmail-total-messages))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2766
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2767 (defun pmail-what-message ()
101077
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2768 "For debugging Pmail: find the message number that point is in."
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2769 (let ((where (point))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2770 (low 1)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2771 (high pmail-total-messages)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2772 (mid (/ pmail-total-messages 2)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2773 (while (> (- high low) 1)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2774 (if (>= where (pmail-msgbeg mid))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2775 (setq low mid)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2776 (setq high mid))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2777 (setq mid (+ low (/ (- high low) 2))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2778 (if (>= where (pmail-msgbeg high)) high low)))
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2779
101077
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2780 ;; Searching in Pmail file.
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2781
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2782 (defun pmail-search-message (msg regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2783 "Return non-nil, if for message number MSG, regexp REGEXP matches."
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2784 ;; This is adequate because its only caller, pmail-search,
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2785 ;; unswaps the buffers.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2786 (goto-char (pmail-msgbeg msg))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2787 (if pmail-enable-mime
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2788 (funcall pmail-search-mime-message-function msg regexp)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2789 (re-search-forward regexp (pmail-msgend msg) t)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2790
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2791 (defvar pmail-search-last-regexp nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2792 (defun pmail-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
2793 "Show message containing next match for REGEXP (but not the current msg).
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2794 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
2795 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
2796 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
2797 (interactive
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2798 (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
2799 (prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2800 (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
2801 regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2802 (setq prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2803 (concat prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2804 (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
2805 (concat ", default "
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2806 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
2807 "): ")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2808 (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
2809 (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
2810 (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
2811 ((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
2812 (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
2813 (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
2814 (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
2815 (or n (setq n 1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2816 (message "%sPmail search for %s..."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2817 (if (< n 0) "Reverse " "")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2818 regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2819 (set-buffer pmail-buffer)
100433
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2820 (let ((orig-message pmail-current-message)
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2821 (msg pmail-current-message)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2822 (reversep (< n 0))
100640
40652147be0c (pmail-swap-buffers-maybe): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents: 100630
diff changeset
2823 (opoint (if (pmail-buffers-swapped-p) (point)))
100433
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2824 found)
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2825 (pmail-swap-buffers-maybe)
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2826 (pmail-maybe-set-message-counters)
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2827 (widen)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2828 (unwind-protect
100433
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2829 (while (/= n 0)
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2830 ;; Check messages one by one, advancing message number up or
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2831 ;; down but searching forward through each message.
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2832 (if reversep
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2833 (while (and (null found) (> msg 1))
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2834 (setq msg (1- msg)
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2835 found (pmail-search-message msg regexp)))
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2836 (while (and (null found) (< msg pmail-total-messages))
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2837 (setq msg (1+ msg)
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2838 found (pmail-search-message msg regexp))))
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2839 (setq n (+ n (if reversep 1 -1))))
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2840 (if found
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2841 (progn
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2842 (pmail-show-message-maybe msg)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2843 ;; Search forward (if this is a normal search) or backward
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2844 ;; (if this is a reverse search) through this message to
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2845 ;; position point. This search may fail because REGEXP
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2846 ;; was found in the hidden portion of this message. In
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2847 ;; that case, move point to the beginning of visible
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2848 ;; portion.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2849 (if reversep
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2850 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2851 (goto-char (point-max))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2852 (re-search-backward regexp nil 'move))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2853 (goto-char (point-min))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2854 (re-search-forward regexp nil t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2855 (message "%sPmail search for %s...done"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2856 (if reversep "Reverse " "")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2857 regexp))
100433
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2858 (pmail-show-message-maybe orig-message)
9c48475923d7 (pmail): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100379
diff changeset
2859 (if opoint (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
2860 (ding)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2861 (message "Search failed: %s" regexp)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2862
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2863 (defun pmail-search-backwards (regexp &optional n)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2864 "Show message containing previous match for REGEXP.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2865 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
2866 forward (through later messages).
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2867 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
2868 (interactive
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2869 (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
2870 (prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2871 (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
2872 regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2873 (setq prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2874 (concat prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2875 (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
2876 (concat ", default "
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2877 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
2878 "): ")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2879 (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
2880 (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
2881 (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
2882 ((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
2883 (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
2884 (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
2885 (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
2886 (pmail-search regexp (- (or n 1))))
101077
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2887
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2888 ;; Scan for attributes, and compare subjects.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2889
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2890 (defun pmail-first-unseen-message ()
101077
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
2891 "Return message number of first message which has `unseen' attribute."
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2892 (pmail-maybe-set-message-counters)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2893 (let ((current 1)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2894 found)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2895 (save-restriction
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2896 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2897 (while (and (not found) (<= current pmail-total-messages))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2898 (if (pmail-message-attr-p current "......U")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2899 (setq found current))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2900 (setq current (1+ current))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2901 found))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2902
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2903 (defun pmail-simplified-subject (&optional msgnum)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2904 "Return the simplified subject of message MSGNUM (or current message).
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2905 Simplifying the subject means stripping leading and trailing whitespace,
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2906 and typical reply prefixes such as Re:."
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2907 (let ((subject (or (pmail-get-header "Subject" msgnum) "")))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2908 (if (string-match "\\`[ \t]+" subject)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2909 (setq subject (substring subject (match-end 0))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2910 (if (string-match pmail-reply-regexp subject)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2911 (setq subject (substring subject (match-end 0))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2912 (if (string-match "[ \t]+\\'" subject)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2913 (setq subject (substring subject 0 (match-beginning 0))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2914 subject))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2915
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2916 (defun pmail-simplified-subject-regexp ()
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2917 "Return a regular expression matching the current simplified subject.
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2918 The idea is to match it against simplified subjects of other messages."
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2919 (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
2920 (setq subject (regexp-quote subject))
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2921 ;; Hide commas so it will work ok if parsed as a comma-separated list
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2922 ;; of regexps.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2923 (setq subject
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2924 (replace-regexp-in-string "," "\054" subject t t))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2925 (concat "\\`" subject "\\'")))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2926
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2927 (defun pmail-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
2928 "Go to the next mail message having the same subject header.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2929 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
2930 If N is negative, go backwards instead."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2931 (interactive "p")
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2932 (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
2933 (forward (> n 0))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2934 (i pmail-current-message)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2935 found)
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2936 (while (and (/= n 0)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2937 (if forward
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2938 (< i pmail-total-messages)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2939 (> i 1)))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2940 (let (done)
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2941 (while (and (not done)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2942 (if forward
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2943 (< i pmail-total-messages)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2944 (> i 1)))
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2945 (setq i (if forward (1+ i) (1- i)))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2946 (setq done (string-equal subject (pmail-simplified-subject i))))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2947 (if done (setq found i)))
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
2948 (setq n (if forward (1- n) (1+ n))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2949 (if found
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2950 (pmail-show-message-maybe found)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2951 (error "No %s message with same subject"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2952 (if forward "following" "previous")))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2953
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2954 (defun pmail-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
2955 "Go to the previous mail message having the same subject header.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2956 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
2957 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
2958 (interactive "p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2959 (pmail-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
2960
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2961 ;;;; *** Pmail Message Deletion Commands ***
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2962
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2963 (defun pmail-message-deleted-p (n)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2964 (= (aref pmail-deleted-vector n) ?D))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2965
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2966 (defun pmail-set-message-deleted-p (n state)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2967 (aset pmail-deleted-vector n (if state ?D ?\ )))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2968
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2969 (defun pmail-delete-message ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2970 "Delete this message and stay on it."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2971 (interactive)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2972 (pmail-set-attribute pmail-deleted-attr-index t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2973 (run-hooks 'pmail-delete-message-hook))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2974
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2975 (defun pmail-undelete-previous-message ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2976 "Back up to deleted message, select it, and undelete it."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2977 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2978 (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
2979 (let ((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
2980 (while (and (> msg 0)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2981 (not (pmail-message-deleted-p msg)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2982 (setq msg (1- msg)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2983 (if (= msg 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2984 (error "No previous deleted message")
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2985 (if (/= msg pmail-current-message)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2986 (pmail-show-message-maybe msg))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2987 (pmail-set-attribute pmail-deleted-attr-index nil)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2988 (if (pmail-summary-exists)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2989 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2990 (set-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
2991 (pmail-summary-mark-undeleted msg)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2992 (pmail-maybe-display-summary))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2993
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2994 (defun pmail-delete-forward (&optional backward)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2995 "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
2996 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
2997 With prefix argument, 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
2998
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2999 Returns t if a new message is displayed after the delete, or nil otherwise."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3000 (interactive "P")
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3001 (pmail-set-attribute pmail-deleted-attr-index t)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3002 (run-hooks 'pmail-delete-message-hook)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3003 (let ((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
3004 (if (pmail-summary-exists)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3005 (pmail-select-summary
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3006 (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
3007 (prog1 (pmail-next-undeleted-message (if backward -1 1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3008 (pmail-maybe-display-summary))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3009
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3010 (defun pmail-delete-backward ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3011 "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
3012 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
3013 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3014 (pmail-delete-forward t))
101077
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
3015
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
3016 ;; Expunging.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3017
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3018 ;; Compute the message number a given message would have after expunging.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3019 ;; The present number of the message is OLDNUM.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3020 ;; DELETEDVEC should be pmail-deleted-vector.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3021 ;; The value is nil for a message that would be deleted.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3022 (defun pmail-msg-number-after-expunge (deletedvec oldnum)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3023 (if (or (null oldnum) (= (aref deletedvec oldnum) ?D))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3024 nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3025 (let ((i 0)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3026 (newnum 0))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3027 (while (< i oldnum)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3028 (if (/= (aref deletedvec i) ?D)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3029 (setq newnum (1+ newnum)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3030 (setq i (1+ i)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3031 newnum)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3032
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3033 (defun pmail-expunge-confirmed ()
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3034 "Return t if deleted message should be expunged. If necessary, ask the user.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3035 See also user-option `pmail-confirm-expunge'."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3036 (set-buffer pmail-buffer)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3037 (or (not (stringp pmail-deleted-vector))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3038 (not (string-match "D" pmail-deleted-vector))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3039 (null pmail-confirm-expunge)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3040 (funcall pmail-confirm-expunge
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3041 "Erase deleted messages from Pmail file? ")))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3042
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3043 (defun pmail-only-expunge (&optional dont-show)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3044 "Actually erase all deleted messages in the file."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3045 (interactive)
100290
eb90f68074a8 (pmail-only-expunge): Swap buffers at the beginning.
Chong Yidong <cyd@stupidchicken.com>
parents: 100255
diff changeset
3046 (pmail-swap-buffers-maybe)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3047 (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
3048 (message "Expunging deleted messages...")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3049 ;; Discard all undo records for this buffer.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3050 (or (eq buffer-undo-list t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3051 (setq buffer-undo-list nil))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3052 (pmail-maybe-set-message-counters)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3053 (let* ((omax (- (buffer-size) (point-max)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3054 (omin (- (buffer-size) (point-min)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3055 (opoint (if (and (> pmail-current-message 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3056 (pmail-message-deleted-p pmail-current-message))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3057 0
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3058 (if pmail-enable-mime
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3059 (with-current-buffer pmail-view-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3060 (- (point)(point-min)))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3061 (- (point) (point-min)))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3062 (messages-head (cons (aref pmail-message-vector 0) nil))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3063 (messages-tail messages-head)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3064 ;; Don't make any undo records for the expunging.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3065 (buffer-undo-list t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3066 (win))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3067 (unwind-protect
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3068 (save-excursion
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3069 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3070 (goto-char (point-min))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3071 (let ((counter 0)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3072 (number 1)
100290
eb90f68074a8 (pmail-only-expunge): Swap buffers at the beginning.
Chong Yidong <cyd@stupidchicken.com>
parents: 100255
diff changeset
3073 new-summary
eb90f68074a8 (pmail-only-expunge): Swap buffers at the beginning.
Chong Yidong <cyd@stupidchicken.com>
parents: 100255
diff changeset
3074 (new-msgref (list (list 0)))
eb90f68074a8 (pmail-only-expunge): Swap buffers at the beginning.
Chong Yidong <cyd@stupidchicken.com>
parents: 100255
diff changeset
3075 (buffer-read-only nil)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3076 (total pmail-total-messages)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3077 (new-message-number pmail-current-message)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3078 (messages pmail-message-vector)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3079 (deleted pmail-deleted-vector)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3080 (summary pmail-summary-vector))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3081 (setq pmail-total-messages nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3082 pmail-current-message nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3083 pmail-message-vector nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3084 pmail-deleted-vector nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3085 pmail-summary-vector nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3086
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3087 (while (<= number total)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3088 (if (= (aref deleted number) ?D)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3089 (progn
100290
eb90f68074a8 (pmail-only-expunge): Swap buffers at the beginning.
Chong Yidong <cyd@stupidchicken.com>
parents: 100255
diff changeset
3090 (delete-region (aref messages number)
eb90f68074a8 (pmail-only-expunge): Swap buffers at the beginning.
Chong Yidong <cyd@stupidchicken.com>
parents: 100255
diff changeset
3091 (aref messages (1+ number)))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3092 (move-marker (aref messages number) nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3093 (if (> new-message-number counter)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3094 (setq new-message-number (1- new-message-number))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3095 (setq counter (1+ counter))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3096 (setq messages-tail
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3097 (setcdr messages-tail
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3098 (cons (aref messages number) nil)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3099 (setq new-summary
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3100 (cons (if (= counter number) (aref summary (1- number)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3101 new-summary))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3102 (setq new-msgref
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3103 (cons (aref pmail-msgref-vector number)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3104 new-msgref))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3105 (setcar (car new-msgref) counter))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3106 (if (zerop (% (setq number (1+ number)) 20))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3107 (message "Expunging deleted messages...%d" number)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3108 (setq messages-tail
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3109 (setcdr messages-tail
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3110 (cons (aref messages number) nil)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3111 (setq pmail-current-message new-message-number
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3112 pmail-total-messages counter
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3113 pmail-message-vector (apply 'vector messages-head)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3114 pmail-deleted-vector (make-string (1+ counter) ?\ )
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3115 pmail-summary-vector (vconcat (nreverse new-summary))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3116 pmail-msgref-vector (apply 'vector (nreverse new-msgref))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3117 win t)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3118 (message "Expunging deleted messages...done")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3119 (if (not win)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3120 (narrow-to-region (- (buffer-size) omin) (- (buffer-size) omax)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3121 (if (not dont-show)
100119
bc5e659c237c (pmail-only-expunge): Pass correct arg to pmail-show-message-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 99528
diff changeset
3122 (pmail-show-message-maybe (min pmail-current-message pmail-total-messages)))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3123 (if pmail-enable-mime
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3124 (goto-char (+ (point-min) opoint))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3125 (goto-char (+ (point) opoint))))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3126
100297
0a269d00caef (pmail-expunge): Pass new optional arg to pmail-only-expunge.
Chong Yidong <cyd@stupidchicken.com>
parents: 100290
diff changeset
3127 (defun pmail-expunge (&optional dont-show)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3128 "Erase deleted messages from Pmail file and summary buffer."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3129 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3130 (when (pmail-expunge-confirmed)
100435
52f6ee5edde1 (pmail-search): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100433
diff changeset
3131 (let ((old-total pmail-total-messages)
52f6ee5edde1 (pmail-search): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100433
diff changeset
3132 (opoint (with-current-buffer pmail-buffer
100640
40652147be0c (pmail-swap-buffers-maybe): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents: 100630
diff changeset
3133 (when (pmail-buffers-swapped-p)
100435
52f6ee5edde1 (pmail-search): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100433
diff changeset
3134 (point)))))
52f6ee5edde1 (pmail-search): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100433
diff changeset
3135 (pmail-only-expunge dont-show)
52f6ee5edde1 (pmail-search): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100433
diff changeset
3136 (if (pmail-summary-exists)
52f6ee5edde1 (pmail-search): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100433
diff changeset
3137 (pmail-select-summary (pmail-update-summary))
52f6ee5edde1 (pmail-search): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100433
diff changeset
3138 (pmail-show-message pmail-current-message)
52f6ee5edde1 (pmail-search): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100433
diff changeset
3139 (if (and (eq old-total pmail-total-messages) opoint)
52f6ee5edde1 (pmail-search): Call pmail-swap-buffers-maybe.
Chong Yidong <cyd@stupidchicken.com>
parents: 100433
diff changeset
3140 (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
3141
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3142 ;;;; *** Pmail Mailing Commands ***
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3143
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3144 (defun pmail-start-mail (&optional noerase to subject in-reply-to cc
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3145 replybuffer sendactions same-window others)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3146 (let (yank-action)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3147 (if replybuffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3148 (setq yank-action (list 'insert-buffer replybuffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3149 (setq others (cons (cons "cc" cc) others))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3150 (setq others (cons (cons "in-reply-to" in-reply-to) others))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3151 (if same-window
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3152 (compose-mail to subject others
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3153 noerase nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3154 yank-action sendactions)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3155 (if pmail-mail-new-frame
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3156 (prog1
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3157 (compose-mail to subject others
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3158 noerase 'switch-to-buffer-other-frame
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3159 yank-action sendactions)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3160 ;; This is not a standard frame parameter;
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3161 ;; nothing except sendmail.el looks at it.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3162 (modify-frame-parameters (selected-frame)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3163 '((mail-dedicated-frame . t))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3164 (compose-mail to subject others
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3165 noerase 'switch-to-buffer-other-window
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3166 yank-action sendactions)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3167
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3168 (defun pmail-mail ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3169 "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
3170 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
3171 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
3172 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3173 (pmail-start-mail nil nil nil nil nil pmail-view-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3174
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3175 (defun pmail-continue ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3176 "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
3177 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3178 (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
3179
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3180 (defun 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
3181 "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
3182 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
3183 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
3184 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
3185 (interactive "P")
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3186 (let (from reply-to cc subject date to message-id references
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3187 resent-to resent-cc resent-reply-to
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3188 (msgnum pmail-current-message))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3189 (save-excursion
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3190 (save-restriction
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
3191 (widen)
100640
40652147be0c (pmail-swap-buffers-maybe): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents: 100630
diff changeset
3192 (if (pmail-buffers-swapped-p)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3193 (narrow-to-region
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3194 (goto-char (point-min))
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
3195 (search-forward "\n\n" nil 'move))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3196 (goto-char (pmail-msgbeg pmail-current-message))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3197 (forward-line 1)
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
3198 (narrow-to-region
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
3199 (point)
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
3200 (search-forward "\n\n"
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
3201 (pmail-msgend pmail-current-message)
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
3202 'move)))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3203 (setq from (mail-fetch-field "from")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3204 reply-to (or (mail-fetch-field "mail-reply-to" nil t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3205 (mail-fetch-field "reply-to" nil t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3206 from)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3207 subject (mail-fetch-field "subject")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3208 date (mail-fetch-field "date")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3209 message-id (mail-fetch-field "message-id")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3210 references (mail-fetch-field "references" nil nil t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3211 resent-reply-to (mail-fetch-field "resent-reply-to" nil t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3212 resent-cc (and (not just-sender)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3213 (mail-fetch-field "resent-cc" nil t))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3214 resent-to (or (mail-fetch-field "resent-to" nil t) "")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3215 ;;; resent-subject (mail-fetch-field "resent-subject")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3216 ;;; resent-date (mail-fetch-field "resent-date")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3217 ;;; resent-message-id (mail-fetch-field "resent-message-id")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3218 )
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3219 (unless just-sender
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3220 (if (mail-fetch-field "mail-followup-to" nil t)
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
3221 ;; If this header field is present, use it instead of
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
3222 ;; the To and CC fields.
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3223 (setq to (mail-fetch-field "mail-followup-to" nil t))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3224 (setq cc (or (mail-fetch-field "cc" nil t) "")
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
3225 to (or (mail-fetch-field "to" nil t) ""))))))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3226
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3227 ;; Merge the resent-to and resent-cc into the to and cc.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3228 (if (and resent-to (not (equal resent-to "")))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3229 (if (not (equal to ""))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3230 (setq to (concat to ", " resent-to))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3231 (setq to resent-to)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3232 (if (and resent-cc (not (equal resent-cc "")))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3233 (if (not (equal cc ""))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3234 (setq cc (concat cc ", " resent-cc))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3235 (setq cc resent-cc)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3236 ;; Add `Re: ' to subject if not there already.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3237 (and (stringp subject)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3238 (setq subject
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3239 (concat pmail-reply-prefix
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3240 (if (let ((case-fold-search t))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3241 (string-match pmail-reply-regexp subject))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3242 (substring subject (match-end 0))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3243 subject))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3244 (pmail-start-mail
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3245 nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3246 ;; Using mail-strip-quoted-names is undesirable with newer mailers
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3247 ;; since they can handle the names unstripped.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3248 ;; I don't know whether there are other mailers that still
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3249 ;; need the names to be stripped.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3250 ;;; (mail-strip-quoted-names reply-to)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3251 ;; Remove unwanted names from reply-to, since Mail-Followup-To
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3252 ;; header causes all the names in it to wind up in reply-to, not
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3253 ;; in cc. But if what's left is an empty list, use the original.
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
3254 (let* ((reply-to-list (rmail-dont-reply-to reply-to)))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3255 (if (string= reply-to-list "") reply-to reply-to-list))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3256 subject
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3257 (pmail-make-in-reply-to-field from date message-id)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3258 (if just-sender
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3259 nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3260 ;; mail-strip-quoted-names is NOT necessary for pmail-dont-reply-to
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3261 ;; to do its job.
100342
160964e45356 (pmail-perm-variables): Don't call pmail-parse-file-inboxes.
Chong Yidong <cyd@stupidchicken.com>
parents: 100340
diff changeset
3262 (let* ((cc-list (rmail-dont-reply-to
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3263 (mail-strip-quoted-names
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3264 (if (null cc) to (concat to ", " cc))))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3265 (if (string= cc-list "") nil cc-list)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3266 pmail-view-buffer
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3267 (list (list 'pmail-mark-message
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3268 pmail-buffer
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3269 (with-current-buffer pmail-buffer
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3270 (aref pmail-msgref-vector msgnum))
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
3271 pmail-answered-attr-index))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3272 nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3273 (list (cons "References" (concat (mapconcat 'identity references " ")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3274 " " message-id))))))
101077
22a55aabcdba (pmail-count-screen-lines, pmail-use-collection-buffer)
Richard M. Stallman <rms@gnu.org>
parents: 101074
diff changeset
3275
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3276 (defun pmail-mark-message (buffer msgnum-list attribute)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3277 "Give BUFFER's message number in MSGNUM-LIST the attribute ATTRIBUTE.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3278 This is use in the send-actions for message buffers.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3279 MSGNUM-LIST is a list of the form (MSGNUM)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3280 which is an element of pmail-msgref-vector."
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3281 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3282 (set-buffer buffer)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3283 (if (car msgnum-list)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3284 (pmail-set-attribute attribute t (car msgnum-list)))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3285
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3286 (defun pmail-make-in-reply-to-field (from date message-id)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3287 (cond ((not from)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3288 (if message-id
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3289 message-id
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3290 nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3291 (mail-use-rfc822
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3292 (require 'rfc822)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3293 (let ((tem (car (rfc822-addresses from))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3294 (if message-id
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3295 (if (or (not tem)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3296 (string-match
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3297 (regexp-quote (if (string-match "@[^@]*\\'" tem)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3298 (substring tem 0
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3299 (match-beginning 0))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3300 tem))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3301 message-id))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3302 ;; missing From, or Message-ID is sufficiently informative
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3303 message-id
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3304 (concat message-id " (" tem ")"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3305 ;; Copy TEM, discarding text properties.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3306 (setq tem (copy-sequence tem))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3307 (set-text-properties 0 (length tem) nil tem)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3308 (setq tem (copy-sequence tem))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3309 ;; Use prin1 to fake RFC822 quoting
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3310 (let ((field (prin1-to-string tem)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3311 (if date
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3312 (concat field "'s message of " date)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3313 field)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3314 ((let* ((foo "[^][\000-\037()<>@,;:\\\" ]+")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3315 (bar "[^][\000-\037()<>@,;:\\\"]+"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3316 ;; These strings both match all non-ASCII characters.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3317 (or (string-match (concat "\\`[ \t]*\\(" bar
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3318 "\\)\\(<" foo "@" foo ">\\)?[ \t]*\\'")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3319 ;; "Unix Loser <Foo@bar.edu>" => "Unix Loser"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3320 from)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3321 (string-match (concat "\\`[ \t]*<" foo "@" foo ">[ \t]*(\\("
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3322 bar "\\))[ \t]*\\'")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3323 ;; "<Bugs@bar.edu>" (Losing Unix) => "Losing Unix"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3324 from)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3325 (let ((start (match-beginning 1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3326 (end (match-end 1)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3327 ;; Trim whitespace which above regexp match allows
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3328 (while (and (< start end)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3329 (memq (aref from start) '(?\t ?\ )))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3330 (setq start (1+ start)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3331 (while (and (< start end)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3332 (memq (aref from (1- end)) '(?\t ?\ )))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3333 (setq end (1- end)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3334 (let ((field (substring from start end)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3335 (if date (setq field (concat "message from " field " on " date)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3336 (if message-id
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3337 ;; "<AA259@bar.edu> (message from Unix Loser on 1-Apr-89)"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3338 (concat message-id " (" field ")")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3339 field))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3340 (t
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3341 ;; If we can't kludge it simply, do it correctly
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3342 (let ((mail-use-rfc822 t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3343 (pmail-make-in-reply-to-field from date message-id)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3344
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3345 (defun pmail-forward (resend)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3346 "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
3347 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
3348 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
3349 (interactive "P")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3350 (if resend
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3351 (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
3352 (let ((forward-buffer pmail-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3353 (msgnum pmail-current-message)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3354 (subject (concat "["
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3355 (let ((from (or (mail-fetch-field "From")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3356 (mail-fetch-field ">From"))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3357 (if from
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3358 (concat (mail-strip-quoted-names from) ": ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3359 ""))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3360 (or (mail-fetch-field "Subject") "")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3361 "]")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3362 (if (pmail-start-mail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3363 nil nil subject nil nil nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3364 (list (list 'pmail-mark-message
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3365 forward-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3366 (with-current-buffer pmail-buffer
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3367 (aref pmail-msgref-vector msgnum))
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
3368 pmail-forwarded-attr-index))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3369 ;; If only one window, use it for the mail buffer.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3370 ;; Otherwise, use another window for the mail buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3371 ;; so that the Pmail buffer remains visible
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3372 ;; and sending the mail will get back to it.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3373 (and (not pmail-mail-new-frame) (one-window-p t)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3374 ;; The mail buffer is now current.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3375 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3376 ;; Insert after header separator--before signature if any.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3377 (goto-char (mail-text-start))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3378 (if (or pmail-enable-mime pmail-enable-mime-composing)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3379 (funcall pmail-insert-mime-forwarded-message-function
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3380 forward-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3381 (insert "------- Start of forwarded message -------\n")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3382 ;; Quote lines with `- ' if they start with `-'.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3383 (let ((beg (point)) end)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3384 (setq end (point-marker))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3385 (set-marker-insertion-type end t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3386 (insert-buffer-substring forward-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3387 (goto-char beg)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3388 (while (re-search-forward "^-" end t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3389 (beginning-of-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3390 (insert "- ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3391 (forward-line 1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3392 (goto-char end)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3393 (skip-chars-backward "\n")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3394 (if (< (point) end)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3395 (forward-char 1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3396 (delete-region (point) end)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3397 (set-marker end nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3398 (insert "------- End of forwarded message -------\n"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3399 (push-mark))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3400
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3401 (defun pmail-resend (address &optional from comment mail-alias-file)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3402 "Resend current message to ADDRESSES.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3403 ADDRESSES should be a single address, a string consisting of several
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3404 addresses separated by commas, or a list of addresses.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3405
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3406 Optional FROM is the address to resend the message from, and
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3407 defaults from the value of `user-mail-address'.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3408 Optional COMMENT is a string to insert as a comment in the resent message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3409 Optional ALIAS-FILE is alternate aliases file to be used by sendmail,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3410 typically for purposes of moderating a list."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3411 (interactive "sResend to: ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3412 (require 'sendmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3413 (require 'mailalias)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3414 (unless (or (eq pmail-view-buffer (current-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3415 (eq pmail-buffer (current-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3416 (error "Not an Pmail buffer"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3417 (if (not from) (setq from user-mail-address))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3418 (let ((tembuf (generate-new-buffer " sendmail temp"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3419 (case-fold-search nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3420 (mail-personal-alias-file
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3421 (or mail-alias-file mail-personal-alias-file))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3422 (mailbuf pmail-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3423 (unwind-protect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3424 (with-current-buffer tembuf
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3425 ;;>> Copy message into temp buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3426 (if pmail-enable-mime
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3427 (funcall pmail-insert-mime-resent-message-function mailbuf)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3428 (insert-buffer-substring mailbuf))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3429 (goto-char (point-min))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3430 ;; Delete any Sender field, since that's not specifiable.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3431 ; Only delete Sender fields in the actual header.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3432 (re-search-forward "^$" nil 'move)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3433 ; Using "while" here rather than "if" because some buggy mail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3434 ; software may have inserted multiple Sender fields.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3435 (while (re-search-backward "^Sender:" nil t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3436 (let (beg)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3437 (setq beg (point))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3438 (forward-line 1)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3439 (while (looking-at "[ \t]")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3440 (forward-line 1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3441 (delete-region beg (point))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3442 ; Go back to the beginning of the buffer so the Resent- fields
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3443 ; are inserted there.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3444 (goto-char (point-min))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3445 ;;>> Insert resent-from:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3446 (insert "Resent-From: " from "\n")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3447 (insert "Resent-Date: " (mail-rfc822-date) "\n")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3448 ;;>> Insert resent-to: and bcc if need be.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3449 (let ((before (point)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3450 (if mail-self-blind
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3451 (insert "Resent-Bcc: " (user-login-name) "\n"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3452 (insert "Resent-To: " (if (stringp address)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3453 address
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3454 (mapconcat 'identity address ",\n\t"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3455 "\n")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3456 ;; Expand abbrevs in the recipients.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3457 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3458 (if (featurep 'mailabbrev)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3459 (let ((end (point-marker))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3460 (local-abbrev-table mail-abbrevs)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3461 (old-syntax-table (syntax-table)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3462 (if (and (not (vectorp mail-abbrevs))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3463 (file-exists-p mail-personal-alias-file))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3464 (build-mail-abbrevs))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3465 (unless mail-abbrev-syntax-table
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3466 (mail-abbrev-make-syntax-table))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3467 (set-syntax-table mail-abbrev-syntax-table)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3468 (goto-char before)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3469 (while (and (< (point) end)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3470 (progn (forward-word 1)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3471 (<= (point) end)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3472 (expand-abbrev))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3473 (set-syntax-table old-syntax-table))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3474 (expand-mail-aliases before (point)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3475 ;;>> Set up comment, if any.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3476 (if (and (sequencep comment) (not (zerop (length comment))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3477 (let ((before (point))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3478 after)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3479 (insert comment)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3480 (or (eolp) (insert "\n"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3481 (setq after (point))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3482 (goto-char before)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3483 (while (< (point) after)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3484 (insert "Resent-Comment: ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3485 (forward-line 1))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3486 ;; Don't expand aliases in the destination fields
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3487 ;; of the original message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3488 (let (mail-aliases)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3489 (funcall send-mail-function)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3490 (kill-buffer tembuf))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3491 (with-current-buffer pmail-buffer
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3492 (pmail-set-attribute pmail-resent-attr-index t pmail-current-message))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3493
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3494 (defvar mail-unsent-separator
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3495 (concat "^ *---+ +Unsent message follows +---+ *$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3496 "^ *---+ +Returned message +---+ *$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3497 "^ *---+ *Returned mail follows *---+ *$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3498 "^Start of returned message$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3499 "^---+ Below this line is a copy of the message.$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3500 "^ *---+ +Original message +---+ *$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3501 "^ *--+ +begin message +--+ *$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3502 "^ *---+ +Original message follows +---+ *$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3503 "^ *---+ +Your message follows +---+ *$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3504 "^|? *---+ +Message text follows: +---+ *|?$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3505 "^ *---+ +This is a copy of \\w+ message, including all the headers.*---+ *$")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3506 "A regexp that matches the separator before the text of a failed message.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3507
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3508 (defvar mail-mime-unsent-header "^Content-Type: message/rfc822 *$"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3509 "A regexp that matches the header of a MIME body part with a failed message.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3510
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3511 (defun pmail-retry-failure ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3512 "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
3513 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
3514 the body of the original message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3515 If the failed message is a MIME multipart message, it is searched for a
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3516 body part with a header which matches the variable `mail-mime-unsent-header'.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3517 Otherwise, the variable `mail-unsent-separator' should match the string that
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3518 delimits the returned original message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3519 The variable `pmail-retry-ignored-headers' is a regular expression
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3520 specifying headers which should not be copied into the new message."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3521 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3522 (require 'mail-utils)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3523 (let ((pmail-this-buffer (current-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3524 (msgnum pmail-current-message)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3525 bounce-start bounce-end bounce-indent resending
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3526 ;; Fetch any content-type header in current message
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3527 ;; Must search thru the whole unpruned header.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3528 (content-type
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3529 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3530 (save-restriction
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3531 (mail-fetch-field "Content-Type") ))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3532 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3533 (goto-char (point-min))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3534 (let ((case-fold-search t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3535 (if (and content-type
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3536 (string-match
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3537 ";[\n\t ]*boundary=\"?\\([-0-9a-z'()+_,./:=? ]+\\)\"?"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3538 content-type))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3539 ;; Handle a MIME multipart bounce message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3540 (let ((codestring
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3541 (concat "\n--"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3542 (substring content-type (match-beginning 1)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3543 (match-end 1)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3544 (unless (re-search-forward mail-mime-unsent-header nil t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3545 (error "Cannot find beginning of header in failed message"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3546 (unless (search-forward "\n\n" nil t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3547 (error "Cannot find start of Mime data in failed message"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3548 (setq bounce-start (point))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3549 (if (search-forward codestring nil t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3550 (setq bounce-end (match-beginning 0))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3551 (setq bounce-end (point-max))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3552 ;; Non-MIME bounce.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3553 (or (re-search-forward mail-unsent-separator nil t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3554 (error "Cannot parse this as a failure message"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3555 (skip-chars-forward "\n")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3556 ;; Support a style of failure message in which the original
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3557 ;; message is indented, and included within lines saying
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3558 ;; `Start of returned message' and `End of returned message'.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3559 (if (looking-at " +Received:")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3560 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3561 (setq bounce-start (point))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3562 (skip-chars-forward " ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3563 (setq bounce-indent (- (current-column)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3564 (goto-char (point-max))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3565 (re-search-backward "^End of returned message$" nil t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3566 (setq bounce-end (point)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3567 ;; One message contained a few random lines before
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3568 ;; the old message header. The first line of the
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3569 ;; message started with two hyphens. A blank line
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3570 ;; followed these random lines. The same line
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3571 ;; beginning with two hyphens was possibly marking
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3572 ;; the end of the message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3573 (if (looking-at "^--")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3574 (let ((boundary (buffer-substring-no-properties
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3575 (point)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3576 (progn (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
3577 (search-forward "\n\n")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3578 (skip-chars-forward "\n")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3579 (setq bounce-start (point))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3580 (goto-char (point-max))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3581 (search-backward (concat "\n\n" boundary) bounce-start t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3582 (setq bounce-end (point)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3583 (setq bounce-start (point)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3584 bounce-end (point-max)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3585 (unless (search-forward "\n\n" nil t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3586 (error "Cannot find end of header in failed message"))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3587 ;; We have found the message that bounced, within the current message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3588 ;; Now start sending new message; default header fields from original.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3589 ;; Turn off the usual actions for initializing the message body
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3590 ;; because we want to get only the text from the failure message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3591 (let (mail-signature mail-setup-hook)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3592 (if (pmail-start-mail nil nil nil nil nil pmail-this-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3593 (list (list 'pmail-mark-message
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3594 pmail-this-buffer
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3595 (aref pmail-msgref-vector msgnum)
100648
f050468c100d (pmail-retried-attr-index, pmail-forwarded-attr-index):
Richard M. Stallman <rms@gnu.org>
parents: 100640
diff changeset
3596 pmail-retried-attr-index)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3597 ;; Insert original text as initial text of new draft message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3598 ;; Bind inhibit-read-only since the header delimiter
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3599 ;; of the previous message was probably read-only.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3600 (let ((inhibit-read-only t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3601 pmail-displayed-headers
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3602 pmail-ignored-headers)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3603 (erase-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3604 (insert-buffer-substring pmail-this-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3605 bounce-start bounce-end)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3606 (goto-char (point-min))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3607 (if bounce-indent
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3608 (indent-rigidly (point-min) (point-max) bounce-indent))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3609 (mail-sendmail-delimit-header)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3610 (save-restriction
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3611 (narrow-to-region (point-min) (mail-header-end))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3612 (setq resending (mail-fetch-field "resent-to"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3613 (if mail-self-blind
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3614 (if resending
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3615 (insert "Resent-Bcc: " (user-login-name) "\n")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3616 (insert "BCC: " (user-login-name) "\n"))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3617 (goto-char (point-min))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3618 (mail-position-on-field (if resending "Resent-To" "To") t))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3619
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3620 (defun pmail-summary-exists ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3621 "Non-nil if in an PMAIL buffer and an associated summary buffer exists.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3622 In fact, the non-nil value returned is the summary buffer itself."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3623 (and pmail-summary-buffer (buffer-name pmail-summary-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3624 pmail-summary-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3625
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3626 (defun pmail-summary-displayed ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3627 "t if in PMAIL buffer and an associated summary buffer is displayed."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3628 (and pmail-summary-buffer (get-buffer-window pmail-summary-buffer)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3629
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3630 (defcustom pmail-redisplay-summary nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3631 "*Non-nil means Pmail should show the summary when it changes.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3632 This has an effect only if a summary buffer exists."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3633 :type 'boolean
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3634 :group 'pmail-summary)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3635
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3636 (defcustom pmail-summary-window-size nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3637 "*Non-nil means specify the height for an Pmail summary window."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3638 :type '(choice (const :tag "Disabled" nil) integer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3639 :group 'pmail-summary)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3640
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3641 ;; Put the summary buffer back on the screen, if user wants that.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3642 (defun pmail-maybe-display-summary ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3643 (let ((selected (selected-window))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3644 window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3645 ;; If requested, make sure the summary is displayed.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3646 (and pmail-summary-buffer (buffer-name pmail-summary-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3647 pmail-redisplay-summary
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3648 (if (get-buffer-window pmail-summary-buffer 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3649 ;; It's already in some frame; show that one.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3650 (let ((frame (window-frame
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3651 (get-buffer-window pmail-summary-buffer 0))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3652 (make-frame-visible frame)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3653 (raise-frame frame))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3654 (display-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
3655 ;; If requested, set the height of the summary window.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3656 (and pmail-summary-buffer (buffer-name pmail-summary-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3657 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
3658 (setq window (get-buffer-window pmail-summary-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3659 ;; Don't try to change the size if just one window in frame.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3660 (not (eq window (frame-root-window (window-frame window))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3661 (unwind-protect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3662 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3663 (select-window window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3664 (enlarge-window (- pmail-summary-window-size (window-height))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3665 (select-window selected)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3666
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3667 ;;;; *** Pmail Local Fontification ***
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3668
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3669 (defun pmail-fontify-buffer-function ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3670 ;; This function's symbol is bound to font-lock-fontify-buffer-function.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3671 (add-hook 'pmail-show-message-hook 'pmail-fontify-message nil t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3672 ;; If we're already showing a message, fontify it now.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3673 (if pmail-current-message (pmail-fontify-message))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3674 ;; Prevent Font Lock mode from kicking in.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3675 (setq font-lock-fontified t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3676
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3677 (defun pmail-unfontify-buffer-function ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3678 ;; This function's symbol is bound to font-lock-fontify-unbuffer-function.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3679 (let ((modified (buffer-modified-p))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3680 (buffer-undo-list t) (inhibit-read-only t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3681 before-change-functions after-change-functions
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3682 buffer-file-name buffer-file-truename)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3683 (save-restriction
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3684 (widen)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3685 (remove-hook 'pmail-show-message-hook 'pmail-fontify-message t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3686 (remove-text-properties (point-min) (point-max) '(pmail-fontified nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3687 (font-lock-default-unfontify-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3688 (and (not modified) (buffer-modified-p) (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
3689
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3690 (defun pmail-fontify-message ()
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3691 ;; Fontify the current message if it is not already fontified.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3692 (if (text-property-any (point-min) (point-max) 'pmail-fontified nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3693 (let ((modified (buffer-modified-p))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3694 (buffer-undo-list t) (inhibit-read-only t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3695 before-change-functions after-change-functions
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3696 buffer-file-name buffer-file-truename)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3697 (save-excursion
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3698 (save-match-data
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3699 (add-text-properties (point-min) (point-max) '(pmail-fontified t))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3700 (font-lock-fontify-region (point-min) (point-max))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3701 (and (not modified) (buffer-modified-p) (set-buffer-modified-p nil)))))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3702
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3703 ;;; Speedbar support for PMAIL files.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3704 (eval-when-compile (require 'speedbar))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3705
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3706 (defvar pmail-speedbar-match-folder-regexp "^[A-Z0-9]+\\(\\.[A-Z0-9]+\\)?$"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3707 "*This regex is used to match folder names to be displayed in speedbar.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3708 Enabling this will permit speedbar to display your folders for easy
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3709 browsing, and moving of messages.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3710
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3711 (defvar pmail-speedbar-last-user nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3712 "The last user to be displayed in the speedbar.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3713
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3714 (defvar pmail-speedbar-key-map nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3715 "Keymap used when in pmail display mode.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3716
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3717 (defun pmail-install-speedbar-variables ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3718 "Install those variables used by speedbar to enhance pmail."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3719 (if pmail-speedbar-key-map
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3720 nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3721 (setq pmail-speedbar-key-map (speedbar-make-specialized-keymap))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3722
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3723 (define-key pmail-speedbar-key-map "e" 'speedbar-edit-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3724 (define-key pmail-speedbar-key-map "r" 'speedbar-edit-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3725 (define-key pmail-speedbar-key-map "\C-m" 'speedbar-edit-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3726 (define-key pmail-speedbar-key-map "M"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3727 'pmail-speedbar-move-message-to-folder-on-line)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3728
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3729 (defvar pmail-speedbar-menu-items
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3730 '(["Read Folder" speedbar-edit-line t]
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3731 ["Move message to folder" pmail-speedbar-move-message-to-folder-on-line
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3732 (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
3733 (looking-at "<M> "))])
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3734 "Additional menu-items to add to speedbar frame.")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3735
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3736 ;; Make sure our special speedbar major mode is loaded
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3737 (if (featurep 'speedbar)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3738 (pmail-install-speedbar-variables)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3739 (add-hook 'speedbar-load-hook 'pmail-install-speedbar-variables))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3740
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3741 (defun pmail-speedbar-buttons (buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3742 "Create buttons for BUFFER containing pmail messages.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3743 Click on the address under Reply to: to reply to this person.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3744 Under Folders: Click a name to read it, or on the <M> to move the
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3745 current message into that PMAIL folder."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3746 (let ((from nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3747 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3748 (set-buffer buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3749 (goto-char (point-min))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3750 (if (not (re-search-forward "^Reply-To: " nil t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3751 (if (not (re-search-forward "^From:? " nil t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3752 (setq from t)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3753 (if from
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3754 nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3755 (setq from (buffer-substring (point) (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3756 (end-of-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3757 (point))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3758 (goto-char (point-min))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3759 (if (and (looking-at "Reply to:")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3760 (equal from pmail-speedbar-last-user))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3761 nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3762 (setq pmail-speedbar-last-user from)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3763 (erase-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3764 (insert "Reply To:\n")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3765 (if (stringp from)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3766 (speedbar-insert-button from 'speedbar-directory-face 'highlight
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3767 'pmail-speedbar-button 'pmail-reply))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3768 (insert "Folders:\n")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3769 (let* ((case-fold-search nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3770 (df (directory-files (save-excursion (set-buffer buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3771 default-directory)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3772 nil pmail-speedbar-match-folder-regexp)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3773 (while df
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3774 (speedbar-insert-button "<M>" 'speedbar-button-face 'highlight
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3775 'pmail-speedbar-move-message (car df))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3776 (speedbar-insert-button (car df) 'speedbar-file-face 'highlight
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3777 'pmail-speedbar-find-file nil t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3778 (setq df (cdr df)))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3779
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3780 (defun pmail-speedbar-button (text token indent)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3781 "Execute an pmail command specified by TEXT.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3782 The command used is TOKEN. INDENT is not used."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3783 (speedbar-with-attached-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3784 (funcall token t)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3785
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3786 (defun pmail-speedbar-find-file (text token indent)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3787 "Load in the pmail file TEXT.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3788 TOKEN and INDENT are not used."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3789 (speedbar-with-attached-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3790 (message "Loading in PMAIL file %s..." text)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3791 (find-file text)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3792
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3793 (defun pmail-speedbar-move-message-to-folder-on-line ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3794 "If the current line is a folder, move current message to it."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3795 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3796 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3797 (beginning-of-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3798 (if (re-search-forward "<M> " (save-excursion (end-of-line) (point)) t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3799 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3800 (forward-char -2)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3801 (speedbar-do-function-pointer)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3802
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3803 (defun pmail-speedbar-move-message (text token indent)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3804 "From button TEXT, copy current message to the pmail file specified by TOKEN.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3805 TEXT and INDENT are not used."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3806 (speedbar-with-attached-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3807 (message "Moving message to %s" token)
100913
c2069bd311e6 (basic-save-buffer): Protect buffer-modified flag around first swap.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
3808 (pmail-output token)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3809
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3810 ; Functions for setting, getting and encoding the POP password.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3811 ; The password is encoded to prevent it from being easily accessible
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3812 ; to "prying eyes." Obviously, this encoding isn't "real security,"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3813 ; nor is it meant to be.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3814
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3815 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3816 (defun pmail-set-remote-password (password)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3817 "Set PASSWORD to be used for retrieving mail from a POP or IMAP server."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3818 (interactive "sPassword: ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3819 (if password
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3820 (setq pmail-encoded-remote-password
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3821 (pmail-encode-string password (emacs-pid)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3822 (setq pmail-remote-password nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3823 (setq pmail-encoded-remote-password nil)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3824
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3825 (defun pmail-get-remote-password (imap)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3826 "Get the password for retrieving mail from a POP or IMAP server. If none
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3827 has been set, then prompt the user for one."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3828 (when (not pmail-encoded-remote-password)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3829 (if (not pmail-remote-password)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3830 (setq pmail-remote-password
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3831 (read-passwd (if imap
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3832 "IMAP password: "
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3833 "POP password: "))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3834 (pmail-set-remote-password pmail-remote-password)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3835 (setq pmail-remote-password nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3836 (pmail-encode-string pmail-encoded-remote-password (emacs-pid)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3837
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3838 (defun pmail-have-password ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3839 (or pmail-remote-password pmail-encoded-remote-password))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3840
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3841 (defun pmail-encode-string (string mask)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3842 "Encode STRING with integer MASK, by taking the exclusive OR of the
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3843 lowest byte in the mask with the first character of string, the
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3844 second-lowest-byte with the second character of the string, etc.,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3845 restarting at the lowest byte of the mask whenever it runs out.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3846 Returns the encoded string. Calling the function again with an
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3847 encoded string (and the same mask) will decode the string."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3848 (setq mask (abs mask)) ; doesn't work if negative
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3849 (let* ((string-vector (string-to-vector string)) (i 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3850 (len (length string-vector)) (curmask mask) charmask)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3851 (while (< i len)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3852 (if (= curmask 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3853 (setq curmask mask))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3854 (setq charmask (% curmask 256))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3855 (setq curmask (lsh curmask -8))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3856 (aset string-vector i (logxor charmask (aref string-vector i)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3857 (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
3858 (concat string-vector)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3859
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3860 ;;;; Desktop support
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3861
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3862 (defun pmail-restore-desktop-buffer (desktop-buffer-file-name
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3863 desktop-buffer-name
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3864 desktop-buffer-misc)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3865 "Restore an pmail buffer specified in a desktop file."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3866 (condition-case error
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3867 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3868 (pmail-input desktop-buffer-file-name)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3869 (if (eq major-mode 'pmail-mode)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3870 (current-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3871 pmail-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3872 (file-locked
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3873 (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
3874 nil)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3875
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3876 (add-to-list 'desktop-buffer-mode-handlers
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3877 '(pmail-mode . pmail-restore-desktop-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3878
101341
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
3879 ;; Used in `write-region-annotate-functions' to write pmail files.
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
3880 (defun pmail-write-region-annotate (start end)
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
3881 (when (pmail-buffers-swapped-p)
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
3882 (set-buffer pmail-view-buffer)
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
3883 (widen)
235db5e6b83d (buffer-swapped-with): Var removed.
Chong Yidong <cyd@stupidchicken.com>
parents: 101303
diff changeset
3884 nil))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3885
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3886 (provide 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3887
98019
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 98013
diff changeset
3888 ;; Local Variables:
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 98013
diff changeset
3889 ;; change-log-default-name: "ChangeLog.pmail"
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 98013
diff changeset
3890 ;; End:
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 98013
diff changeset
3891
97534
4d30ed7d18e3 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 97533
diff changeset
3892 ;; arch-tag: 65d257d3-c281-4a65-9c38-e61af95af2f0
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3893 ;;; pmail.el ends here