annotate lisp/mail/pmail.el @ 98625:e80860881779

* pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 11 Oct 2008 19:56:16 +0000
parents 276fe938ccc2
children 9a09eaf25d36
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,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4 ;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
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
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
64 (defconst pmail-resent-attr-index 4
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
65 "The index for the `resent' attribute.")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
66
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
67 (defconst pmail-stored-attr-index 5
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
68 "The index for the `stored' attribute.")
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
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
73 (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
74 '[(?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
75 (?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
76 (?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
77 (?F "filed")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
78 (?R "replied")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
79 (?S "stored")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
80 (?U "unseen")]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
81 "An array that provides a mapping between an attribute index,
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
82 it's character representation and it's display representation.")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
83
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
84 (defvar deleted-head)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
85 (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
86 (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
87 (defvar mail-abbrevs)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
88 (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
89 (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
90 (defvar rsf-beep)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
91 (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
92 (defvar total-messages)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
93 (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
94
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
95 (defvar pmail-buffers-swapped-p nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
96 "A flag that is non-nil when the message view buffer and the
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
97 message collection buffer are swapped, i.e. the 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
98 contains a single decoded message.")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
99
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
100 (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
101 "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
102 '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
103
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
104 ; 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
105 ;(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
106 ; "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
107 ;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
108 ;(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
109 ; (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
110 ; "")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
111
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
112 ;; 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
113 (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
114 "*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
115 :type 'string
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
116 :group 'rmail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
117 :version "21.1")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
118
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
119 (defgroup pmail nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
120 "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
121 :group 'mail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
122
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
123 (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
124 "Pmail retrieval options."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
125 :prefix "pmail-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
126 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
127
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
128 (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
129 "Pmail files."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
130 :prefix "pmail-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
131 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
132
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
133 (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
134 "Pmail header options."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
135 :prefix "pmail-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
136 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
137
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
138 (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
139 "Pmail reply options."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
140 :prefix "pmail-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
141 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
142
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
143 (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
144 "Pmail summary options."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
145 :prefix "pmail-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
146 :prefix "pmail-summary-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
147 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
148
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
149 (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
150 "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
151 :prefix "pmail-output-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
152 :prefix "pmail-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
153 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
154
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
155 (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
156 "Pmail editing."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
157 :prefix "pmail-edit-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
158 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
159
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
160 (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
161 "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
162 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
163
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
164 (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
165 "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
166 :group 'pmail-retrieve
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
167 :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
168
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
169 (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
170 "*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
171 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
172 :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
173 (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
174 :group 'pmail-obsolete)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
175
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
176 (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
177 "*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
178 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
179 :type 'boolean
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
180 :group 'pmail-obsolete)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
181
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
182 (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
183 "*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
184 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
185 :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
186 (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
187 :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
188 :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
189 (set-default symbol
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
190 (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
191 (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
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 pmail-pop-password
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
194 value))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
195 (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
196 :group 'pmail-retrieve
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
197 :version "22.1")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
198
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
199 (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
200 "*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
201 :type 'boolean
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
202 :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
203 :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
204 (set-default symbol
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
205 (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
206 (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
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 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
209 value))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
210 (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
211 :group 'pmail-retrieve
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
212 :version "22.1")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
213
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
214 (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
215 "*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
216 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
217 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
218 :type '(repeat string)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
219 :group 'pmail-retrieve
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
220 :version "20.3")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
221
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
222 (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
223 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
224 "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
225 messages.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
226 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
227 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
228
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
229 (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
230
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
231 (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
232 "*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
233 :type 'boolean
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
234 :group 'pmail-retrieve)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
235
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
236 (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
237 "*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
238 :group 'pmail-retrieve
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
239 :type '(repeat (directory)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
240
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-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
242 (declare-function mail-text-start "sendmail" ())
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
243 (declare-function pmail-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
244 (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
245
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
246 (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
247 "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
248 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
249 (with-temp-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
250 (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
251 (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
252 (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
253 (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
254 ;; Should not happen...
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
255 nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
256 (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
257 (cond
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
258 ((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
259 'emacs) ;; Possibly...
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
260 ((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
261 'mailutils)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
262 (t
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
263 ;; FIXME:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
264 'emacs))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
265
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
266 (defun pmail-autodetect ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
267 "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
268 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
269 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
270 `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
271 (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
272 (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
273 (catch 'scan
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
274 (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
275 (list exec-directory)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
276 (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
277 ;; 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
278 ;; 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
279 ;; (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
280 ;; 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
281 ;; 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
282 (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
283 (concat "movemail"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
284 (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
285 ".exe")) dir)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
286 (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
287 (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
288 (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
289 (when x
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
290 (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
291 (throw 'scan x))))))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
292
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
293 (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
294 "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
295
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
296 `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
297 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
298 `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
299 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
300
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
301 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
302 (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
303 "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
304 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
305 (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
306 ;; Autodetect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
307 (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
308 (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
309
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
310 ;; 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
311 ;; 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
312 ;; 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
313 ;; 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
314 (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
315
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
316 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
317 (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
318 *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
319 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
320 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
321 :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
322 :group 'pmail-reply)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
323
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
324 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
325 (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
326 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
327 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
328 `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
329 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
330 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
331
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
332 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
333 (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
334 (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
335 "\\|^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
336 "\\|^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
337 "\\|^\\(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
338 "\\|^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
339 "\\|^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
340 "\\|^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
341 "\\|^return-path:\\|^errors-to:\\|^return-receipt-to:"
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
342 "\\|^precedence:\\|^list-help:\\|^list-post:\\|^list-subscribe:"
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:"
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
346 "\\|^mbox-line:\\|^cancel-lock:\\|^DomainKey-Signature:"
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
347 "\\|^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
348 "\\|^x-.*:")
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
349 "*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
350 \(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
351 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
352 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
353 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
354 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
355 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
356 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
357 :type 'regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
358 :group 'pmail-headers)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
359
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
360 (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
361 "*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
362 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
363 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
364 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
365
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
366 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
367 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
368 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
369 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
370 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
371 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
372 :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
373 :group 'pmail-headers)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
374
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
375 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
376 (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
377 "*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
378 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
379 `pmail-ignored-headers'."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
380 :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
381 :group 'pmail-headers)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
382
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
383 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
384 (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
385 *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
386 :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
387 :group 'pmail-headers)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
388
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
389 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
390 (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
391 *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
392 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
393 :type 'regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
394 :group 'pmail-headers)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
395
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
396 (defface pmail-highlight
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
397 '((t (:inherit highlight)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
398 "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
399 :group 'pmail-headers
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
400 :version "22.1")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
401
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
402 (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
403 '((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
404 "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
405 :group 'pmail-headers
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
406 :version "23.1")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
407
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
408 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
409 (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
410 *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
411 :type 'boolean
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
412 :group 'pmail-files)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
413
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
414 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
415 (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
416 *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
417 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
418 \(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
419 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
420 ;; 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
421 ;; at load time.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
422 :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
423 (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
424 (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
425 (getenv "USER"))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
426 'file))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
427 :group 'pmail-retrieve
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
428 :group 'pmail-files)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
429
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
430 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
431 (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
432 "*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
433 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
434 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
435 :type 'boolean
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
436 :group 'pmail-reply)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
437
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
438 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
439 (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
440 "*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
441 :type 'directory
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
442 :group 'pmail-files)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
443 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
444 (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
445 "*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
446 :type 'regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
447 :group 'pmail-files)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
448
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
449 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
450 (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
451 "*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
452 :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
453 (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
454 (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
455 :version "21.1"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
456 :group 'pmail-files)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
457
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
458 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
459 (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
460 "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
461
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
462 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
463 (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
464 "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
465
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
466 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
467 (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
468 "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
469 :type 'hook
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
470 :options '(goto-address)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
471 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
472
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
473 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
474 (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
475 "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
476
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
477 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
478 (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
479 "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
480 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
481 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
482
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
483 ;; 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
484 ;; 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
485 ;; files).
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
486
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
487 (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
488 "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
489 (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
490 "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
491
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
492 (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
493 "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
494 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
495 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
496 :group 'pmail-headers
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
497 :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
498
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
499 (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
500 "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
501 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
502
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
503 (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
504
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
505 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
506 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
507
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
508 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
509 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
510
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
511 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
512 \"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
513 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
514
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
515 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
516 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
517
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
518 examples:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
519 (\"/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
520 (\"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
521 :group 'pmail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
522 :version "21.1"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
523 :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
524
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
525 (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
526 "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
527
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
528 ;; 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
529 ;; 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
530 ;; 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
531 ;; 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
532 (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
533 "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
534
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
535 (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
536 "*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
537 :group 'pmail-summary
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
538 :type 'boolean)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
539
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
540 (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
541 (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
542
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
543 (defvar pmail-keywords nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
544 (put 'pmail-keywords 'permanent-local t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
545
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
546 (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
547 "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
548 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
549 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
550 (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
551
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
552 ;; 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
553
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
554 (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
555 (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
556
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
557 (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
558 (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
559
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
560 (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
561 (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
562
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
563 (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
564 (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
565
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
566 (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
567 "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
568 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
569 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
570 (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
571
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
572 (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
573 (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
574
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
575 ;; 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
576
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
577 (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
578 (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
579 (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
580 (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
581
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
582 (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
583 "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
584 (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
585
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
586 ;; `Sticky' default variables.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
587
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
588 ;; Last individual label specified to a or k.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
589 (defvar pmail-last-label nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
590 (put 'pmail-last-label 'permanent-local t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
591
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
592 ;; Last set of values specified to C-M-n, C-M-p, C-M-s or C-M-l.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
593 (defvar pmail-last-multi-labels nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
594
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
595 (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
596 (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
597
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
598 (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
599 "*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
600 :type 'file
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
601 :group 'pmail-files)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
602 (defcustom pmail-default-pmail-file "~/XMAIL"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
603 "*Default file name for \\[pmail-output-to-pmail-file]."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
604 :type 'file
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
605 :group 'pmail-files)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
606 (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
607 "*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
608 :type 'file
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
609 :group 'pmail-files
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
610 :version "20.3")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
611
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
612 ;; 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
613
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
614 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
615 (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
616 "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
617
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
618 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
619
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
620 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
621 (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
622 "*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
623 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
624 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
625 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
626
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
627 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
628 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
629 in your session."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
630 :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
631 (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
632 (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
633 :group 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
634
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
635 (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
636 "*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
637
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
638 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
639 (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
640 "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
641 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
642 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
643
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
644 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
645 (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
646 "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
647 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
648 `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
649 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
650 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
651 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
652
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
653 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
654 (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
655 "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
656 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
657 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
658 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
659 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
660
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
661 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
662 (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
663 "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
664 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
665 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
666 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
667
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
668 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
669 (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
670 "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
671 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
672 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
673 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
674 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
675 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
676
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
677 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
678 (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
679 "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
680 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
681 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
682
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
683 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
684 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
685
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
686 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
687 (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
688 "*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
689 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
690 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
691
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
692 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
693 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
694 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
695
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
696 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
697 (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
698 (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
699 "\\(?:[ \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
700 "[ \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
701 "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
702 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
703
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
704
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
705 ;;; 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
706 ;;; (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
707 ;;; 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
708 ;;; 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
709 (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
710 (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
711 (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
712 "\\|[-+]?[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
713 "\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
714 "\\) *")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
715 (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
716 "From "
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
717
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
718 ;; 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
719 ;; 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
720 ;; `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
721 ;; `<@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
722 ;; 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
723 ;; 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
724 ;; User)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
725 ;; 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
726 ;; From: Joe User
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
727 ;; <joe@y.z>
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
728 ;; 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
729 ;; 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
730 ;; 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
731 ;; <joe@y.z>
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
732 ;; 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
733 ;; 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
734 ;; 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
735 ;; 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
736 ;; 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
737 "\\([^\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
738
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
739 ;; 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
740 "\\([^\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
741 "\\([^\0-\r \^?]+\\) +" ; month
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
742 "\\([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
743 "\\([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
744
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
745 ;; 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
746 ;; numeric offset.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
747 time-zone-regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
748
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
749 ;; The year.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
750 " \\([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
751
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
752 ;; 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
753 time-zone-regexp
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
754
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
755 ;; Old uucp cruft.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
756 "\\(remote from .*\\)?"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
757
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
758 "\n"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
759 nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
760
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
761 (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
762 ;; 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
763 (eval-when-compile
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
764 (let* ((cite-chars "[>|}]")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
765 (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
766 (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
767 (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
768 . '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 '("^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
770 '("^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
771 '("^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
772 '("^\\(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
773 . '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
774 ;; 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
775 `(,cite-chars
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
776 (,(concat "\\=[ \t]*"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
777 "\\(\\(\\([" 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
778 "\\(" cite-chars "[ \t]*\\)\\)+\\)"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
779 "\\(.*\\)")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
780 (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
781 (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
782 (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
783 '("^\\(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
784 . 'pmail-header-name))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
785 "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
786
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
787 ;; 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
788 ;; 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
789 (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
790 `(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
791 (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
792 (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
793 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
794 (unwind-protect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
795 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
796 (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
797 ;; 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
798 ;; 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
799 ;; 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
800 ;; 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
801 (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
802 ,@body))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
803 (select-window window))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
804 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
805 (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
806 (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
807 ,@body)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
808 (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
809
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
810 ;;;; *** Pmail Mode ***
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
811
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
812 ;; 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
813 ;; the byte compiler.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
814
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
815 (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
816
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
817
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
818 (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
819 "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
820 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
821 isn't provided."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
822 (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
823 (condition-case err
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
824 (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
825 (error
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
826 (display-warning
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
827 :warning
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
828 (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
829 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
830 `%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
831 is not available in the current session.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
832 So, the MIME support is turned off for the moment."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
833 pmail-mime-feature))
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))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
857 run-mail-hook msg-shown)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
858 ;; Like find-file, but in the case where a buffer existed
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
859 ;; and the file was reverted, recompute the message-data.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
860 ;; We used to bind enable-local-variables to nil here,
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
861 ;; but that should not be needed now that 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
862 ;; sets it locally to nil.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
863 ;; (Binding a variable locally with let is not safe if it has
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
864 ;; buffer-local bindings.)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
865 (if (and existed (not (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 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
867 (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
868 (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
869 (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
870 (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
871 (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
872 (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
873 (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
874 (find-file-noselect 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
875 (setq pmail-buffers-swapped-p nil)
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"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
878 (if (and existed (> (buffer-size) 0))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
879 ;; Buffer not new and not empty; ensure in proper mode, but that's all.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
880 (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
881 (progn (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
882 (setq run-mail-hook t)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
883 (setq run-mail-hook t)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
884 (pmail-mode-2)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
885 (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
886 (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
887 ;; As we have read a file by raw-text, 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
888 ;; unibyte. We must 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
889 (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
890 (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
891 (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
892 ;; If necessary, scan to find all 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
893 (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
894 (unwind-protect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
895 (unless (and (not file-name-arg) (pmail-get-new-mail))
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
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 (progn
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
898 (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
899 (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
900 (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
901 (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
902
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
903 ;; Given the value of MAILPATH, return a list of inbox file names.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
904 ;; This is turned off because it is not clear that the user wants
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
905 ;; all these inboxes to feed into the primary 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
906 ; (defun pmail-convert-mailpath (string)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
907 ; (let (idx list)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
908 ; (while (setq idx (string-match "[%:]" string))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
909 ; (let ((this (substring string 0 idx)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
910 ; (setq string (substring string (1+ idx)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
911 ; (setq list (cons (if (string-match "%" this)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
912 ; (substring this 0 (string-match "%" this))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
913 ; this)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
914 ; list))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
915 ; list))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
916
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
917 ; I have checked that adding "-*- pmail -*-" to the BABYL OPTIONS line
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
918 ; will not cause emacs 18.55 problems.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
919
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
920 ;; This calls pmail-decode-babyl-format if the file is already Babyl.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
921
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
922 (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
923 "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
924 (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
925 (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
926 ;; 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
927 (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
928 ;; 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
929 ;; it.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
930 (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
931 ((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
932 ;; 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
933 ;; 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
934 ;; format.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
935 (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
936 (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
937 (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
938 ((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
939 (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
940 ((looking-at "From "))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
941 (t (pmail-error-bad-format))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
942
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
943 (defun pmail-error-bad-format (&optional msgnum)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
944 "Report that the buffer contains a message that is not RFC2822
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
945 compliant.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
946 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
947 (if msgnum
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
948 (error "Message %s is not a valid RFC2822 message." msgnum)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
949 (error "Invalid mbox format mail 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
950
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
951 (defun 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
952 "Convert the mail file from Babyl version 5 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
953 (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
954 (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
955 (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
956 (progn
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
957 (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
958 (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
959 (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
960 (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
961 (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
962 (insert-file-contents-literally 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
963 (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
964 (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
965 (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
966
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
967 (defun pmail-insert-pmail-file-header ()
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
968 (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
969 ;; -*-pmail-*- is here so that visiting the file normally
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
970 ;; recognizes it as an 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
971 (insert "BABYL OPTIONS: -*- pmail -*-
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
972 Version: 5
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
973 Labels:
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
974 Note: This is the header of an 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
975 Note: If you are seeing it 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
976 Note: it means the file has no messages in it.\n\^_")))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
977
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
978 (defun pmail-get-coding-system ()
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
979 "Return a suitable coding system to use for the mail message in
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
980 the region."
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
981 (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
982 separator)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
983 (save-excursion
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
984 (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
985 (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
986 (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
987 (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
988 'undecided)))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
989
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
990 ;; Decode Babyl formatted part at the head of current buffer by
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
991 ;; pmail-file-coding-system, or if it is nil, do auto conversion.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
992
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
993 (defun pmail-decode-babyl-format ()
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
994 (let ((modifiedp (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
995 (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
996 (coding-system pmail-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
997 from to)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
998 (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
999 (search-forward "\n\^_" nil t) ; Skip BABYL header.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1000 (setq from (point))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1001 (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
1002 (search-backward "\n\^_" from 'mv)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1003 (setq to (point))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1004 (unless (and 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
1005 (coding-system-p 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
1006 (setq 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
1007 ;; If pmail-file-coding-system is nil, Emacs 21 writes
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1008 ;; PMAIL files in emacs-mule, Emacs 22 in utf-8, but
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1009 ;; earlier versions did that with the current buffer's
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1010 ;; encoding. So we want to favor detection of emacs-mule
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1011 ;; (whose normal priority is quite low) and utf-8, but
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1012 ;; still allow detection of other encodings if they won't
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1013 ;; fit. The call to with-coding-priority below achieves
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1014 ;; that.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1015 (with-coding-priority '(emacs-mule utf-8)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1016 (detect-coding-region from to 'highest))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1017 (unless (eq (coding-system-type coding-system) 'undecided)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1018 (set-buffer-modified-p t) ; avoid locking when decoding
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1019 (let ((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
1020 (decode-coding-region from to 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
1021 (setq coding-system 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
1022 (set-buffer-modified-p modifiedp)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1023 (setq buffer-file-coding-system nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1024 (setq save-buffer-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
1025 (or coding-system 'undecided))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1026
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1027 (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
1028 (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
1029 nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1030 (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
1031 (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
1032 (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
1033 (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
1034 (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
1035 (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
1036 (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
1037 (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
1038 (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
1039 (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
1040 (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
1041 (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
1042 (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
1043 (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
1044 (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
1045 (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
1046 (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
1047 (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
1048 (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
1049 (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
1050 (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
1051 (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
1052 (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
1053 (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
1054 (define-key pmail-mode-map "\e\C-n" 'pmail-next-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
1055 (define-key pmail-mode-map "o" 'pmail-output-to-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
1056 (define-key pmail-mode-map "\C-o" 'pmail-output)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1057 (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
1058 (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
1059 (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
1060 (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
1061 (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
1062 ;; 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
1063 ;; (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
1064 (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
1065 (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
1066 (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
1067 (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
1068 (define-key pmail-mode-map "w" '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
1069 (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
1070 (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
1071 (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
1072 (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
1073 (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
1074 (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
1075 (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
1076 (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
1077 (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
1078 (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
1079 (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
1080 (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
1081 (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
1082 (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
1083 (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
1084 (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
1085 (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
1086 )
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] (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
1089
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1090 (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
1091 (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
1092
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1093 (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
1094 nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1095
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1096 (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
1097 nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1098
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1099 (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
1100 '("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
1101
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1102 (define-key pmail-mode-map [menu-bar classify output-inbox]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1103 '("Output (inbox)..." . pmail-output))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1104
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1105 (define-key pmail-mode-map [menu-bar classify output]
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1106 '("Output (Pmail)..." . pmail-output-to-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
1107
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1108 (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
1109 '("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
1110
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1111 (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
1112 '("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
1113
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1114 (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
1115 (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
1116
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1117 (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
1118 '("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
1119
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1120 (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
1121 '("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
1122
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1123 (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
1124 '("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
1125
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1126 (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
1127 '("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
1128
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1129 (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
1130 '("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
1131
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1132 (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
1133 '("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
1134
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1135 (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
1136 (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
1137
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1138 (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
1139 '("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
1140
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1141 (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
1142 '("----"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1143
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1144 (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
1145 '("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
1146
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1147 (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
1148 '("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
1149
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1150 (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
1151 '("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
1152
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1153 (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
1154 '("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
1155
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1156 (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
1157 '("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
1158
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1159 (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
1160 '("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
1161
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1162 (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
1163 (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
1164
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1165 (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
1166 '("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
1167
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1168 (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
1169 '("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
1170
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1171 (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
1172 '("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
1173
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1174 (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
1175 '("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
1176
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1177 (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
1178 (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
1179
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1180 (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
1181 '("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
1182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1183 (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
1184 '("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
1185
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1186 (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
1187 '("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
1188
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1189 (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
1190 '("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
1191
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1192 (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
1193 '("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
1194
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1195 (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
1196 '("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
1197
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1198 (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
1199 '("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
1200
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1201 (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
1202 '("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
1203
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1204 ;; Pmail toolbar
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1205 (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
1206 (let ((map (make-sparse-keymap)))
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1207 (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
1208 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1209 (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
1210 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1211 (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
1212 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1213 (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
1214 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1215 (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
1216 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1217 (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
1218 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1219 (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
1220 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1221 (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
1222 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1223 (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
1224 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1225 (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
1226 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1227 (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
1228 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1229 (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
1230 map pmail-mode-map)
e80860881779 * pmail.el (pmail-tool-bar-map): Initialize it unconditionally.
Chong Yidong <cyd@stupidchicken.com>
parents: 98526
diff changeset
1231 map))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1232
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1233
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1234
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1235 ;; 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
1236 (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
1237
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1238 (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
1239 (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
1240
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1241 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1242 (defun pmail-mode ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1243 "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
1244 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
1245 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
1246
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1247 \\[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
1248 \\[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
1249 \\[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
1250 \\[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
1251 \\[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
1252 \\[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
1253 \\[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
1254 \\[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
1255 \\[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
1256 \\[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
1257 \\[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
1258 \\[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
1259 \\[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
1260 \\[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
1261 \\[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
1262 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
1263 \\[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
1264 \\[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
1265 \\[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
1266 \\[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
1267 \\[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
1268 \\[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
1269 \\[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
1270 \\[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
1271 \\[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
1272 \\[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
1273 \\[pmail-forward] Forward this 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
1274 \\[pmail-output-to-pmail-file] Output this message to an Pmail file (append it).
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1275 \\[pmail-output] Output this message to a Unix-format mail file (append it).
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1276 \\[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
1277 \\[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
1278 \\[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
1279 \\[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
1280 \\[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
1281 (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
1282 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
1283 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
1284 \\[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
1285 \\[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
1286 \\[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
1287 \\[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
1288 \\[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
1289 \\[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
1290 \\[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
1291 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1292 (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
1293 (pmail-mode-2)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1294 (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
1295 (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
1296 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
1297 (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
1298 (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
1299 (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
1300 (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
1301 (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
1302 (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
1303 (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
1304 (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
1305 (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
1306 (pmail-summary))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1307 (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
1308 (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
1309
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1310 (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
1311 (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
1312 (pmail-mode-1)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1313 (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 (pmail-variables))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1315
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1316 (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
1317 (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
1318 (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
1319 (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
1320 ;; 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
1321 ;; 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
1322 ;; and deletion of messages.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1323 ;; The one exception is when messages are copied into 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
1324 ;; pmail-output-to-pmail-file enables auto save when you do that.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1325 (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
1326 (setq mode-line-modified "--")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1327 (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
1328 (set-syntax-table text-mode-syntax-table)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1329 (setq local-abbrev-table text-mode-abbrev-table))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1330
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1331 (defun pmail-generate-viewer-buffer ()
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1332 "Return a newly created buffer suitable for viewing messages."
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1333 (let ((suffix (file-name-nondirectory (or buffer-file-name (buffer-name)))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1334 (generate-new-buffer (format " *message-viewer %s*" suffix))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1335
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1336 ;; 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
1337 (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
1338 (make-local-variable 'pmail-last-label)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1339 (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
1340 (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
1341 (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
1342 (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
1343 (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
1344 (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
1345 (save-excursion
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
1346 (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
1347 (set-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
1348 (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
1349 (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
1350 (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
1351 (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
1352 (make-local-variable 'pmail-total-messages)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1353 (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
1354 (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
1355 (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
1356 (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
1357 (make-local-variable '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
1358 (setq pmail-inbox-list (pmail-parse-file-inboxes))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1359 ;; 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
1360 (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
1361 (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
1362 (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
1363 (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
1364 (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
1365 (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
1366 (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
1367 (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
1368 (user-login-name)))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1369 (make-local-variable 'pmail-keywords)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1370 (set (make-local-variable 'tool-bar-map) pmail-tool-bar-map)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1371 (make-local-variable 'pmail-buffers-swapped-p)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1372 ;; this gets generated as needed
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1373 (setq pmail-keywords nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1374
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1375 ;; 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
1376 (defun pmail-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
1377 (make-local-variable 'save-buffer-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
1378 ;; If we don't already have a value for save-buffer-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
1379 ;; get it from buffer-file-coding-system, and clear that
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1380 ;; because it should be determined in pmail-show-message.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1381 (unless save-buffer-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
1382 (setq save-buffer-coding-system (or buffer-file-coding-system 'undecided))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1383 (setq buffer-file-coding-system nil))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1384 ;; 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
1385 (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
1386 (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
1387 (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
1388 (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
1389 (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
1390 (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
1391 '(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
1392 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
1393 (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
1394 (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
1395 (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
1396 (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
1397 (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
1398 (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
1399 (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
1400 (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
1401 (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
1402 (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
1403 (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
1404 (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
1405 (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
1406 (setq desktop-save-buffer t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1407
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1408 ;; 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
1409 (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
1410 (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
1411 (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
1412 (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
1413 ;; 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
1414 (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
1415 ;; 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
1416 (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
1417 ;; 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
1418 ;; 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
1419 (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
1420 (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
1421 ;; 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
1422 (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
1423 ;; 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
1424 ;; 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
1425 (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
1426 (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
1427 (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
1428 (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
1429 (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
1430 (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
1431 (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
1432
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1433 ;; Return a list of files from this buffer's Mail: option.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1434 ;; Does not assume that messages have been parsed.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1435 ;; Just returns nil if buffer does not look like Babyl format.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1436 (defun pmail-parse-file-inboxes ()
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1437 (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
1438 (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
1439 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1440 (goto-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
1441 (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
1442 (search-forward "\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
1443 (narrow-to-region 1 (point))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1444 (goto-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
1445 (when (search-forward "\nMail:" 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
1446 (narrow-to-region (point) (progn (end-of-line) (point)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1447 (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
1448 (mail-parse-comma-list)))))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
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-expunge-and-save ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1451 "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
1452 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1453 (pmail-expunge)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1454 (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
1455 (save-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1456 (if (pmail-summary-exists)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1457 (pmail-select-summary (set-buffer-modified-p nil))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1458
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1459 (defun pmail-quit ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1460 "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
1461 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
1462 (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
1463 ;; Determine if the buffers need to be swapped.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1464 (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
1465 (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
1466 (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
1467 (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
1468 ;; 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
1469 (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
1470 (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
1471 (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
1472 (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
1473 (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
1474 (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
1475 (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
1476 (quit-window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1477 (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
1478 (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
1479 (bury-buffer obuf))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1480 (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
1481 (quit-window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1482 (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
1483
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1484 (defun pmail-bury ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1485 "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
1486 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1487 ;; 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
1488 ;; 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
1489 (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
1490 (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
1491 (let (window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1492 (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
1493 (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
1494 (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
1495 (quit-window)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1496
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1497 (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
1498 "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
1499 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
1500 original copy."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1501 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1502 (widen)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1503 (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
1504 (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
1505 (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
1506 (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
1507 (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
1508 (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
1509 (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
1510 (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
1511 (message "Message duplicated")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1512
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1513 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1514 (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
1515 "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
1516 (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
1517 (pmail filename))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1518
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1519
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1520 ;; 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
1521 ;; 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
1522 ;; 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
1523 ;; 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
1524 (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
1525 "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
1526 (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
1527 ;; 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
1528 (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
1529 (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
1530 ;; 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
1531 ;; 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
1532 (sort files 'string<))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1533
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1534 (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
1535 (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
1536 (mapc
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1537 (function (lambda (item)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1538 (let (command)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1539 (if (consp item)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1540 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1541 (setq command
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1542 (pmail-list-to-menu (car item) (cdr item)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1543 action
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1544 (if full-name
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1545 (concat full-name "/"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1546 (car item))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1547 (car item))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1548 (setq name (car item)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1549 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1550 (setq name item)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1551 (setq command
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1552 (list 'lambda () '(interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1553 (list action
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1554 (expand-file-name
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1555 (if full-name
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1556 (concat full-name "/" item)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1557 item)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1558 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
1559 (define-key menu (vector (intern name))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1560 (cons name command)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1561 (reverse l))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1562 menu))
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 ;; 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
1565 (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
1566
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1567 (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
1568 (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
1569 (if files
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1570 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1571 (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
1572 (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
1573 (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
1574 files
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1575 'pmail-input)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1576 (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
1577 (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
1578 (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
1579 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
1580 'pmail-output-to-pmail-file))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1581
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1582 (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
1583 '("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
1584 (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
1585 '("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
1586
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1587
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1588 ;;;; *** Pmail input ***
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1589
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1590 (declare-function pmail-spam-filter "pmail-spam-filter" (msg))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1591 (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
1592 (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
1593 (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
1594 (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
1595 (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
1596 (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
1597 (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
1598
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1599 ;; 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
1600 ;; 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
1601
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1602 (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
1603 "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
1604 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
1605 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
1606 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
1607 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
1608
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1609 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
1610 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
1611 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
1612 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
1613
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1614 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
1615 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
1616
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1617 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
1618 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
1619 (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
1620 (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
1621 (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
1622 (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
1623 ;; 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
1624 ;; 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
1625 (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
1626 (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
1627 (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
1628 (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
1629 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1630 ;; 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
1631 (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
1632 (setq buffer-undo-list nil))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1633 (pmail-get-new-mail-1 file-name))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1634
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1635 (defun pmail-get-new-mail-1 (file-name)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1636 "Continuation of 'pmail-get-new-mail. Sort of a procedural
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1637 abstraction kind of thing to manage the code size. Return t if
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1638 new messages are found, nil otherwise."
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1639 (let ((all-files (if file-name (list 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
1640 pmail-inbox-list))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1641 (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
1642 found)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1643 (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
1644 (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
1645 (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
1646 (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 ;; 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
1648 ;; 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
1649 (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
1650 (buffer-read-only nil)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1651 ;; Don't make undo records for what we do in getting
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1652 ;; mail.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1653 (buffer-undo-list t)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1654 success files 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
1655 ;; 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
1656 ;; 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
1657 ;; 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
1658 (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
1659 (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
1660 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
1661 (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
1662 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
1663 (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
1664 (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
1665 ;; 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
1666 (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
1667 (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
1668 (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
1669 (delete-region (point) (point-max)) ; caused by require-final-newline
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1670 (setq found (pmail-get-new-mail-2 file-name files 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 found)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1672 ;; 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
1673 (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
1674
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1675 (defun pmail-get-new-mail-2 (file-name files delete-files)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1676 "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
1677 (save-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1678 (save-restriction
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1679 (let ((new-messages 0)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1680 (spam-filter-p (and (featurep 'pmail-spam-filter) pmail-use-spam-filter))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1681 blurb success suffix)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1682 (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
1683 ;; 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
1684 ;; 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
1685 ;; eventually.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1686 (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
1687 (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
1688 (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
1689 ;; 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
1690 ;; 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
1691 (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
1692 (unwind-protect
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1693 (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
1694 success t)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1695 ;; 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
1696 (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
1697 ;; 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
1698 ;; 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
1699 (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
1700 (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
1701 (count 0))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1702 (while delfiles
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1703 (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
1704 (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
1705 (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
1706 (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
1707 ;; 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
1708 (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
1709 ;; 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
1710 (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
1711 (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
1712 (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
1713 (save-buffer))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1714 ;; 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
1715 (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
1716 (condition-case ()
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1717 ;; 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
1718 (condition-case ()
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1719 (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
1720 (file-error
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1721 ;; 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
1722 (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
1723 (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
1724 (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
1725 (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
1726 (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
1727 (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
1728 ;; 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
1729 (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
1730 (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
1731 "")))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1732 (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
1733 (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
1734 (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
1735 (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
1736 (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
1737 (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
1738 (sleep-for rsf-sleep-after-message))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1739
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1740 ;; Move to the first new message
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1741 ;; unless we have other unseen messages before it.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1742 (pmail-show-message-maybe (pmail-first-unseen-message))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1743 (run-hooks 'pmail-after-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
1744 (> new-messages 0)))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1745
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1746 (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
1747 "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
1748 (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
1749 (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
1750 (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
1751 ;; 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
1752 ;; (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
1753 ;; old-messages
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1754 (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
1755 blurb)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1756 ;; 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
1757 (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
1758 (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
1759 (progn
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1760 (if (not (pmail-spam-filter 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
1761 (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
1762 (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
1763 (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
1764 (progn
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1765 (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
1766 (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
1767 (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
1768 (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
1769 (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
1770 ;; 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
1771 ;; messages found.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1772 (cond
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1773 ((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
1774 ((= 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
1775 ((= 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
1776 ((> 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
1777 (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
1778 (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
1779
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1780 (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
1781 "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
1782 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
1783 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
1784 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
1785 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
1786 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
1787 "
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1788 (cond
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1789 ((string-match "^\\([^:]+\\)://\\(\\([^:@]+\\)\\(:\\([^@]+\\)\\)?@\\)?.*" file)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1790 (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
1791 (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
1792 (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
1793 (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
1794 (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
1795 (+ 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
1796
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1797 (if (not pass)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1798 (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
1799 (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
1800 (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
1801 (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
1802 ;; 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
1803 ;; 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
1804 (setq file (concat proto "://" user "@" host)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1805
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1806 (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
1807 (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
1808 (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
1809 t
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1810 (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
1811 got-password)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1812 (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
1813 (list file
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1814 (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
1815 (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
1816 got-password))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1817
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1818 ((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
1819 (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
1820 (proto "pop")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1821 (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
1822 (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
1823
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1824 (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
1825 (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
1826 (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
1827
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1828 (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
1829
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1830 (t
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1831 (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
1832
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1833 (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
1834 ;; 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
1835 ;; 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
1836 (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
1837 (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
1838 (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
1839 (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
1840 (while files
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1841 ;; 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
1842 ;; 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
1843 (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
1844 (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
1845 (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
1846 (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
1847 (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
1848 (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
1849
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1850 (if popmail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1851 (setq renamep t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1852 (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
1853 (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
1854 (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
1855 ;; 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
1856 ;; 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
1857 (concat ".newmail-"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1858 (file-name-nondirectory
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
1859 (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
1860 ;; 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
1861 (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
1862 file)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1863 ;; 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
1864 ;; 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
1865 ;; 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
1866 ;; file isn't.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1867 (file-name-directory
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1868 (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
1869 ;; 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
1870 ;; 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
1871 (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
1872 ;; 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
1873 ;; 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
1874 (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
1875 (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
1876 file))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1877 (cond (popmail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1878 (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
1879 ((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
1880 (/= 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
1881 (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
1882 ((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
1883 (/= 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
1884 (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
1885 ;; 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
1886 ;; 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
1887 (cond ((not renamep)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1888 (setq tofile file))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1889 ((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
1890 (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
1891 nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1892 (t
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1893 (with-temp-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1894 (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
1895 (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
1896 (let ((args
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1897 (append
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97534
diff changeset
1898 (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
1899 (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
1900 (list "-p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1901 nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1902 (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
1903 (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
1904 pmail-movemail-flags)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1905 (list file tofile)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1906 (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
1907 (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
1908 (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
1909 ;; 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
1910 nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1911 (set-buffer errors)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1912 (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
1913 ?\n ?\ )
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1914 (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
1915 (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
1916 (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
1917 (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
1918 (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
1919 (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
1920 (beep t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1921 ;; 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
1922 ;; 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
1923 ;; 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
1924 (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
1925 (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
1926 nil t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1927 (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
1928
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1929 ;; 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
1930 ;; abbreviation
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1931 (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
1932 (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
1933 (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
1934 (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
1935
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1936 (message "movemail: %s"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1937 (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
1938 (point-max)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1939
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1940 (sit-for 3)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1941 nil)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1942
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1943 ;; 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
1944 ;; 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
1945 ;; 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
1946 (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
1947 (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
1948 size)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1949 (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
1950 (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
1951 ;; 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
1952 ;; 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
1953 ;; 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
1954 ;; 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
1955 (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
1956 (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
1957 (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
1958 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1959 (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
1960 (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
1961 (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
1962 (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
1963 (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
1964 (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
1965 (zerop size)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1966 (insert ?\n))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1967 (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
1968 (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
1969 (message "")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1970 (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
1971 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
1972
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1973 ;; 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
1974 ;; 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
1975 (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
1976 (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
1977 (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
1978 ;; 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
1979 ;; 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
1980 (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
1981 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
1982 ;; 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
1983 ;; 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
1984 (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
1985 (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
1986 (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
1987
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1988 (defun pmail-add-header (name value)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1989 "Add a message header named NAME with value VALUE.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1990 The current buffer is narrowed to the headers for some
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1991 message (including the blank line separator)."
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1992 ;; Position point at the end of the headers but before the blank
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1993 ;; line separating the headers from the body.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1994 (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
1995 (forward-char -1)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1996 (insert name ": " value "\n"))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1997
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
1998 (defun pmail-add-mbox-headers ()
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
1999 "Validate the RFC2822 format for the new messages. Point, at
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2000 entry should be looking at the first new message. An error will
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2001 be thrown if the new messages are not RCC2822 compliant. Lastly,
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2002 unless one already exists, add an Rmail attribute header to the
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2003 new messages in the region. Return the number of new messages."
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2004 (save-excursion
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2005 (let ((count 0)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2006 (start (point))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2007 (value "------U")
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2008 limit)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2009 ;; Detect an empty inbox file.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2010 (unless (= start (point-max))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2011 ;; Scan the new messages to establish a count and to insure that
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2012 ;; an attribute header is present.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2013 (while (looking-at "From ")
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2014 ;; Determine if a new attribute header needs to be added to
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2015 ;; the message.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2016 (if (search-forward "\n\n" nil t)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2017 (progn
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2018 (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
2019 (narrow-to-region start (point))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2020 (unless (mail-fetch-field pmail-attribute-header)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2021 (pmail-add-header pmail-attribute-header value))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2022 (widen))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2023 (pmail-error-bad-format))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2024 ;; Move to the next message.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2025 (if (search-forward "\n\nFrom " nil 'move)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2026 (forward-char -5))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2027 (setq start (point))))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2028 count)))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2029
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2030 ;; the pmail-break-forwarded-messages feature is not implemented
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-convert-to-babyl-format ()
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2032 (let ((count 0) start
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2033 (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
2034 (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
2035 (invalid-input-resync
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2036 (function (lambda ()
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2037 (message "Invalid Babyl format in inbox!")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2038 (sit-for 3)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2039 ;; Try to get back in sync with a real message.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2040 (if (re-search-forward
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2041 (concat pmail-mmdf-delim1 "\\|^From") 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
2042 (beginning-of-line)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2043 (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
2044 (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
2045 (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
2046 (while (not (eobp))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2047 (setq 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
2048 (cond ((looking-at "BABYL OPTIONS:") ;Babyl header
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2049 (if (search-forward "\n\^_" 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
2050 ;; If we find the proper terminator, delete through there.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2051 (delete-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
2052 (funcall invalid-input-resync)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2053 (delete-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
2054 ;; Babyl format message
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2055 ((looking-at "\^L")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2056 (or (search-forward "\n\^_" 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
2057 (funcall invalid-input-resync))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2058 (setq count (1+ count))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2059 ;; Make sure there is no extra white space after the ^_
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2060 ;; at the end 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
2061 ;; Narrowing will make sure that whatever follows the junk
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2062 ;; will be treated properly.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2063 (delete-region (point)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2064 (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
2065 (skip-chars-forward " \t\n")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2066 (point)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2067 ;; The following let* form was wrapped in a `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
2068 ;; which in one case caused infinite looping, see:
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2069 ;; http://lists.gnu.org/archive/html/emacs-devel/2008-01/msg00968.html
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2070 ;; Removing that form leaves `point' at the end of the
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2071 ;; region decoded by `pmail-decode-region' which should
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2072 ;; be correct.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2073 (let* ((header-end
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2074 (progn
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2075 (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
2076 (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
2077 (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
2078 (if (looking-at "0")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2079 (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
2080 (forward-line 2))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2081 (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
2082 (narrow-to-region (point) (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
2083 (rfc822-goto-eoh)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2084 (point)))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2085 (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
2086 (quoted-printable-header-field-end
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2087 (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
2088 (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
2089 (re-search-forward
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2090 "^content-transfer-encoding:\\(\n?[\t ]\\)*quoted-printable\\(\n?[\t ]\\)*"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2091 header-end t)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2092 (base64-header-field-end
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2093 (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
2094 (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
2095 ;; Don't try to decode non-text data.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2096 (and (re-search-forward
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2097 "^content-type:\\(\n?[\t ]\\)\\(text\\|message\\)/"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2098 header-end t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2099 (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
2100 (re-search-forward
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2101 "^content-transfer-encoding:\\(\n?[\t ]\\)*base64\\(\n?[\t ]\\)*"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2102 header-end t)))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2103 (if quoted-printable-header-field-end
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2104 (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
2105 (unless
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2106 (mail-unquote-printable-region header-end (point) nil t t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2107 (message "Malformed MIME quoted-printable message"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2108 ;; Change "quoted-printable" to "8bit",
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2109 ;; to reflect the decoding we just did.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2110 (goto-char quoted-printable-header-field-end)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2111 (delete-region (point) (search-backward ":"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2112 (insert ": 8bit")))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2113 (if base64-header-field-end
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2114 (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
2115 (when
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2116 (condition-case nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2117 (progn
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2118 (base64-decode-region (1+ header-end)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2119 (- (point) 2))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2120 t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2121 (error nil))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2122 ;; Change "base64" to "8bit", to reflect the
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2123 ;; decoding we just did.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2124 (goto-char base64-header-field-end)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2125 (delete-region (point) (search-backward ":"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2126 (insert ": 8bit"))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2127 (setq last-coding-system-used nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2128 (or 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
2129 (not 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
2130 (let ((mime-charset
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2131 (if (and pmail-decode-mime-charset
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2132 (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
2133 (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
2134 (search-forward "\n\n" 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
2135 (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
2136 (re-search-backward
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2137 pmail-mime-charset-pattern
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2138 start t))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2139 (intern (downcase (match-string 1))))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2140 (pmail-decode-region start (point) mime-charset))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2141 ;; Add an X-Coding-System: header if we don't have one.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2142 (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
2143 (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
2144 (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
2145 (if (looking-at "0")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2146 (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
2147 (forward-line 2))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2148 (or (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
2149 (narrow-to-region (point) (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
2150 (rfc822-goto-eoh)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2151 (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
2152 (re-search-forward "^X-Coding-System:" 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
2153 (insert "X-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
2154 (symbol-name 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
2155 "\n")))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2156 (narrow-to-region (point) (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
2157 (and (= 0 (% count 10))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2158 (message "Converting to Babyl format...%d" count)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2159 ;;*** MMDF format
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2160 ((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
2161 (looking-at pmail-mmdf-delim1))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2162 (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
2163 (replace-match "\^L\n0, unseen,,\n*** EOOH ***\n")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2164 (re-search-forward pmail-mmdf-delim2 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
2165 (replace-match "\^_"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2166 (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
2167 (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
2168 (narrow-to-region start (1- (point)))
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 (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
2170 (while (search-forward "\n\^_" nil t) ; single char "\^_"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2171 (replace-match "\n^_")))) ; 2 chars: "^" and "_"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2172 (setq last-coding-system-used nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2173 (or 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
2174 (not 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
2175 (decode-coding-region start (point) 'undecided))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2176 (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
2177 (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
2178 (forward-line 3)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2179 (insert "X-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
2180 (symbol-name 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
2181 "\n"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2182 (narrow-to-region (point) (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
2183 (setq count (1+ count))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2184 (and (= 0 (% count 10))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2185 (message "Converting to Babyl format...%d" count)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2186 ;;*** Mail format
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2187 ((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
2188 (insert "\^L\n0, unseen,,\n*** EOOH ***\n")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2189 (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
2190 ;; If this message has a Content-Length field,
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2191 ;; skip to the end of the contents.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2192 (let* ((header-end (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
2193 (and (re-search-forward "\n\n" 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
2194 (1- (point)))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2195 (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
2196 (quoted-printable-header-field-end
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2197 (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
2198 (re-search-forward
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2199 "^content-transfer-encoding:\\(\n?[\t ]\\)*quoted-printable\\(\n?[\t ]\\)*"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2200 header-end t)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2201 (base64-header-field-end
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2202 (and
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2203 ;; Don't decode non-text data.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2204 (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
2205 (re-search-forward
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2206 "^content-type:\\(\n?[\t ]\\)\\(text\\|message\\)/"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2207 header-end t))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2208 (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
2209 (re-search-forward
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2210 "^content-transfer-encoding:\\(\n?[\t ]\\)*base64\\(\n?[\t ]\\)*"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2211 header-end t))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2212 (size
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2213 ;; Get the numeric value from the Content-Length field.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2214 (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
2215 ;; Back up to end of prev line,
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2216 ;; in case the Content-Length field comes first.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2217 (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
2218 (and (search-forward "\ncontent-length: "
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2219 header-end t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2220 (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
2221 (eol (progn (end-of-line) (point))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2222 (string-to-number (buffer-substring beg eol)))))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2223 (and size
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2224 (if (and (natnump size)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2225 (<= (+ header-end size) (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
2226 ;; Make sure this would put us at a position
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2227 ;; that we could continue from.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2228 (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
2229 (goto-char (+ header-end size))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2230 (skip-chars-forward "\n")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2231 (or (eobp)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2232 (and (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
2233 (search-forward "\n\^_" 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
2234 (and (looking-at "\^L")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2235 (search-forward "\n\^_" 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
2236 (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
2237 (looking-at pmail-mmdf-delim1))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2238 (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
2239 (goto-char (+ header-end size))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2240 (message "Ignoring invalid Content-Length field")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2241 (sit-for 1 0 t)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2242 (if (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
2243 (re-search-forward
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2244 (concat "^[\^_]?\\("
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2245 pmail-unix-mail-delimiter
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2246 "\\|"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2247 pmail-mmdf-delim1 "\\|"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2248 "^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
2249 "\^L\n[01],\\)") 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
2250 (goto-char (match-beginning 1))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2251 (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
2252 (setq count (1+ count))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2253 (if quoted-printable-header-field-end
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2254 (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
2255 (unless
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2256 (mail-unquote-printable-region header-end (point) nil t t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2257 (message "Malformed MIME quoted-printable message"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2258 ;; Change "quoted-printable" to "8bit",
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2259 ;; to reflect the decoding we just did.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2260 (goto-char quoted-printable-header-field-end)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2261 (delete-region (point) (search-backward ":"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2262 (insert ": 8bit")))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2263 (if base64-header-field-end
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2264 (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
2265 (when
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2266 (condition-case nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2267 (progn
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2268 (base64-decode-region
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2269 (1+ header-end)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2270 (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
2271 ;; Prevent base64-decode-region
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2272 ;; from removing newline characters.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2273 (skip-chars-backward "\n\t ")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2274 (point)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2275 t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2276 (error nil))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2277 ;; Change "base64" to "8bit", to reflect the
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2278 ;; decoding we just did.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2279 (goto-char base64-header-field-end)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2280 (delete-region (point) (search-backward ":"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2281 (insert ": 8bit")))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2282
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2283 (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
2284 (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
2285 (narrow-to-region 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
2286 (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
2287 (while (search-forward "\n\^_" nil t) ; single char
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2288 (replace-match "\n^_")))) ; 2 chars: "^" and "_"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2289 ;; This is for malformed messages that don't end in newline.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2290 ;; There shouldn't be any, but some users say occasionally
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2291 ;; there are some.
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 (bolp) (newline))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2293 (insert ?\^_)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2294 (setq last-coding-system-used nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2295 (or 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
2296 (not 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
2297 (let ((mime-charset
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2298 (if (and pmail-decode-mime-charset
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2299 (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
2300 (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
2301 (search-forward "\n\n" 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
2302 (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
2303 (re-search-backward
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2304 pmail-mime-charset-pattern
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2305 start t))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2306 (intern (downcase (match-string 1))))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2307 (pmail-decode-region start (point) mime-charset)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2308 (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
2309 (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
2310 (forward-line 3)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2311 (insert "X-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
2312 (symbol-name 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
2313 "\n"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2314 (narrow-to-region (point) (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
2315 (and (= 0 (% count 10))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2316 (message "Converting to Babyl format...%d" count)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2317 ;;
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2318 ;; This kludge is because some versions of sendmail.el
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2319 ;; insert an extra newline at the beginning that shouldn't
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2320 ;; be there. sendmail.el has been fixed, but old versions
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2321 ;; may still be in use. -- rms, 7 May 1993.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2322 ((eolp) (delete-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
2323 (t (error "Cannot convert to babyl format")))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2324 (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
2325 count))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2326
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2327 ;; Delete the "From ..." line, creating various other headers with
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2328 ;; information from it if they don't already exist. Now puts the
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2329 ;; original line into a mail-from: header line for debugging and for
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2330 ;; use by the pmail-output function.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2331 (defun 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
2332 (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
2333 (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
2334 (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
2335 (end (progn
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2336 (condition-case ()
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2337 (search-forward "\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
2338 (error
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2339 (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
2340 (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
2341 (point)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2342 has-from has-date)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2343 (narrow-to-region start end)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2344 (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
2345 (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
2346 (setq has-from (search-forward "\nFrom:" 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
2347 (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
2348 (setq has-date (and (search-forward "\nDate:" nil t) (point)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2349 (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
2350 (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
2351 (if (re-search-forward (concat "^" pmail-unix-mail-delimiter) 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
2352 (replace-match
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2353 (concat
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2354 "Mail-from: \\&"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2355 ;; Keep and reformat the date if we don'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 ;; have a Date: field.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2357 (if has-date
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2358 ""
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2359 (concat
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2360 "Date: \\2, \\4 \\3 \\9 \\5 "
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2361
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2362 ;; The timezone could be matched by group 7 or group 10.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2363 ;; If neither of them matched, assume EST, since only
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2364 ;; Easterners would be so sloppy.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2365 ;; It's a shame the substitution can't use "\\10".
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2366 (cond
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2367 ((/= (match-beginning 7) (match-end 7)) "\\7")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2368 ((/= (match-beginning 10) (match-end 10))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2369 (buffer-substring (match-beginning 10)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2370 (match-end 10)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2371 (t "EST"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2372 "\n"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2373 ;; Keep and reformat the sender if we don't
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2374 ;; have a From: field.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2375 (if has-from
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2376 ""
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2377 "From: \\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
2378 t)))))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2379
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2380 ;;;; *** Pmail Message Formatting and Header Manipulation ***
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2381
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2382 (defun pmail-copy-headers (beg end &optional ignored-headers)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2383 "Copy displayed header fields to the message viewer buffer.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2384 BEG and END marks the start and end positions of the message in
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2385 the mail buffer. If the optional argument IGNORED-HEADERS is
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2386 non-nil, ignore all header fields whose names match that regexp.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2387 Otherwise, if `rmail-displayed-headers' is non-nil, copy only
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2388 those header fields whose names match that regexp. Otherwise,
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2389 copy all header fields whose names do not match
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2390 `rmail-ignored-headers' (unless they also match
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2391 `rmail-nonignored-headers')."
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2392 (let ((header-start-regexp "\n[^ \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
2393 lim)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2394 (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
2395 (when (search-forward "\n\n" 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
2396 (forward-char -1)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2397 (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
2398 ;; Put point right after the From header line.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2399 (narrow-to-region beg (point))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2400 (goto-char (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
2401 (unless (re-search-forward header-start-regexp nil t)
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2402 (pmail-error-bad-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
2403 (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
2404 (cond
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2405 ;; Handle the case where all headers should be copied.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2406 ((eq pmail-header-style 'full)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2407 (prepend-to-buffer pmail-view-buffer beg (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
2408 ;; Handle the case where the headers matching the diplayed
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2409 ;; headers regexp should be copied.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2410 ((and pmail-displayed-headers (null ignored-headers))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2411 (while (not (eobp))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2412 (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
2413 (setq lim (if (re-search-forward header-start-regexp 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
2414 (1+ (match-beginning 0))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2415 (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
2416 (when (looking-at pmail-displayed-headers)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2417 (append-to-buffer pmail-view-buffer (point) lim))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2418 (goto-char lim)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2419 ;; Handle the ignored headers.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2420 ((or ignored-headers (setq ignored-headers pmail-ignored-headers))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2421 (while (and ignored-headers (not (eobp)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2422 (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
2423 (setq lim (if (re-search-forward header-start-regexp 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
2424 (1+ (match-beginning 0))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2425 (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
2426 (if (and (looking-at ignored-headers)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2427 (not (looking-at pmail-nonignored-headers)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2428 (goto-char lim)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2429 (append-to-buffer pmail-view-buffer (point) lim)
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2430 (goto-char lim))))
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2431 (t (error "No headers selected for display!"))))))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2432
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2433 (defun pmail-toggle-header (&optional arg)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2434 "Show original message header if pruned header currently shown, or vice versa.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2435 With argument ARG, show the message header pruned if ARG is greater than zero;
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2436 otherwise, show it in full."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2437 (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
2438 (setq pmail-header-style
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2439 (cond
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2440 ((and (numberp arg) (> arg 0)) 'normal)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2441 ((eq pmail-header-style 'full) 'normal)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2442 (t 'full)))
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2443 (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
2444
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2445 ;; Lifted from repos-count-screen-lines.
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 ;; Return number of screen lines between START and END.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2447 (defun pmail-count-screen-lines (start end)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2448 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2449 (save-restriction
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2450 (narrow-to-region start end)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2451 (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
2452 (vertical-motion (- (point-max) (point-min))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2453
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2454 ;;;; *** Pmail Attributes and Keywords ***
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2455
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2456 (defun pmail-get-header (name &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
2457 "Return the value of message header NAME, nil if no such header
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2458 exists. MSG, if set identifies the message number to use. The
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2459 current mail message will be used otherwise."
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2460 (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
2461 (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
2462 (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
2463 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2464 (let* ((n (or msg 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
2465 (beg (pmail-msgbeg n))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2466 end)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2467 (goto-char beg)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2468 (setq end (search-forward "\n\n" 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
2469 (if end
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2470 (progn
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2471 (narrow-to-region beg end)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2472 (mail-fetch-field name))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2473 (pmail-error-bad-format 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
2474
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2475 (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
2476 "Return the message attributes in a comma separated string.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2477 MSG, if set identifies the message number to use. The current
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2478 mail message will be used otherwise."
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2479 (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
2480 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
2481 (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
2482 (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
2483 (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
2484 result
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2485 (cond
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2486 ((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
2487 (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
2488 (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
2489 result))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2490
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2491 (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
2492 "Return the message keywords in a comma separated string.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2493 MSG, if set identifies the message number to use. The current
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2494 mail message will be used otherwise."
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2495 (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
2496
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2497 (defun pmail-display-labels ()
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2498 "Update the mode line with the (set) attributes and keywords
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2499 for the 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
2500 (let (blurb attr-names keywords)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2501 ;; Combine the message attributes and keywords into a comma
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2502 ;; separated list.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2503 (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
2504 keywords (pmail-get-keywords 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
2505 (setq blurb
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2506 (cond
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2507 ((and attr-names keywords) (concat attr-names ", " keywords))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2508 (attr-names attr-names)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2509 (keywords keywords)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2510 (t "")))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2511 (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
2512 (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
2513 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
2514 ;; 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
2515 ;; `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
2516 (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
2517 (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
2518 (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
2519 (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
2520 (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
2521 (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
2522
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2523 (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
2524 "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
2525 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
2526 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
2527 (cond
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2528 ((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
2529 ((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
2530 (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
2531
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2532 (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
2533 "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
2534 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
2535 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
2536 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
2537 change; nil means 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
2538 (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
2539 (let ((value (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
2540 (omax (point-max-marker))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2541 (omin (point-min-marker))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2542 (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
2543 limit)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2544 (or msgnum (setq 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
2545 (if (> msgnum 0)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2546 (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
2547 (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
2548 ;; Determine if the current state is the desired state.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2549 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2550 (goto-char (pmail-msgbeg msgnum))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2551 (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
2552 (setq limit (search-forward "\n\n" 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
2553 (when (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
2554 (forward-char attr)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2555 (when (/= value (char-after))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2556 (delete-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
2557 (insert value)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2558 (if (= attr pmail-deleted-attr-index)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2559 (pmail-set-message-deleted-p msgnum state)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2560 ;; Note: we don't use save-restriction because that does not work right
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2561 ;; if changes are made outside the saved restriction
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2562 ;; before that restriction is restored.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2563 (narrow-to-region omin omax)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2564 (set-marker omin nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2565 (set-marker omax nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2566 (if (= 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
2567 (pmail-display-labels))))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2568
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2569 (defun pmail-message-attr-p (msg attrs)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2570 "Return t if the attributes header for message MSG contains a
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2571 match for the regexp ATTRS."
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2572 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2573 (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
2574 (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
2575 limit)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2576 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2577 (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
2578 (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
2579 (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
2580 (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
2581 (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
2582 (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
2583
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2584 (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
2585 "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
2586 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
2587 (pmail-message-attr-p msgnum "......U"))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2588
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2589
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2590 ;;;; *** 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
2591
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2592 ;; (defun pmail-get-collection-buffer ()
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2593 ;; "Return the buffer containing the mbox formatted messages."
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2594 ;; (if (eq major-mode 'pmail-mode)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2595 ;; (if pmail-buffers-swapped-p
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2596 ;; pmail-view-buffer
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2597 ;; pmail-buffer)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2598 ;; (error "The current buffer must be in Pmail mode.")))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2599
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2600 (defun pmail-use-collection-buffer ()
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2601 "Insure that the Pmail buffer contains the message collection.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2602 Return the current message number if the Pmail buffer is in a
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2603 swapped state, i.e. it currently contains a single decoded
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2604 message rather than an entire message collection, nil otherwise."
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2605 (let (result)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2606 (when pmail-buffers-swapped-p
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2607 (buffer-swap-text pmail-view-buffer)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2608 (setq pmail-buffers-swapped-p nil
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2609 result 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
2610 result))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2611
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2612 (defun pmail-use-viewer-buffer (&optional msgnum)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2613 "Insure that the Pmail buffer contains the current message.
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2614 If message MSGNUM is non-nil make it the current message and
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2615 display it. Return nil."
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2616 (let (result)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2617 (cond
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2618 ((not pmail-buffers-swapped-p)
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2619 (let ((message (or msgnum 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
2620 (pmail-show-message message)))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2621 ((and msgnum (/= msgnum 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
2622 (pmail-show-message msgnum))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2623 (t))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2624 result))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2625
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2626 (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
2627 (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
2628
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2629 (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
2630 (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
2631
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2632 (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
2633 "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
2634 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
2635 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
2636 again afterward.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2637
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2638 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
2639 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
2640 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2641 (unwind-protect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2642 (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
2643 (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
2644 (point-max))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2645 (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
2646 (funcall function))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2647 ;; 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
2648 ;; 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
2649 ;; 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
2650 (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
2651 (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
2652
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2653 (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
2654 (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
2655 (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
2656 (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
2657 (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
2658 (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
2659 (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
2660 (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
2661 (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
2662 (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
2663 (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
2664 (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
2665
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2666 (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
2667 (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
2668 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
2669 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
2670 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
2671 (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
2672
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2673 (defun pmail-count-new-messages (&optional nomsg)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2674 "Count the number of new messages in the region.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2675 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
2676 (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
2677 (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
2678 (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
2679 (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
2680 (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
2681 (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
2682 ;; 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
2683 ;; 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
2684 ;; 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
2685 (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
2686 (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
2687 (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
2688 (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
2689 (+ 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
2690 (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
2691 (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
2692 (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
2693 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
2694 (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
2695 (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
2696 (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
2697 (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
2698 (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
2699 (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
2700 ;; 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
2701 (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
2702 (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
2703 (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
2704 (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
2705 (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
2706 (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
2707
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2708 (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
2709 (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
2710 (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
2711 (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
2712 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2713 (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
2714 (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
2715 (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
2716 (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
2717 (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
2718 (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
2719 ;; 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
2720 (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
2721 (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
2722 ;; 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
2723 ;; 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
2724 ;; 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
2725 (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
2726 (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
2727 (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
2728
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2729 ;; 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
2730 (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
2731 (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
2732 (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
2733 (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
2734 (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
2735 (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
2736 (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
2737 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
2738 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
2739 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
2740 (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
2741 (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
2742 (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
2743 (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
2744 (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
2745
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2746
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2747 (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
2748 "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
2749 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
2750 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
2751 ;; 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
2752 ;; 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
2753 ;; 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
2754 ;; 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
2755 (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
2756 (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
2757 (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
2758 (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
2759 ?D
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2760 ?\ ) 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
2761
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2762 (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
2763 ;; 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
2764 (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
2765 (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
2766 (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
2767 (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
2768 ;; Show progress after every 20 messages or so.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2769 (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
2770 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
2771 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
2772 (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
2773 (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
2774 ;; 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
2775 (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
2776 (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
2777 (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
2778 (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
2779 (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
2780 (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
2781 total-messages (1+ total-messages)))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2782
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2783 (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
2784 "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
2785 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2786 (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
2787 (list (function (lambda ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2788 (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
2789 (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
2790
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2791 (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
2792 "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
2793 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2794 (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
2795 (list (function (lambda ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2796 (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
2797 (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
2798 (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
2799
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2800 (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
2801 "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
2802 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
2803 (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
2804 (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
2805 (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
2806 (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
2807 (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
2808 (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
2809 ",[[: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
2810 (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
2811 (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
2812 (not
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2813 ;; 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
2814 (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
2815 (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
2816 (concat "^\\("
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2817 (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
2818 "\\($\\|@\\)\\|"
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2819 (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
2820 (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
2821 (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
2822 (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
2823 (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
2824 "\\>\\)"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2825 addr))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2826 (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
2827 (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
2828 addr)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2829 (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
2830 (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
2831
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2832 (defun 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
2833 "Determine if the Pmail buffer is showing a message.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2834 If so restore the actual mbox message collection."
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2835 (unless (not pmail-buffers-swapped-p)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2836 (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
2837 (buffer-swap-text 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
2838 (setq pmail-buffers-swapped-p nil))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2839
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2840 (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
2841 "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
2842 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
2843 (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
2844 (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
2845 (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
2846 (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
2847 (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
2848 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2849 (let (blurb)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2850 (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
2851 (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
2852 (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
2853 (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
2854 (setq blurb "No mail.")))
98526
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2855 (setq blurb (pmail-show-message n))
276fe938ccc2 Next step in the Rmail/mbox support: getting basic summary support working.
Paul Reilly <pmr@pajato.com>
parents: 98313
diff changeset
2856 (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
2857 (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
2858 (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
2859 ;; 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
2860 ;; 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
2861 ;; 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
2862 ;; 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
2863 ;; 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
2864 (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
2865 (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
2866 (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
2867 (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
2868 (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
2869 (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
2870 (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
2871 (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
2872
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2873 (defun 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
2874 "Return t if the region contains a text message, nil
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2875 otherwise."
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2876 (save-excursion
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2877 (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
2878 (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
2879 ;; 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
2880 ;; (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
2881 ;; 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
2882 (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
2883 (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
2884
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2885 (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
2886 "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
2887 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
2888 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
2889 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
2890 (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
2891 (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
2892 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
2893 (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
2894 (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
2895 (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
2896 (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
2897 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
2898 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
2899 ((> 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
2900 (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
2901 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
2902 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
2903 (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
2904 (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
2905 ;; 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
2906 ;; 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
2907 (pmail-set-attribute pmail-unseen-attr-index nil)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2908 (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
2909 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
2910 (widen)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2911 (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
2912 (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
2913 (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
2914 (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
2915 (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
2916 (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
2917 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
2918 coding-system (pmail-get-coding-system))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2919 (widen)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2920 (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
2921 ;; 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
2922 ;; 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
2923 ;; place.
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2924 (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
2925 (erase-buffer))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2926 (with-temp-buffer
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2927 (set-buffer-multibyte nil)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2928 (insert-buffer-substring mbox-buf body-start end)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2929 (cond
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2930 ((string= character-coding "quoted-printable")
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2931 (mail-unquote-printable-region (point-min) (point-max)))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2932 ((and (string= character-coding "base64") 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
2933 (base64-decode-region (point-min) (point-max)))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2934 ((eq character-coding 'uuencode)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2935 (error "Not supported yet."))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2936 (t))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2937 (pmail-decode-region (point-min) (point-max) coding-system view-buf))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2938 ;; 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
2939 (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
2940 (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
2941 (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
2942 ;; 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
2943 ;; 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
2944 ;; 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
2945 (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
2946 (insert "\n")
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2947 (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
2948 (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
2949 ;(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
2950 ;(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
2951 )
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2952 ;; 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
2953 ;; 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
2954 (pmail-display-labels)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2955 (buffer-swap-text 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
2956 (setq pmail-buffers-swapped-p t)
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2957 (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
2958 blurb))
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
2959
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2960 ;; 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
2961 (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
2962 ;; 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
2963 (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
2964 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
2965 (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
2966 (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
2967 (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
2968 (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
2969 (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
2970 (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
2971 ;; 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
2972 ;; 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
2973 (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
2974 (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
2975 '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
2976 ;; 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
2977 (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
2978 (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
2979 (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
2980 (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
2981 (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
2982 overlay)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2983 (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
2984 (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
2985 ;; 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
2986 (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
2987 (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
2988 (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
2989 (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
2990 ;; 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
2991 (progn
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
2992 (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
2993 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
2994 (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
2995 (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
2996 ;; 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
2997 ;; 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
2998 (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
2999 (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
3000 (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
3001 (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
3002
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3003 (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
3004 "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
3005 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
3006 (if (or (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
3007 (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
3008 (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
3009 (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
3010 ;; 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
3011 ;; 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
3012 nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3013 ;; 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
3014 (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
3015 (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
3016 (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
3017 (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
3018 (directive-loop nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3019 (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
3020 (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
3021 (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
3022 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
3023 (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
3024 (let ((f (cond
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3025 ((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
3026 ((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
3027 ((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
3028 (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
3029 (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
3030 (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
3031 ;; 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
3032 (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
3033 (if (null folder)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3034 (pmail-delete-forward)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3035 (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
3036 (pmail-delete-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
3037 (pmail-output-to-pmail-file folder 1 t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3038 (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
3039 (setq d (cdr d))))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3040
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3041 (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
3042 "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
3043 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
3044 (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
3045 (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
3046 (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
3047 (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
3048
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3049 (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
3050 "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
3051 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
3052 (interactive "p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3053 (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
3054
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3055 (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
3056 "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
3057 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
3058 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
3059
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3060 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
3061 (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
3062 (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
3063 (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
3064 (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
3065 (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
3066 (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
3067 (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
3068 (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
3069 (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
3070 (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
3071 (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
3072 (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
3073 (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
3074 (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
3075 (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
3076 t)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3077 (if (< n 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3078 (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
3079 (if (> n 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3080 (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
3081 nil)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3082
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3083 (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
3084 "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
3085 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
3086 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
3087 (interactive "p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3088 (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
3089
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3090 (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
3091 "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
3092 (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
3093 (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
3094 (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
3095
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3096 (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
3097 "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
3098 (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
3099 (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
3100 (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
3101
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3102 (defun pmail-what-message ()
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3103 (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
3104 (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
3105 (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
3106 (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
3107 (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
3108 (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
3109 (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
3110 (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
3111 (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
3112 (if (>= where (pmail-msgbeg high)) high low)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3113
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3114 (defun pmail-message-recipients-p (msg recipients &optional primary-only)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3115 (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
3116 (goto-char (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
3117 (search-forward "\n*** EOOH ***\n")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3118 (narrow-to-region (point) (progn (search-forward "\n\n") (point)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3119 (or (string-match recipients (or (mail-fetch-field "To") ""))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3120 (string-match recipients (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
3121 (if (not primary-only)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3122 (string-match recipients (or (mail-fetch-field "Cc") ""))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3123
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3124 (defun pmail-message-regexp-p (n regexp)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3125 "Return t, if for message number N, regexp REGEXP matches in the header."
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3126 (let ((beg (pmail-msgbeg n))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3127 (end (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
3128 (goto-char beg)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3129 (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
3130 (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
3131 (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
3132 (if (prog1 (= (following-char) ?0)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3133 (forward-line 2)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3134 ;; If there's a Summary-line in the (otherwise empty)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3135 ;; header, we didn't yet get past the EOOH line.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3136 (when (looking-at "^\\*\\*\\* EOOH \\*\\*\\*\n")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3137 (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
3138 (setq 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
3139 (narrow-to-region (point) end))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3140 (progn
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3141 (rfc822-goto-eoh)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3142 (setq end (point)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3143 (setq 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
3144 (search-forward "\n*** EOOH ***\n" end t)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3145 (setq end (1+ (match-beginning 0)))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3146 (goto-char beg)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3147 (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
3148 (funcall pmail-search-mime-header-function n regexp end)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3149 (re-search-forward regexp end t)))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3150
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3151 (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
3152 "Return non-nil, if for message number MSG, regexp REGEXP matches."
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3153 (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
3154 (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
3155 (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
3156 (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
3157
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3158 (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
3159 (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
3160 "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
3161 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
3162 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
3163 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
3164 (interactive
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3165 (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
3166 (prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3167 (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
3168 regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3169 (setq prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3170 (concat prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3171 (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
3172 (concat ", default "
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3173 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
3174 "): ")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3175 (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
3176 (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
3177 (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
3178 ((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
3179 (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
3180 (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
3181 (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
3182 (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
3183 (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
3184 (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
3185 regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3186 (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
3187 (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
3188 (let ((omin (point-min))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3189 (omax (point-max))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3190 (opoint (point))
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3191 win
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3192 (reversep (< n 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
3193 (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
3194 (unwind-protect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3195 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3196 (widen)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3197 (while (/= n 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3198 ;; Check messages one by one, advancing message number up or down
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3199 ;; but searching forward through each message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3200 (if reversep
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3201 (while (and (null win) (> msg 1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3202 (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
3203 win (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
3204 (while (and (null win) (< msg pmail-total-messages))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3205 (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
3206 win (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
3207 (setq n (+ n (if reversep 1 -1)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3208 (if win
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3209 (progn
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
3210 (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
3211 ;; 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
3212 ;; (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
3213 ;; 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
3214 ;; 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
3215 ;; 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
3216 ;; portion.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3217 (if reversep
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3218 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3219 (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
3220 (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
3221 (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
3222 (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
3223 (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
3224 (if reversep "Reverse " "")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3225 regexp))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3226 (goto-char opoint)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3227 (narrow-to-region omin omax)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3228 (ding)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3229 (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
3230
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3231 (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
3232 "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
3233 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
3234 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
3235 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
3236 (interactive
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3237 (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
3238 (prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3239 (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
3240 regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3241 (setq prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3242 (concat prompt
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3243 (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
3244 (concat ", default "
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3245 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
3246 "): ")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3247 (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
3248 (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
3249 (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
3250 ((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
3251 (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
3252 (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
3253 (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
3254 (pmail-search regexp (- (or n 1))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3255
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3256
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3257 (defun 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
3258 "Return the message index for the first message which has the
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3259 `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
3260 (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
3261 (let ((current 1)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3262 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
3263 (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
3264 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3265 (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
3266 (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
3267 (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
3268 (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
3269 found))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3270
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3271 (defun pmail-current-subject ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3272 "Return the current subject.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3273 The subject is stripped of leading and trailing whitespace, and
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3274 of typical reply prefixes such as Re:."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3275 (let ((subject (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
3276 (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
3277 (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
3278 (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
3279 (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
3280 (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
3281 (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
3282 subject))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3283
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3284 (defun pmail-current-subject-regexp ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3285 "Return a regular expression matching the current subject.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3286 The regular expression matches the subject header line of
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3287 messages about the same subject. The subject itself is stripped
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3288 of leading and trailing whitespace, of typical reply prefixes
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3289 such as Re: and whitespace within the subject is replaced by a
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3290 regular expression matching whitespace in general in order to
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3291 take into account that subject header lines may include newlines
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3292 and more whitespace. The returned regular expressions contains
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3293 `pmail-reply-regexp' and ends with a newline."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3294 (let ((subject (pmail-current-subject)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3295 ;; If Subject is long, mailers will break it into several lines at
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3296 ;; arbitrary places, so replace whitespace with a regexp that will
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3297 ;; match any sequence of spaces, TABs, and newlines.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3298 (setq subject (regexp-quote subject))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3299 (setq subject
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3300 (replace-regexp-in-string "[ \t\n]+" "[ \t\n]+" subject t t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3301 ;; Some mailers insert extra spaces after "Subject:", so allow any
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3302 ;; amount of them.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3303 (concat "^Subject:[ \t]+"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3304 (if (string= "\\`" (substring pmail-reply-regexp 0 2))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3305 (substring pmail-reply-regexp 2)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3306 pmail-reply-regexp)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3307 subject "[ \t]*\n")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3308
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3309 (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
3310 "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
3311 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
3312 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
3313 (interactive "p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3314 (let ((search-regexp (pmail-current-subject-regexp))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3315 (forward (> n 0))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3316 (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
3317 (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
3318 found)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3319 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3320 (save-restriction
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3321 (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
3322 (while (and (/= n 0)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3323 (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
3324 (< 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
3325 (> i 1)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3326 (let (done)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3327 (while (and (not done)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3328 (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
3329 (< 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
3330 (> i 1)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3331 (setq i (if forward (1+ 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
3332 (goto-char (pmail-msgbeg i))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3333 (search-forward "\n*** EOOH ***\n")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3334 (let ((beg (point)) end)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3335 (search-forward "\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
3336 (setq end (point))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3337 (goto-char beg)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3338 (setq done (re-search-forward search-regexp end t))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3339 (if done (setq found i)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3340 (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
3341 (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
3342 (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
3343 (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
3344 (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
3345
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3346 (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
3347 "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
3348 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
3349 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
3350 (interactive "p")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3351 (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
3352
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3353 ;;;; *** 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
3354
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3355 (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
3356 (= (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
3357
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3358 (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
3359 (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
3360
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3361 (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
3362 "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
3363 (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
3364 (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
3365 (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
3366
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3367 (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
3368 "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
3369 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3370 (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
3371 (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
3372 (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
3373 (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
3374 (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
3375 (if (= msg 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3376 (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
3377 (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
3378 (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
3379 (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
3380 (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
3381 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3382 (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
3383 (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
3384 (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
3385
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3386 (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
3387 "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
3388 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
3389 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
3390
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3391 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
3392 (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
3393 (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
3394 (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
3395 (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
3396 (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
3397 (pmail-select-summary
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3398 (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
3399 (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
3400 (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
3401
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3402 (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
3403 "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
3404 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
3405 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3406 (pmail-delete-forward t))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3407
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3408 ;; 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
3409 ;; 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
3410 ;; 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
3411 ;; 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
3412 (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
3413 (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
3414 nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3415 (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
3416 (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
3417 (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
3418 (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
3419 (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
3420 (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
3421 newnum)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3422
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3423 (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
3424 "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
3425 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
3426 (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
3427 (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
3428 (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
3429 (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
3430 (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
3431 "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
3432
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3433 (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
3434 "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
3435 (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
3436 (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
3437 (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
3438 ;; 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
3439 (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
3440 (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
3441 (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
3442 (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
3443 (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
3444 (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
3445 (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
3446 0
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3447 (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
3448 (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
3449 (- (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
3450 (- (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
3451 (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
3452 (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
3453 ;; 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
3454 (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
3455 (win))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3456 (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
3457 (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
3458 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3459 (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
3460 (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
3461 (number 1)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3462 (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
3463 (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
3464 (new-summary nil)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3465 (new-msgref (list (list 0)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3466 (pmailbuf (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
3467 (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
3468 (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
3469 (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
3470 (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
3471 (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
3472 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
3473 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
3474 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
3475 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
3476
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3477 (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
3478 (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
3479 (progn
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3480 (delete-region
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3481 (marker-position (aref messages number))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3482 (marker-position (aref messages (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
3483 (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
3484 (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
3485 (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
3486 (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
3487 (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
3488 (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
3489 (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
3490 (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
3491 (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
3492 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
3493 (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
3494 (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
3495 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
3496 (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
3497 (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
3498 (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
3499 (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
3500 (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
3501 (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
3502 (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
3503 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
3504 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
3505 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
3506 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
3507 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
3508 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
3509 (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
3510 (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
3511 (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
3512 (if (not dont-show)
98313
c7eef45e0d32 First pass at handling decoding the mbox message into the view buffer.
Paul Reilly <pmr@pajato.com>
parents: 98182
diff changeset
3513 (pmail-show-message-maybe (< 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
3514 (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
3515 (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
3516 (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
3517 (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
3518
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3519 (defun pmail-expunge ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3520 "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
3521 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3522 (when (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
3523 (pmail-only-expunge)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3524 (if (pmail-summary-exists)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3525 (pmail-select-summary (pmail-update-summary)))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3526
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3527 ;;;; *** Pmail Mailing Commands ***
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3529 (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
3530 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
3531 (let (yank-action)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3532 (if replybuffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3533 (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
3534 (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
3535 (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
3536 (if same-window
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3537 (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
3538 noerase nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3539 yank-action sendactions)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3540 (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
3541 (prog1
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3542 (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
3543 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
3544 yank-action sendactions)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3545 ;; 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
3546 ;; 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
3547 (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
3548 '((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
3549 (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
3550 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
3551 yank-action sendactions)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3552
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3553 (defun pmail-mail ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3554 "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
3555 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
3556 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
3557 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3558 (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
3559
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3560 (defun pmail-continue ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3561 "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
3562 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3563 (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
3564
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3565 (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
3566 "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
3567 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
3568 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
3569 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
3570 (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
3571 (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
3572 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
3573 (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
3574 (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
3575 (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
3576 (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
3577 (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
3578 (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
3579 (if (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
3580 (1+ (match-beginning 0))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3581 (point)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3582 (widen)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3583 (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
3584 (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
3585 (if (= (following-char) ?0)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3586 (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
3587 (progn (forward-line 2)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3588 (point))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3589 (progn (search-forward "\n\n" (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
3590 'move)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3591 (point)))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3592 (narrow-to-region (point)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3593 (progn (search-forward "\n*** EOOH ***\n")
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3594 (beginning-of-line) (point)))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3595 (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
3596 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
3597 (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
3598 from)
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3599 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
3600 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
3601 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
3602 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
3603 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
3604 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
3605 (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
3606 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
3607 ;;; 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
3608 ;;; 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
3609 ;;; 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
3610 )
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3611 (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
3612 (if (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
3613 ;; If this header field is present, use it instead of the To and CC fields.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3614 (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
3615 (setq cc (or (mail-fetch-field "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
3616 to (or (mail-fetch-field "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
3617
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3618 ))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3619
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3620 ;; 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
3621 (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
3622 (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
3623 (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
3624 (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
3625 (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
3626 (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
3627 (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
3628 (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
3629 ;; 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
3630 (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
3631 (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
3632 (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
3633 (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
3634 (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
3635 (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
3636 subject))))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3637 (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
3638 nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3639 ;; 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
3640 ;; 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
3641 ;; 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
3642 ;; 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
3643 ;;; (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
3644 ;; 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
3645 ;; 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
3646 ;; in cc. But if what's left is an empty list, use the original.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3647 (let* ((reply-to-list (pmail-dont-reply-to 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
3648 (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
3649 subject
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3650 (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
3651 (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
3652 nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3653 ;; 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
3654 ;; to do its job.
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3655 (let* ((cc-list (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
3656 (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
3657 (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
3658 (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
3659 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
3660 (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
3661 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
3662 (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
3663 (aref pmail-msgref-vector msgnum))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3664 "answered"))
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3665 nil
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3666 (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
3667 " " 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
3668
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
3669 (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
3670 "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
3671 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
3672 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
3673 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
3674 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3675 (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
3676 (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
3677 (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
3678
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3679 (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
3680 (cond ((not from)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3681 (if message-id
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3682 message-id
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3683 nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3684 (mail-use-rfc822
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3685 (require 'rfc822)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3686 (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
3687 (if message-id
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3688 (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
3689 (string-match
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3690 (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
3691 (substring tem 0
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3692 (match-beginning 0))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3693 tem))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3694 message-id))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3695 ;; 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
3696 message-id
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3697 (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
3698 ;; 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
3699 (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
3700 (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
3701 (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
3702 ;; 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
3703 (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
3704 (if date
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3705 (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
3706 field)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3707 ((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
3708 (bar "[^][\000-\037()<>@,;:\\\"]+"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3709 ;; 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
3710 (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
3711 "\\)\\(<" foo "@" foo ">\\)?[ \t]*\\'")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3712 ;; "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
3713 from)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3714 (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
3715 bar "\\))[ \t]*\\'")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3716 ;; "<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
3717 from)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3718 (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
3719 (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
3720 ;; 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
3721 (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
3722 (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
3723 (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
3724 (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
3725 (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
3726 (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
3727 (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
3728 (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
3729 (if message-id
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3730 ;; "<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
3731 (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
3732 field))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3733 (t
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3734 ;; 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
3735 (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
3736 (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
3737
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3738 (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
3739 "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
3740 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
3741 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
3742 (interactive "P")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3743 (if resend
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3744 (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
3745 (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
3746 (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
3747 (subject (concat "["
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3748 (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
3749 (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
3750 (if from
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3751 (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
3752 ""))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3753 (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
3754 "]")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3755 (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
3756 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
3757 (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
3758 forward-buffer
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3759 (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
3760 (aref pmail-msgref-vector msgnum))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3761 "forwarded"))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3762 ;; 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
3763 ;; 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
3764 ;; 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
3765 ;; 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
3766 (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
3767 ;; 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
3768 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3769 ;; 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
3770 (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
3771 (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
3772 (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
3773 forward-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3774 (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
3775 ;; 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
3776 (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
3777 (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
3778 (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
3779 (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
3780 (goto-char beg)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3781 (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
3782 (beginning-of-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3783 (insert "- ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3784 (forward-line 1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3785 (goto-char end)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3786 (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
3787 (if (< (point) end)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3788 (forward-char 1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3789 (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
3790 (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
3791 (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
3792 (push-mark))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3793
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3794 (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
3795 "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
3796 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
3797 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
3798
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3799 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
3800 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
3801 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
3802 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
3803 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
3804 (interactive "sResend to: ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3805 (require 'sendmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3806 (require 'mailalias)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3807 (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
3808 (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
3809 (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
3810 (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
3811 (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
3812 (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
3813 (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
3814 (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
3815 (mailbuf pmail-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3816 (unwind-protect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3817 (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
3818 ;;>> 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
3819 (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
3820 (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
3821 (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
3822 (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
3823 ;; 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
3824 ; 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
3825 (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
3826 ; 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
3827 ; 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
3828 (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
3829 (let (beg)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3830 (setq beg (point))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3831 (forward-line 1)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3832 (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
3833 (forward-line 1))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3834 (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
3835 ; 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
3836 ; are inserted there.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3837 (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
3838 ;;>> Insert resent-from:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3839 (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
3840 (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
3841 ;;>> 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
3842 (let ((before (point)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3843 (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
3844 (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
3845 (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
3846 address
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3847 (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
3848 "\n")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3849 ;; 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
3850 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3851 (if (featurep 'mailabbrev)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3852 (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
3853 (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
3854 (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
3855 (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
3856 (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
3857 (build-mail-abbrevs))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3858 (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
3859 (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
3860 (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
3861 (goto-char before)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3862 (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
3863 (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
3864 (<= (point) end)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3865 (expand-abbrev))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3866 (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
3867 (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
3868 ;;>> 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
3869 (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
3870 (let ((before (point))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3871 after)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3872 (insert comment)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3873 (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
3874 (setq after (point))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3875 (goto-char before)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3876 (while (< (point) after)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3877 (insert "Resent-Comment: ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3878 (forward-line 1))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3879 ;; 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
3880 ;; 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
3881 (let (mail-aliases)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3882 (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
3883 (kill-buffer tembuf))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3884 (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
3885 (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
3886
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3887 (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
3888 (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
3889 "^ *---+ +Returned message +---+ *$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3890 "^ *---+ *Returned mail follows *---+ *$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3891 "^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
3892 "^---+ 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
3893 "^ *---+ +Original message +---+ *$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3894 "^ *--+ +begin message +--+ *$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3895 "^ *---+ +Original message follows +---+ *$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3896 "^ *---+ +Your message follows +---+ *$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3897 "^|? *---+ +Message text follows: +---+ *|?$\\|"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3898 "^ *---+ +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
3899 "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
3900
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3901 (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
3902 "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
3903
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3904 (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
3905 "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
3906 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
3907 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
3908 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
3909 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
3910 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
3911 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
3912 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
3913 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
3914 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3915 (require 'mail-utils)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3916 (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
3917 (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
3918 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
3919 ;; 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
3920 ;; 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
3921 (content-type
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3922 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3923 (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
3924 (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
3925 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3926 (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
3927 (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
3928 (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
3929 (string-match
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3930 ";[\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
3931 content-type))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3932 ;; 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
3933 (let ((codestring
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3934 (concat "\n--"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3935 (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
3936 (match-end 1)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3937 (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
3938 (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
3939 (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
3940 (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
3941 (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
3942 (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
3943 (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
3944 (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
3945 ;; Non-MIME bounce.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3946 (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
3947 (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
3948 (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
3949 ;; 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
3950 ;; 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
3951 ;; `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
3952 (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
3953 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3954 (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
3955 (skip-chars-forward " ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3956 (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
3957 (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
3958 (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
3959 (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
3960 ;; 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
3961 ;; 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
3962 ;; 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
3963 ;; 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
3964 ;; 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
3965 ;; 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
3966 (if (looking-at "^--")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3967 (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
3968 (point)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3969 (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
3970 (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
3971 (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
3972 (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
3973 (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
3974 (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
3975 (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
3976 (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
3977 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
3978 (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
3979 (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
3980 ;; 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
3981 ;; 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
3982 ;; 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
3983 ;; 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
3984 (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
3985 (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
3986 (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
3987 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
3988 (aref pmail-msgref-vector msgnum)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3989 "retried")))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3990 ;; 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
3991 ;; 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
3992 ;; 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
3993 (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
3994 pmail-displayed-headers
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3995 pmail-ignored-headers)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3996 (erase-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3997 (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
3998 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
3999 (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
4000 (if bounce-indent
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4001 (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
4002 (pmail-clear-headers pmail-retry-ignored-headers)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4003 (pmail-clear-headers "^sender:\\|^return-path:\\|^received:")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4004 (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
4005 (save-restriction
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4006 (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
4007 (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
4008 (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
4009 (if resending
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4010 (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
4011 (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
4012 (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
4013 (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
4014
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4015 (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
4016 "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
4017 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
4018 (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
4019 pmail-summary-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4020
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4021 (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
4022 "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
4023 (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
4024
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4025 (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
4026 "*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
4027 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
4028 :type 'boolean
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4029 :group 'pmail-summary)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4030
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4031 (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
4032 "*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
4033 :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
4034 :group 'pmail-summary)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4035
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4036 ;; 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
4037 (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
4038 (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
4039 window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4040 ;; 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
4041 (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
4042 pmail-redisplay-summary
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4043 (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
4044 ;; 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
4045 (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
4046 (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
4047 (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
4048 (raise-frame frame))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4049 (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
4050 ;; 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
4051 (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
4052 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
4053 (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
4054 ;; 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
4055 (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
4056 (unwind-protect
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4057 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4058 (select-window window)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4059 (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
4060 (select-window selected)))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4061
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4062 ;;;; *** Pmail Local Fontification ***
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4063
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4064 (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
4065 ;; 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
4066 (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
4067 ;; 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
4068 (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
4069 ;; 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
4070 (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
4071
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4072 (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
4073 ;; 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
4074 (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
4075 (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
4076 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
4077 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
4078 (save-restriction
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4079 (widen)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4080 (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
4081 (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
4082 (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
4083 (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
4084
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4085 (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
4086 ;; 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
4087 (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
4088 (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
4089 (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
4090 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
4091 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
4092 (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
4093 (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
4094 (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
4095 (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
4096 (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
4097
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4098 ;;; 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
4099 (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
4100
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4101 (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
4102 "*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
4103 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
4104 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
4105
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4106 (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
4107 "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
4108
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4109 (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
4110 "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
4111
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4112 (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
4113 "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
4114 (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
4115 nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4116 (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
4117
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4118 (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
4119 (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
4120 (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
4121 (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
4122 '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
4123
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4124 (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
4125 '(["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
4126 ["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
4127 (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
4128 (looking-at "<M> "))])
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4129 "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
4130
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4131 ;; 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
4132 (if (featurep 'speedbar)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4133 (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
4134 (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
4135
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4136 (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
4137 "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
4138 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
4139 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
4140 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
4141 (let ((from nil))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4142 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4143 (set-buffer buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4144 (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
4145 (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
4146 (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
4147 (setq from t)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4148 (if from
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4149 nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4150 (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
4151 (end-of-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4152 (point))))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4153 (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
4154 (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
4155 (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
4156 nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4157 (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
4158 (erase-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4159 (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
4160 (if (stringp from)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4161 (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
4162 '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
4163 (insert "Folders:\n")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4164 (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
4165 (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
4166 default-directory)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4167 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
4168 (while df
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4169 (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
4170 '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
4171 (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
4172 '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
4173 (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
4174
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4175 (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
4176 "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
4177 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
4178 (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
4179 (funcall token t)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4180
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4181 (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
4182 "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
4183 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
4184 (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
4185 (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
4186 (find-file text)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4187
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4188 (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
4189 "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
4190 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4191 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4192 (beginning-of-line)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4193 (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
4194 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4195 (forward-char -2)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4196 (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
4197
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4198 (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
4199 "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
4200 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
4201 (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
4202 (message "Moving message to %s" token)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4203 (pmail-output-to-pmail-file token)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4204
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4205 ; 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
4206 ; 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
4207 ; 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
4208 ; 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
4209
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4210 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4211 (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
4212 "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
4213 (interactive "sPassword: ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4214 (if password
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4215 (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
4216 (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
4217 (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
4218 (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
4219
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4220 (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
4221 "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
4222 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
4223 (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
4224 (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
4225 (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
4226 (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
4227 "IMAP password: "
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4228 "POP password: "))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4229 (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
4230 (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
4231 (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
4232
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4233 (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
4234 (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
4235
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4236 (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
4237 "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
4238 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
4239 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
4240 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
4241 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
4242 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
4243 (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
4244 (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
4245 (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
4246 (while (< i len)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4247 (if (= curmask 0)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4248 (setq curmask mask))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4249 (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
4250 (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
4251 (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
4252 (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
4253 (concat string-vector)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4254
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4255 ;;;; Desktop support
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4256
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4257 (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
4258 desktop-buffer-name
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4259 desktop-buffer-misc)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4260 "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
4261 (condition-case error
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4262 (progn
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4263 (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
4264 (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
4265 (current-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4266 pmail-buffer))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4267 (file-locked
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4268 (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
4269 nil)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4270
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4271 (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
4272 '(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
4273
98182
19ec1646fe6c The Rmail/mbox merge has been abandoned in favor of a restart using
Paul Reilly <pmr@pajato.com>
parents: 98051
diff changeset
4274
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4275 (provide 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4276
98019
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 98013
diff changeset
4277 ;; Local Variables:
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 98013
diff changeset
4278 ;; 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
4279 ;; End:
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 98013
diff changeset
4280
97534
4d30ed7d18e3 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 97533
diff changeset
4281 ;; 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
4282 ;;; pmail.el ends here