annotate lisp/mail/rmail.el @ 20794:13d0a6194de7

(DECODE_SJIS_BIG5_CHARACTER): Don't have to increase coding->produced_char here. (code_convert_region): Initialize LEN_BYTE correctly.
author Kenichi Handa <handa@m17n.org>
date Wed, 28 Jan 1998 12:37:25 +0000
parents 80f0f0390eb6
children 2d4cea4b9e81
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 621
diff changeset
1 ;;; rmail.el --- main code of "RMAIL" mail reader for Emacs.
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 621
diff changeset
2
17620
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
3 ;; Copyright (C) 1985,86,87,88,93,94,95,96,97 Free Software Foundation, Inc.
846
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 830
diff changeset
4
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
5 ;; Maintainer: FSF
814
38b2499cb3e9 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 813
diff changeset
6 ;; Keywords: mail
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
7
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
9
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
13 ;; any later version.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
14
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
19
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14033
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14033
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14033
diff changeset
23 ;; Boston, MA 02111-1307, USA.
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
24
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
25 ;;; Code:
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
26
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
27 ;; Souped up by shane@mit-ajax based on ideas of rlk@athena.mit.edu
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
28 ;; New features include attribute and keyword support, message
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
29 ;; selection by dispatch table, summary by attributes and keywords,
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
30 ;; expunging by dispatch table, sticky options for file commands.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
31
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
32 ;; Extended by Bob Weiner of Motorola
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
33 ;; New features include: rmail and rmail-summary buffers remain
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
34 ;; synchronized and key bindings basically operate the same way in both
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
35 ;; buffers, summary by topic or by regular expression, rmail-reply-prefix
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
36 ;; variable, and a bury rmail buffer (wipe) command.
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
37 ;;
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
38
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
39 (require 'mail-utils)
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
40
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
41 ;; For Emacs V18 compatibility
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
42 (and (not (fboundp 'buffer-disable-undo))
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
43 (fboundp 'buffer-flush-undo)
2571
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2423
diff changeset
44 (defalias 'buffer-disable-undo 'buffer-flush-undo))
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
45
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
46 ; These variables now declared in paths.el.
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
47 ;(defvar rmail-spool-directory "/usr/spool/mail/"
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
48 ; "This is the name of the directory used by the system mailer for\n\
16431
65d3768ccb05 (rmail): Run rmail-mail-hook last.
Richard M. Stallman <rms@gnu.org>
parents: 16349
diff changeset
49 ;delivering new mail. Its name should end with a slash.")
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
50 ;(defvar rmail-file-name
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
51 ; (expand-file-name "~/RMAIL")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
52 ; "")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
53
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
54 (defgroup rmail nil
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
55 "Mail reader for Emacs."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
56 :group 'mail)
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
57
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
58 (defgroup rmail-retrieve nil
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
59 "Rmail retrieval options."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
60 :prefix "rmail-"
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
61 :group 'rmail)
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
62
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
63 (defgroup rmail-files nil
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
64 "Rmail files."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
65 :prefix "rmail-"
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
66 :group 'rmail)
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
67
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
68 (defgroup rmail-headers nil
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
69 "Rmail header options."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
70 :prefix "rmail-"
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
71 :group 'rmail)
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
72
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
73 (defgroup rmail-reply nil
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
74 "Rmail reply options."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
75 :prefix "rmail-"
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
76 :group 'rmail)
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
77
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
78 (defgroup rmail-summary nil
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
79 "Rmail summary options."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
80 :prefix "rmail-"
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
81 :prefix "rmail-summary-"
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
82 :group 'rmail)
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
83
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
84 (defgroup rmail-output nil
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
85 "Output message to a file."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
86 :prefix "rmail-output-"
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
87 :prefix "rmail-"
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
88 :group 'rmail)
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
89
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
90
8234
8eea81545089 (rmail-movemail-program): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 8230
diff changeset
91 (defvar rmail-movemail-program nil
8eea81545089 (rmail-movemail-program): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 8230
diff changeset
92 "If non-nil, name of program for fetching new mail.")
8eea81545089 (rmail-movemail-program): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 8230
diff changeset
93
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
94 (defcustom rmail-pop-password nil
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
95 "*Password to use when reading mail from a POP server, if required."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
96 :type '(choice (string :tag "Password")
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
97 (const :tag "Not Required" nil))
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
98 :group 'rmail-retrieve)
15085
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
99
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
100 (defcustom rmail-pop-password-required nil
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
101 "*Non-nil if a password is required when reading mail using POP."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
102 :type 'boolean
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
103 :group 'rmail-retrieve)
15085
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
104
18989
6253a99afd95 (rmail-pop-password-error): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18957
diff changeset
105 (defvar rmail-pop-password-error "invalid usercode or password"
6253a99afd95 (rmail-pop-password-error): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18957
diff changeset
106 "Regular expression matching incorrect-password POP server error messages.
6253a99afd95 (rmail-pop-password-error): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18957
diff changeset
107 If you get an incorrect-password error that this expression does not match,
6253a99afd95 (rmail-pop-password-error): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18957
diff changeset
108 please report it with \\[report-emacs-bug].")
6253a99afd95 (rmail-pop-password-error): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18957
diff changeset
109
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
110 (defcustom rmail-preserve-inbox nil
16908
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
111 "*Non-nil if incoming mail should be left in the user's inbox,
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
112 rather than deleted, after it is retrieved."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
113 :type 'boolean
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
114 :group 'rmail-retrieve)
16908
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
115
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
116 ;;;###autoload
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
117 (defcustom rmail-dont-reply-to-names nil "\
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
118 *A regexp specifying names to prune of reply to messages.
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
119 A value of nil means exclude your own name only."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
120 :type '(choice regexp (const :tag "Your Name" nil))
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
121 :group 'rmail-reply)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
122
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
123 ;;;###autoload
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
124 (defvar rmail-default-dont-reply-to-names "info-" "\
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
125 A regular expression specifying part of the value of the default value of
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
126 the variable `rmail-dont-reply-to-names', for when the user does not set
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
127 `rmail-dont-reply-to-names' explicitly. (The other part of the default
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
128 value is the user's name.)
3931
565b67d1a9f9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 3877
diff changeset
129 It is useful to set this variable in the site customization file.")
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
130
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
131 ;;;###autoload
17645
b85205cfba13 (rmail-ignored-headers): Add References, Mime-Version,
Richard M. Stallman <rms@gnu.org>
parents: 17640
diff changeset
132 (defcustom rmail-ignored-headers "^via:\\|^mail-from:\\|^origin:\\|^references:\\|^status:\\|^received:\\|^x400-originator:\\|^x400-recipients:\\|^x400-received:\\|^x400-mts-identifier:\\|^x400-content-type:\\|^\\(resent-\\|\\)message-id:\\|^summary-line:\\|^resent-date:\\|^nntp-posting-host:\\|^path:\\|^x-char.*:\\|^x-face:\\|^x-mailer:\\|^delivered-to:\\|^lines:\\|^mime-version:\\|^content-transfer-encoding:"
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
133 "*Regexp to match header fields that Rmail should normally hide."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
134 :type 'regexp
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
135 :group 'rmail-headers)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
136
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
137 ;;;###autoload
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
138 (defcustom rmail-displayed-headers nil
11452
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
139 "*Regexp to match Header fields that Rmail should display.
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
140 If nil, display all header fields except those matched by
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
141 `rmail-ignored-headers'."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
142 :type '(choice regexp (const :tag "All"))
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
143 :group 'rmail-headers)
11452
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
144
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
145 ;;;###autoload
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
146 (defcustom rmail-retry-ignored-headers nil "\
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
147 *Headers that should be stripped when retrying a failed message."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
148 :type '(choice regexp (const nil :tag "None"))
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
149 :group 'rmail-headers)
9010
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
150
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
151 ;;;###autoload
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
152 (defcustom rmail-highlighted-headers "^From:\\|^Subject:" "\
8383
d2b1b642f4e6 (rmail-highlighted-face): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 8378
diff changeset
153 *Regexp to match Header fields that Rmail should normally highlight.
8384
4c88569aaa73 (rmail-display-summary): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 8383
diff changeset
154 A value of nil means don't highlight.
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
155 See also `rmail-highlight-face'."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
156 :type 'regexp
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
157 :group 'rmail-headers)
7051
1733b6c1e30b (rmail-show-message): Highlight the specified fields.
Richard M. Stallman <rms@gnu.org>
parents: 7037
diff changeset
158
1733b6c1e30b (rmail-show-message): Highlight the specified fields.
Richard M. Stallman <rms@gnu.org>
parents: 7037
diff changeset
159 ;;;###autoload
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
160 (defcustom rmail-highlight-face nil "\
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
161 *Face used by Rmail for highlighting headers."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
162 :type '(choice (const :tag "Default" nil)
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
163 face)
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
164 :group 'rmail-headers)
8383
d2b1b642f4e6 (rmail-highlighted-face): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 8378
diff changeset
165
d2b1b642f4e6 (rmail-highlighted-face): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 8378
diff changeset
166 ;;;###autoload
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
167 (defcustom rmail-delete-after-output nil "\
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
168 *Non-nil means automatically delete a message that is copied to a file."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
169 :type 'boolean
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
170 :group 'rmail-files)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
171
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
172 ;;;###autoload
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
173 (defcustom rmail-primary-inbox-list nil "\
2423
5dd3b7338f71 (rmail): Don't use mbox as inbox by default.
Richard M. Stallman <rms@gnu.org>
parents: 2076
diff changeset
174 *List of files which are inboxes for user's primary mail file `~/RMAIL'.
5dd3b7338f71 (rmail): Don't use mbox as inbox by default.
Richard M. Stallman <rms@gnu.org>
parents: 2076
diff changeset
175 `nil' means the default, which is (\"/usr/spool/mail/$USER\")
5dd3b7338f71 (rmail): Don't use mbox as inbox by default.
Richard M. Stallman <rms@gnu.org>
parents: 2076
diff changeset
176 \(the name varies depending on the operating system,
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
177 and the value of the environment variable MAIL overrides it)."
17821
c0422adc1b0e (rmail-retry-failure): Rename local to rmail-this-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 17762
diff changeset
178 ;; Don't use backquote here, because we don't want to need it
c0422adc1b0e (rmail-retry-failure): Rename local to rmail-this-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 17762
diff changeset
179 ;; at load time.
c0422adc1b0e (rmail-retry-failure): Rename local to rmail-this-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 17762
diff changeset
180 :type (list 'choice '(const :tag "Default" nil)
17822
aa58af737877 Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 17821
diff changeset
181 (list 'repeat ':value (or (getenv "MAIL")
aa58af737877 Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 17821
diff changeset
182 (concat "/var/spool/mail/"
aa58af737877 Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 17821
diff changeset
183 (getenv "USER")))
17821
c0422adc1b0e (rmail-retry-failure): Rename local to rmail-this-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 17762
diff changeset
184 'file))
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
185 :group 'rmail-retrieve
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
186 :group 'rmail-files)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
187
4108
e4fbcd480455 (rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 4071
diff changeset
188 ;;;###autoload
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
189 (defcustom rmail-mail-new-frame nil
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
190 "*Non-nil means Rmail makes a new frame for composing outgoing mail."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
191 :type 'boolean
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
192 :group 'rmail-reply)
4108
e4fbcd480455 (rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 4071
diff changeset
193
4844
25d94807689e (rmail-retry-setup-hook): New hook variable.
Richard M. Stallman <rms@gnu.org>
parents: 4838
diff changeset
194 ;;;###autoload
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
195 (defcustom rmail-secondary-file-directory "~/"
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
196 "*Directory for additional secondary Rmail files."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
197 :type 'directory
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
198 :group 'rmail-files)
6408
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
199 ;;;###autoload
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
200 (defcustom rmail-secondary-file-regexp "\\.xmail$"
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
201 "*Regexp for which files are secondary Rmail files."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
202 :type 'regexp
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
203 :group 'rmail-files)
6408
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
204
13477
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
205 ;;;###autoload
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
206 (defvar rmail-mode-hook nil
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
207 "List of functions to call when Rmail is invoked.")
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
208
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
209 ;;;###autoload
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
210 (defvar rmail-get-new-mail-hook nil
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
211 "List of functions to call when Rmail has retrieved new mail.")
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
212
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
213 ;;;###autoload
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
214 (defvar rmail-show-message-hook nil
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
215 "List of functions to call when Rmail displays a message.")
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
216
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
217 ;;;###autoload
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
218 (defvar rmail-delete-message-hook nil
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
219 "List of functions to call when Rmail deletes a message.
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
220 When the hooks are called, the message has been marked deleted but is
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
221 still the current message in the Rmail buffer.")
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
222
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
223 ;; These may be altered by site-init.el to match the format of mmdf files
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
224 ;; delimiting used on a given host (delim1 and delim2 from the config
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
225 ;; files).
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
226
18091
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
227 (defvar rmail-mmdf-delim1 "^\001\001\001\001\n"
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
228 "Regexp marking the start of an mmdf message")
18091
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
229 (defvar rmail-mmdf-delim2 "^\001\001\001\001\n"
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
230 "Regexp marking the end of an mmdf message")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
231
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
232 (defvar rmail-message-filter nil
15832
0b6735ce85ac (rmail-reply-regexp, rmail-message-filter): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 15820
diff changeset
233 "If non-nil, a filter function for new messages in RMAIL.
0b6735ce85ac (rmail-reply-regexp, rmail-message-filter): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 15820
diff changeset
234 Called with region narrowed to the message, including headers,
0b6735ce85ac (rmail-reply-regexp, rmail-message-filter): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 15820
diff changeset
235 before obeying `rmail-ignored-headers'.")
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
236
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
237 (defvar rmail-reply-prefix "Re: "
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
238 "String to prepend to Subject line when replying to a message.")
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
239
17065
01cba1834368 (rmail-next-same-subject, rmail-reply): Ignore case, to
Karl Heuer <kwzh@gnu.org>
parents: 17011
diff changeset
240 ;; Some mailers use "Re(2):" or "Re^2:" or "Re: Re:" or "Re[2]:".
10640
937cc7f2a790 (rmail-reply-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 10621
diff changeset
241 ;; This pattern should catch all the common variants.
15833
aa7b0c77a89a (rmail-reply-regexp): Match Re[2].
Richard M. Stallman <rms@gnu.org>
parents: 15832
diff changeset
242 (defvar rmail-reply-regexp "\\`\\(Re\\(([0-9]+)\\|\\[[0-9]+\\]\\|\\^[0-9]+\\)?: *\\)*"
15832
0b6735ce85ac (rmail-reply-regexp, rmail-message-filter): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 15820
diff changeset
243 "Regexp to delete from Subject line before inserting `rmail-reply-prefix'.")
10640
937cc7f2a790 (rmail-reply-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 10621
diff changeset
244
8384
4c88569aaa73 (rmail-display-summary): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 8383
diff changeset
245 (defvar rmail-display-summary nil
15832
0b6735ce85ac (rmail-reply-regexp, rmail-message-filter): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 15820
diff changeset
246 "If non-nil, Rmail always displays the summary buffer.")
8384
4c88569aaa73 (rmail-display-summary): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 8383
diff changeset
247
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
248 (defvar rmail-mode-map nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
249
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
250 (defvar rmail-inbox-list nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
251 (defvar rmail-keywords nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
252
19509
ea4261efd9f9 (rmail-view-buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19315
diff changeset
253 (defvar rmail-buffer nil
ea4261efd9f9 (rmail-view-buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19315
diff changeset
254 "The RMAIL buffer related to the current buffer.
ea4261efd9f9 (rmail-view-buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19315
diff changeset
255 In an RMAIL buffer, this holds the RMAIL buffer itself.
ea4261efd9f9 (rmail-view-buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19315
diff changeset
256 In a summary buffer, this holds the RMAIL buffer it is a summary for.")
ea4261efd9f9 (rmail-view-buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19315
diff changeset
257 (put 'rmail-buffer 'permanent-local t)
ea4261efd9f9 (rmail-view-buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19315
diff changeset
258
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
259 ;; Message counters and markers. Deleted flags.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
260
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
261 (defvar rmail-current-message nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
262 (defvar rmail-total-messages nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
263 (defvar rmail-message-vector nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
264 (defvar rmail-deleted-vector nil)
17620
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
265 (defvar rmail-msgref-vector nil
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
266 "In an Rmail buffer, a vector whose Nth element is a list (N).
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
267 When expunging renumbers messages, these lists are modified
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
268 by substituting the new message number into the existing list.")
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
269
7061
9f27a57b7662 (rmail-show-message): Use overlays, not text properties.
Richard M. Stallman <rms@gnu.org>
parents: 7051
diff changeset
270 (defvar rmail-overlay-list nil)
9f27a57b7662 (rmail-show-message): Use overlays, not text properties.
Richard M. Stallman <rms@gnu.org>
parents: 7051
diff changeset
271
9380
5eb799a4819b (rmail-font-lock-keywords): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 9153
diff changeset
272 (defvar rmail-font-lock-keywords
13302
662aed026c4b Change to citation regexp for rmail-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 12839
diff changeset
273 (eval-when-compile
16452
c51321427e96 Tweak rmail-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 16431
diff changeset
274 (let* ((cite-chars "[>|}]")
c51321427e96 Tweak rmail-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 16431
diff changeset
275 (cite-prefix "A-Za-z")
c51321427e96 Tweak rmail-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 16431
diff changeset
276 (cite-suffix (concat cite-prefix "0-9_.@-`'\"")))
c51321427e96 Tweak rmail-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 16431
diff changeset
277 (list '("^\\(From\\|Sender\\):" . font-lock-function-name-face)
c51321427e96 Tweak rmail-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 16431
diff changeset
278 '("^Reply-To:.*$" . font-lock-function-name-face)
c51321427e96 Tweak rmail-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 16431
diff changeset
279 '("^Subject:" . font-lock-comment-face)
17164
024399a1b442 Tweak font-lock-keywords
Simon Marshall <simon@gnu.org>
parents: 17093
diff changeset
280 '("^\\(To\\|Apparently-To\\|Cc\\|Newsgroups\\):"
024399a1b442 Tweak font-lock-keywords
Simon Marshall <simon@gnu.org>
parents: 17093
diff changeset
281 . font-lock-keyword-face)
16452
c51321427e96 Tweak rmail-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 16431
diff changeset
282 ;; Use MATCH-ANCHORED to effectively anchor the regexp left side.
c51321427e96 Tweak rmail-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 16431
diff changeset
283 `(,cite-chars
c51321427e96 Tweak rmail-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 16431
diff changeset
284 (,(concat "\\=[ \t]*"
17164
024399a1b442 Tweak font-lock-keywords
Simon Marshall <simon@gnu.org>
parents: 17093
diff changeset
285 "\\(\\([" cite-prefix "]+[" cite-suffix "]*\\)?"
024399a1b442 Tweak font-lock-keywords
Simon Marshall <simon@gnu.org>
parents: 17093
diff changeset
286 "\\(" cite-chars "[ \t]*\\)\\)+"
024399a1b442 Tweak font-lock-keywords
Simon Marshall <simon@gnu.org>
parents: 17093
diff changeset
287 "\\(.*\\)")
16452
c51321427e96 Tweak rmail-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 16431
diff changeset
288 (beginning-of-line) (end-of-line)
17164
024399a1b442 Tweak font-lock-keywords
Simon Marshall <simon@gnu.org>
parents: 17093
diff changeset
289 (2 font-lock-reference-face nil t)
024399a1b442 Tweak font-lock-keywords
Simon Marshall <simon@gnu.org>
parents: 17093
diff changeset
290 (4 font-lock-comment-face nil t)))
16452
c51321427e96 Tweak rmail-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 16431
diff changeset
291 '("^\\(X-[A-Za-z0-9-]+\\|In-reply-to\\|Date\\):.*$"
c51321427e96 Tweak rmail-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 16431
diff changeset
292 . font-lock-string-face))))
9380
5eb799a4819b (rmail-font-lock-keywords): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 9153
diff changeset
293 "Additional expressions to highlight in Rmail mode.")
5eb799a4819b (rmail-font-lock-keywords): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 9153
diff changeset
294
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
295 ;; These are used by autoloaded rmail-summary.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
296
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
297 (defvar rmail-summary-buffer nil)
19509
ea4261efd9f9 (rmail-view-buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19315
diff changeset
298 (put 'rmail-summary-buffer 'permanent-local t)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
299 (defvar rmail-summary-vector nil)
19509
ea4261efd9f9 (rmail-view-buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19315
diff changeset
300 (put 'rmail-summary-vector 'permanent-local t)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
301
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
302 ;; `Sticky' default variables.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
303
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
304 ;; Last individual label specified to a or k.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
305 (defvar rmail-last-label nil)
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
306 ;; Last set of values specified to C-M-n, C-M-p, C-M-s or C-M-l.
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
307 (defvar rmail-last-multi-labels nil)
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
308 (defvar rmail-last-regexp nil)
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
309 (defcustom rmail-default-file "~/xmail"
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
310 "*Default file name for \\[rmail-output]."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
311 :type 'file
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
312 :group 'rmail-files)
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
313 (defcustom rmail-default-rmail-file "~/XMAIL"
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
314 "*Default file name for \\[rmail-output-to-rmail-file]."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
315 :type 'file
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
316 :group 'rmail-files)
617
cde1f15848c6 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 584
diff changeset
317
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 617
diff changeset
318 ;;; Regexp matching the delimiter of messages in UNIX mail format
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 617
diff changeset
319 ;;; (UNIX From lines), minus the initial ^. Note that if you change
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 617
diff changeset
320 ;;; this expression, you must change the code in rmail-nuke-pinhead-header
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 617
diff changeset
321 ;;; that knows the exact ordering of the \\( \\) subexpressions.
617
cde1f15848c6 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 584
diff changeset
322 (defvar rmail-unix-mail-delimiter
1112
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
323 (let ((time-zone-regexp
12727
7bf59a3ff303 (rmail-unix-mail-delimiter): Allow two-letter timezone name.
Richard M. Stallman <rms@gnu.org>
parents: 12650
diff changeset
324 (concat "\\([A-Z]?[A-Z]?[A-Z][A-Z]\\( DST\\)?"
1112
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
325 "\\|[-+]?[0-9][0-9][0-9][0-9]"
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
326 "\\|"
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
327 "\\) *")))
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
328 (concat
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
329 "From "
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
330
15534
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
331 ;; Many things can happen to an RFC 822 mailbox before it is put into
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
332 ;; a `From' line. The leading phrase can be stripped, e.g.
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
333 ;; `Joe <@w.x:joe@y.z>' -> `<@w.x:joe@y.z>'. The <> can be stripped, e.g.
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
334 ;; `<@x.y:joe@y.z>' -> `@x.y:joe@y.z'. Everything starting with a CRLF
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
335 ;; can be removed, e.g.
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
336 ;; From: joe@y.z (Joe K
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
337 ;; User)
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
338 ;; can yield `From joe@y.z (Joe K Fri Mar 22 08:11:15 1996', and
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
339 ;; From: Joe User
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
340 ;; <joe@y.z>
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
341 ;; can yield `From Joe User Fri Mar 22 08:11:15 1996'.
15820
12c537361366 (rmail-unix-mail-delimiter): Allow space or tab as
Paul Eggert <eggert@twinsun.com>
parents: 15746
diff changeset
342 ;; The mailbox can be removed or be replaced by white space, e.g.
12c537361366 (rmail-unix-mail-delimiter): Allow space or tab as
Paul Eggert <eggert@twinsun.com>
parents: 15746
diff changeset
343 ;; From: "Joe User"{space}{tab}
12c537361366 (rmail-unix-mail-delimiter): Allow space or tab as
Paul Eggert <eggert@twinsun.com>
parents: 15746
diff changeset
344 ;; <joe@y.z>
12c537361366 (rmail-unix-mail-delimiter): Allow space or tab as
Paul Eggert <eggert@twinsun.com>
parents: 15746
diff changeset
345 ;; can yield `From {space}{tab} Fri Mar 22 08:11:15 1996',
12c537361366 (rmail-unix-mail-delimiter): Allow space or tab as
Paul Eggert <eggert@twinsun.com>
parents: 15746
diff changeset
346 ;; where {space} and {tab} represent the Ascii space and tab characters.
15534
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
347 ;; We want to match the results of any of these manglings.
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
348 ;; The following regexp rejects names whose first characters are
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
349 ;; obviously bogus, but after that anything goes.
15820
12c537361366 (rmail-unix-mail-delimiter): Allow space or tab as
Paul Eggert <eggert@twinsun.com>
parents: 15746
diff changeset
350 "\\([^\0-\b\n-\r\^?].*\\)? "
1112
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
351
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
352 ;; The time the message was sent.
15534
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
353 "\\([^\0-\r \^?]+\\) +" ; day of the week
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
354 "\\([^\0-\r \^?]+\\) +" ; month
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
355 "\\([0-3]?[0-9]\\) +" ; day of month
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
356 "\\([0-2][0-9]:[0-5][0-9]\\(:[0-6][0-9]\\)?\\) *" ; time of day
1112
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
357
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
358 ;; Perhaps a time zone, specified by an abbreviation, or by a
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
359 ;; numeric offset.
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
360 time-zone-regexp
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
361
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
362 ;; The year.
15534
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
363 " \\([0-9][0-9]+\\) *"
1112
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
364
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
365 ;; On some systems the time zone can appear after the year, too.
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
366 time-zone-regexp
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
367
7037
c205795eecc6 Cosmetic changes.
Karl Heuer <kwzh@gnu.org>
parents: 6727
diff changeset
368 ;; Old uucp cruft.
c205795eecc6 Cosmetic changes.
Karl Heuer <kwzh@gnu.org>
parents: 6727
diff changeset
369 "\\(remote from .*\\)?"
1112
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
370
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
371 "\n"))
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
372 nil)
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
373
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
374 ;; Perform BODY in the summary buffer
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
375 ;; in such a way that its cursor is properly updated in its own window.
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
376 (defmacro rmail-select-summary (&rest body)
8447
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
377 (` (let ((total rmail-total-messages))
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
378 (if (rmail-summary-displayed)
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
379 (let ((window (selected-window)))
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
380 (save-excursion
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
381 (unwind-protect
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
382 (progn
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
383 (pop-to-buffer rmail-summary-buffer)
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
384 ;; rmail-total-messages is a buffer-local var
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
385 ;; in the rmail buffer.
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
386 ;; This way we make it available for the body
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
387 ;; even tho the rmail buffer is not current.
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
388 (let ((rmail-total-messages total))
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
389 (,@ body)))
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
390 (select-window window))))
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
391 (save-excursion
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
392 (set-buffer rmail-summary-buffer)
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
393 (let ((rmail-total-messages total))
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
394 (,@ body))))
0e699538d256 (rmail-select-summary): Preserve rmail buffer's value of
Richard M. Stallman <rms@gnu.org>
parents: 8423
diff changeset
395 (rmail-maybe-display-summary))))
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
396
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
397 (defvar rmail-view-buffer nil
19509
ea4261efd9f9 (rmail-view-buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19315
diff changeset
398 "Buffer which holds RMAIL message for MIME displaying.")
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
399
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
400 ;; Mule and MIME related variables.
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
401
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
402 ;;;###autoload
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
403 (defvar rmail-file-coding-system nil
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
404 "Coding system used in RMAIL file.
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
405
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
406 This is set to nil by default.")
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
407
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
408 ;;;###autoload
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
409 (defcustom rmail-enable-mime nil
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
410 "*If non-nil, RMAIL uses MIME feature.
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
411 If the value is t, RMAIL automatically shows MIME decoded message.
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
412 If the value is neither t nor nil, RMAIL does not show MIME decoded message
18957
d857f7e1113d (rmail-mime-feature): Doc and custom fix.
Richard M. Stallman <rms@gnu.org>
parents: 18442
diff changeset
413 until a user explicitly requires it."
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
414 :type '(choice (const :tag "on" t)
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
415 (const :tag "off" nil)
18957
d857f7e1113d (rmail-mime-feature): Doc and custom fix.
Richard M. Stallman <rms@gnu.org>
parents: 18442
diff changeset
416 (sexp :tag "when asked" :format "%t\n" ask))
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
417 :group 'rmail)
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
418
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
419 ;;;###autoload
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
420 (defvar rmail-show-mime-function nil
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
421 "Function to show MIME decoded message of RMAIL file.")
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
422
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
423 ;;;###autoload
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
424 (defvar rmail-mime-feature 'rmail-mime
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
425 "Feature to provide for using MIME feature in RMAIL.
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
426 When starting rmail, this feature is requrired if rmail-enable-mime
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
427 is non-nil.")
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
428
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
429
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
430 ;;;; *** Rmail Mode ***
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
431
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
432 ;;;###autoload
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
433 (defun rmail (&optional file-name-arg)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
434 "Read and edit incoming mail.
4838
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
435 Moves messages into file named by `rmail-file-name' (a babyl format file)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
436 and edits that file in RMAIL Mode.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
437 Type \\[describe-mode] once editing that file, for a list of RMAIL commands.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
438
5274
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
439 May be called with file name as argument; then performs rmail editing on
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
440 that file, but does not copy any new mail into the file.
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
441 Interactively, if you supply a prefix argument, then you
8384
4c88569aaa73 (rmail-display-summary): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 8383
diff changeset
442 have a chance to specify a file name with the minibuffer.
4c88569aaa73 (rmail-display-summary): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 8383
diff changeset
443
4c88569aaa73 (rmail-display-summary): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 8383
diff changeset
444 If `rmail-display-summary' is non-nil, make a summary for this RMAIL file."
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
445 (interactive (if current-prefix-arg
13818
0d1de22afac0 (rmail): Allow nonexistent file as arg.
Richard M. Stallman <rms@gnu.org>
parents: 13808
diff changeset
446 (list (read-file-name "Run rmail on RMAIL file: "))))
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
447 (if rmail-enable-mime
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
448 (condition-case err
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
449 (require rmail-mime-feature)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
450 (error (message "Feature `%s' not provided" rmail-mime-feature)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
451 (sit-for 1)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
452 (setq rmail-enable-mime nil))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
453 (let* ((file-name (expand-file-name (or file-name-arg rmail-file-name)))
16431
65d3768ccb05 (rmail): Run rmail-mail-hook last.
Richard M. Stallman <rms@gnu.org>
parents: 16349
diff changeset
454 (existed (get-file-buffer file-name))
20053
c315820510ba (rmail): Avoid showing message twice.
Karl Heuer <kwzh@gnu.org>
parents: 19674
diff changeset
455 run-mail-hook msg-shown)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
456 ;; Like find-file, but in the case where a buffer existed
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
457 ;; and the file was reverted, recompute the message-data.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
458 (if (and existed (not (verify-visited-file-modtime existed)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
459 (progn
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
460 ;; Don't be confused by apparent local-variables spec
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
461 ;; in the last message in the RMAIL file.
20784
80f0f0390eb6 (rmail): Reinsert the let-binding of enable-local-variables.
Richard M. Stallman <rms@gnu.org>
parents: 20757
diff changeset
462 (let ((enable-local-variables nil))
80f0f0390eb6 (rmail): Reinsert the let-binding of enable-local-variables.
Richard M. Stallman <rms@gnu.org>
parents: 20757
diff changeset
463 (find-file file-name))
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
464 (if (and (verify-visited-file-modtime existed)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
465 (eq major-mode 'rmail-mode))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
466 (progn (rmail-forget-messages)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
467 (rmail-set-message-counters))))
20784
80f0f0390eb6 (rmail): Reinsert the let-binding of enable-local-variables.
Richard M. Stallman <rms@gnu.org>
parents: 20757
diff changeset
468 (let ((enable-local-variables nil))
80f0f0390eb6 (rmail): Reinsert the let-binding of enable-local-variables.
Richard M. Stallman <rms@gnu.org>
parents: 20757
diff changeset
469 (find-file file-name)))
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
470 (if (eq major-mode 'rmail-edit-mode)
20681
4a46ac370fc8 (rmail): Don't bind enable-multibyte-characters;
Richard M. Stallman <rms@gnu.org>
parents: 20662
diff changeset
471 (error "Exit Rmail Edit mode before getting new mail"))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
472 (if (and existed (> (buffer-size) 0))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
473 ;; Buffer not new and not empty; ensure in proper mode, but that's all.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
474 (or (eq major-mode 'rmail-mode)
16431
65d3768ccb05 (rmail): Run rmail-mail-hook last.
Richard M. Stallman <rms@gnu.org>
parents: 16349
diff changeset
475 (progn (rmail-mode-2)
65d3768ccb05 (rmail): Run rmail-mail-hook last.
Richard M. Stallman <rms@gnu.org>
parents: 16349
diff changeset
476 (setq run-mail-hook t)))
65d3768ccb05 (rmail): Run rmail-mail-hook last.
Richard M. Stallman <rms@gnu.org>
parents: 16349
diff changeset
477 (setq run-mail-hook t)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
478 (rmail-mode-2)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
479 ;; Convert all or part to Babyl file if possible.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
480 (rmail-convert-file)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
481 (goto-char (point-max))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
482 (if (null rmail-inbox-list)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
483 (progn
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
484 (rmail-set-message-counters)
20053
c315820510ba (rmail): Avoid showing message twice.
Karl Heuer <kwzh@gnu.org>
parents: 19674
diff changeset
485 (rmail-show-message)
c315820510ba (rmail): Avoid showing message twice.
Karl Heuer <kwzh@gnu.org>
parents: 19674
diff changeset
486 (setq msg-shown t))))
20662
910d4cdbf81f (rmail): Unwind-protect call to rmail-get-new-mail.
Karl Heuer <kwzh@gnu.org>
parents: 20399
diff changeset
487 (unwind-protect
910d4cdbf81f (rmail): Unwind-protect call to rmail-get-new-mail.
Karl Heuer <kwzh@gnu.org>
parents: 20399
diff changeset
488 (or (and (null file-name-arg)
910d4cdbf81f (rmail): Unwind-protect call to rmail-get-new-mail.
Karl Heuer <kwzh@gnu.org>
parents: 20399
diff changeset
489 (rmail-get-new-mail))
910d4cdbf81f (rmail): Unwind-protect call to rmail-get-new-mail.
Karl Heuer <kwzh@gnu.org>
parents: 20399
diff changeset
490 (or msg-shown (rmail-show-message (rmail-first-unseen-message))))
910d4cdbf81f (rmail): Unwind-protect call to rmail-get-new-mail.
Karl Heuer <kwzh@gnu.org>
parents: 20399
diff changeset
491 (progn
910d4cdbf81f (rmail): Unwind-protect call to rmail-get-new-mail.
Karl Heuer <kwzh@gnu.org>
parents: 20399
diff changeset
492 (if rmail-display-summary (rmail-summary))
910d4cdbf81f (rmail): Unwind-protect call to rmail-get-new-mail.
Karl Heuer <kwzh@gnu.org>
parents: 20399
diff changeset
493 (rmail-construct-io-menu)
910d4cdbf81f (rmail): Unwind-protect call to rmail-get-new-mail.
Karl Heuer <kwzh@gnu.org>
parents: 20399
diff changeset
494 (if run-mail-hook
910d4cdbf81f (rmail): Unwind-protect call to rmail-get-new-mail.
Karl Heuer <kwzh@gnu.org>
parents: 20399
diff changeset
495 (run-hooks 'rmail-mode-hook))))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
496
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
497 ;; Given the value of MAILPATH, return a list of inbox file names.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
498 ;; This is turned off because it is not clear that the user wants
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
499 ;; all these inboxes to feed into the primary rmail file.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
500 ; (defun rmail-convert-mailpath (string)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
501 ; (let (idx list)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
502 ; (while (setq idx (string-match "[%:]" string))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
503 ; (let ((this (substring string 0 idx)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
504 ; (setq string (substring string (1+ idx)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
505 ; (setq list (cons (if (string-match "%" this)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
506 ; (substring this 0 (string-match "%" this))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
507 ; this)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
508 ; list))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
509 ; list))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
510
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
511 ; I have checked that adding "-*- rmail -*-" to the BABYL OPTIONS line
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
512 ; will not cause emacs 18.55 problems.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
513
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
514 (defun rmail-convert-file ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
515 (let (convert)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
516 (widen)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
517 (goto-char (point-min))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
518 ;; If file doesn't start like a Babyl file,
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
519 ;; convert it to one, by adding a header and converting each message.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
520 (cond ((looking-at "BABYL OPTIONS:"))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
521 ((looking-at "Version: 5\n")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
522 ;; Losing babyl file made by old version of Rmail.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
523 ;; Just fix the babyl file header; don't make a new one,
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
524 ;; so we don't lose the Labels: file attribute, etc.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
525 (let ((buffer-read-only nil))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
526 (insert "BABYL OPTIONS: -*- rmail -*-\n")))
4764
0e239209a6db (rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents: 4724
diff changeset
527 ((equal (point-min) (point-max))
0e239209a6db (rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents: 4724
diff changeset
528 ;; Empty RMAIL file. Just insert the header.
0e239209a6db (rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents: 4724
diff changeset
529 (rmail-insert-rmail-file-header))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
530 (t
4764
0e239209a6db (rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents: 4724
diff changeset
531 ;; Non-empty file in non-RMAIL format. Add header and convert.
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
532 (setq convert t)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
533 (rmail-insert-rmail-file-header)))
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
534 (if (and (not convert)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
535 (not rmail-enable-mime)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
536 rmail-file-coding-system)
17762
dfefaeb20c75 (rmail-enable-decoding-message): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17645
diff changeset
537 ;; Decode coding system of BABYL part at the head only. The
dfefaeb20c75 (rmail-enable-decoding-message): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17645
diff changeset
538 ;; remaining non BABYL parts are decoded in
dfefaeb20c75 (rmail-enable-decoding-message): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17645
diff changeset
539 ;; rmail-convert-to-babyl-format if necessary.
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
540 (rmail-decode-babyl-format))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
541 ;; If file was not a Babyl file or if there are
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
542 ;; Unix format messages added at the end,
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
543 ;; convert file as necessary.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
544 (if (or convert
4673
047e8f8469d9 (rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents: 4579
diff changeset
545 (save-excursion
047e8f8469d9 (rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents: 4579
diff changeset
546 (goto-char (point-max))
12839
40a12a81cc06 (rmail-convert-file): Look back for ^_ only at bol.
Richard M. Stallman <rms@gnu.org>
parents: 12727
diff changeset
547 (search-backward "\n\^_")
40a12a81cc06 (rmail-convert-file): Look back for ^_ only at bol.
Richard M. Stallman <rms@gnu.org>
parents: 12727
diff changeset
548 (forward-char 2)
4673
047e8f8469d9 (rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents: 4579
diff changeset
549 (looking-at "\n*From ")))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
550 (let ((buffer-read-only nil))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
551 (message "Converting to Babyl format...")
4673
047e8f8469d9 (rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents: 4579
diff changeset
552 ;; If file needs conversion, convert it all,
047e8f8469d9 (rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents: 4579
diff changeset
553 ;; except for the BABYL header.
047e8f8469d9 (rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents: 4579
diff changeset
554 ;; (rmail-convert-to-babyl-format would delete the header.)
047e8f8469d9 (rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents: 4579
diff changeset
555 (goto-char (point-min))
047e8f8469d9 (rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents: 4579
diff changeset
556 (search-forward "\n\^_" nil t)
4698
196fac1c1086 (rmail-convert-file): Narrow to exclude the Babyl header.
Richard M. Stallman <rms@gnu.org>
parents: 4673
diff changeset
557 (narrow-to-region (point) (point-max))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
558 (rmail-convert-to-babyl-format)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
559 (message "Converting to Babyl format...done")))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
560
4764
0e239209a6db (rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents: 4724
diff changeset
561 ;;; I have checked that adding "-*- rmail -*-" to the BABYL OPTIONS line
0e239209a6db (rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents: 4724
diff changeset
562 ;;; will not cause emacs 18.55 problems.
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
563
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
564 (defun rmail-insert-rmail-file-header ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
565 (let ((buffer-read-only nil))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
566 (insert "BABYL OPTIONS: -*- rmail -*-
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
567 Version: 5
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
568 Labels:
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
569 Note: This is the header of an rmail file.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
570 Note: If you are seeing it in rmail,
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
571 Note: it means the file has no messages in it.\n\^_")))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
572
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
573 ;; Decode Babyl formated part at the head of current buffer by
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
574 ;; rmail-file-coding-system.
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
575
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
576 (defun rmail-decode-babyl-format ()
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
577 (let ((modifiedp (buffer-modified-p))
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
578 (buffer-read-only nil)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
579 pos)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
580 (goto-char (point-min))
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
581 (search-forward "\n\^_" nil t) ; Skip BYBYL header.
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
582 (setq pos (point))
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
583 (message "Decoding messages...")
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
584 (while (search-forward "\n\^_" nil t)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
585 (decode-coding-region pos (point) rmail-file-coding-system)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
586 (setq pos (point)))
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
587 (message "Decoding messages...done")
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
588 (set-buffer-file-coding-system rmail-file-coding-system)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
589 (set-buffer-modified-p modifiedp)))
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
590
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
591 (if rmail-mode-map
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
592 nil
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
593 (setq rmail-mode-map (make-keymap))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
594 (suppress-keymap rmail-mode-map)
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
595 (define-key rmail-mode-map "a" 'rmail-add-label)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
596 (define-key rmail-mode-map "b" 'rmail-bury)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
597 (define-key rmail-mode-map "c" 'rmail-continue)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
598 (define-key rmail-mode-map "d" 'rmail-delete-forward)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
599 (define-key rmail-mode-map "\C-d" 'rmail-delete-backward)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
600 (define-key rmail-mode-map "e" 'rmail-edit-current-message)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
601 (define-key rmail-mode-map "f" 'rmail-forward)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
602 (define-key rmail-mode-map "g" 'rmail-get-new-mail)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
603 (define-key rmail-mode-map "h" 'rmail-summary)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
604 (define-key rmail-mode-map "i" 'rmail-input)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
605 (define-key rmail-mode-map "j" 'rmail-show-message)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
606 (define-key rmail-mode-map "k" 'rmail-kill-label)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
607 (define-key rmail-mode-map "l" 'rmail-summary-by-labels)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
608 (define-key rmail-mode-map "\e\C-h" 'rmail-summary)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
609 (define-key rmail-mode-map "\e\C-l" 'rmail-summary-by-labels)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
610 (define-key rmail-mode-map "\e\C-r" 'rmail-summary-by-recipients)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
611 (define-key rmail-mode-map "\e\C-s" 'rmail-summary-by-regexp)
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
612 (define-key rmail-mode-map "\e\C-t" 'rmail-summary-by-topic)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
613 (define-key rmail-mode-map "m" 'rmail-mail)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
614 (define-key rmail-mode-map "\em" 'rmail-retry-failure)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
615 (define-key rmail-mode-map "n" 'rmail-next-undeleted-message)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
616 (define-key rmail-mode-map "\en" 'rmail-next-message)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
617 (define-key rmail-mode-map "\e\C-n" 'rmail-next-labeled-message)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
618 (define-key rmail-mode-map "o" 'rmail-output-to-rmail-file)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
619 (define-key rmail-mode-map "\C-o" 'rmail-output)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
620 (define-key rmail-mode-map "p" 'rmail-previous-undeleted-message)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
621 (define-key rmail-mode-map "\ep" 'rmail-previous-message)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
622 (define-key rmail-mode-map "\e\C-p" 'rmail-previous-labeled-message)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
623 (define-key rmail-mode-map "q" 'rmail-quit)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
624 (define-key rmail-mode-map "r" 'rmail-reply)
1464
7f25b15a6809 (rmail-mode-map): Delete binding of M-r (use global one).
Richard M. Stallman <rms@gnu.org>
parents: 1382
diff changeset
625 ;; I find I can't live without the default M-r command -- rms.
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
626 ;; (define-key rmail-mode-map "\er" 'rmail-search-backwards)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
627 (define-key rmail-mode-map "s" 'rmail-expunge-and-save)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
628 (define-key rmail-mode-map "\es" 'rmail-search)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
629 (define-key rmail-mode-map "t" 'rmail-toggle-header)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
630 (define-key rmail-mode-map "u" 'rmail-undelete-previous-message)
17306
09aeacdc6fc2 (rmail-mode-map): Add menu item for
Richard M. Stallman <rms@gnu.org>
parents: 17237
diff changeset
631 (define-key rmail-mode-map "w" 'rmail-output-body-to-file)
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
632 (define-key rmail-mode-map "x" 'rmail-expunge)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
633 (define-key rmail-mode-map "." 'rmail-beginning-of-message)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
634 (define-key rmail-mode-map "<" 'rmail-first-message)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
635 (define-key rmail-mode-map ">" 'rmail-last-message)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
636 (define-key rmail-mode-map " " 'scroll-up)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
637 (define-key rmail-mode-map "\177" 'scroll-down)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
638 (define-key rmail-mode-map "?" 'describe-mode)
3877
da9b565f9878 Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3864
diff changeset
639 (define-key rmail-mode-map "\C-c\C-s\C-d" 'rmail-sort-by-date)
da9b565f9878 Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3864
diff changeset
640 (define-key rmail-mode-map "\C-c\C-s\C-s" 'rmail-sort-by-subject)
da9b565f9878 Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3864
diff changeset
641 (define-key rmail-mode-map "\C-c\C-s\C-a" 'rmail-sort-by-author)
da9b565f9878 Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3864
diff changeset
642 (define-key rmail-mode-map "\C-c\C-s\C-r" 'rmail-sort-by-recipient)
da9b565f9878 Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3864
diff changeset
643 (define-key rmail-mode-map "\C-c\C-s\C-c" 'rmail-sort-by-correspondent)
da9b565f9878 Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents: 3864
diff changeset
644 (define-key rmail-mode-map "\C-c\C-s\C-l" 'rmail-sort-by-lines)
6719
19e24f897722 (rmail-mode-map): Key binding for rmail-sort-by-keywords.
Karl Heuer <kwzh@gnu.org>
parents: 6484
diff changeset
645 (define-key rmail-mode-map "\C-c\C-s\C-k" 'rmail-sort-by-keywords)
10662
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
646 (define-key rmail-mode-map "\C-c\C-n" 'rmail-next-same-subject)
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
647 (define-key rmail-mode-map "\C-c\C-p" 'rmail-previous-same-subject)
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
648 )
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
649
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
650 (define-key rmail-mode-map [menu-bar] (make-sparse-keymap))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
651
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
652 (define-key rmail-mode-map [menu-bar classify]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
653 (cons "Classify" (make-sparse-keymap "Classify")))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
654
6483
373e377d79f7 (rmail-secondary-file-menu): Display relative file names.
Richard M. Stallman <rms@gnu.org>
parents: 6408
diff changeset
655 (define-key rmail-mode-map [menu-bar classify input-menu]
8909
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
656 nil)
6483
373e377d79f7 (rmail-secondary-file-menu): Display relative file names.
Richard M. Stallman <rms@gnu.org>
parents: 6408
diff changeset
657
373e377d79f7 (rmail-secondary-file-menu): Display relative file names.
Richard M. Stallman <rms@gnu.org>
parents: 6408
diff changeset
658 (define-key rmail-mode-map [menu-bar classify output-menu]
8909
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
659 nil)
6483
373e377d79f7 (rmail-secondary-file-menu): Display relative file names.
Richard M. Stallman <rms@gnu.org>
parents: 6408
diff changeset
660
17306
09aeacdc6fc2 (rmail-mode-map): Add menu item for
Richard M. Stallman <rms@gnu.org>
parents: 17237
diff changeset
661 (define-key rmail-mode-map [menu-bar classify output-body]
09aeacdc6fc2 (rmail-mode-map): Add menu item for
Richard M. Stallman <rms@gnu.org>
parents: 17237
diff changeset
662 '("Output body to file..." . rmail-output-body-to-file))
09aeacdc6fc2 (rmail-mode-map): Add menu item for
Richard M. Stallman <rms@gnu.org>
parents: 17237
diff changeset
663
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
664 (define-key rmail-mode-map [menu-bar classify output-inbox]
8423
960d9fb24788 (rmail-mode-map): Fix the Get New Mail entry.
Richard M. Stallman <rms@gnu.org>
parents: 8420
diff changeset
665 '("Output (inbox)..." . rmail-output))
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
666
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
667 (define-key rmail-mode-map [menu-bar classify output]
8423
960d9fb24788 (rmail-mode-map): Fix the Get New Mail entry.
Richard M. Stallman <rms@gnu.org>
parents: 8420
diff changeset
668 '("Output (Rmail)..." . rmail-output-to-rmail-file))
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
669
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
670 (define-key rmail-mode-map [menu-bar classify kill-label]
8423
960d9fb24788 (rmail-mode-map): Fix the Get New Mail entry.
Richard M. Stallman <rms@gnu.org>
parents: 8420
diff changeset
671 '("Kill Label..." . rmail-kill-label))
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
672
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
673 (define-key rmail-mode-map [menu-bar classify add-label]
8423
960d9fb24788 (rmail-mode-map): Fix the Get New Mail entry.
Richard M. Stallman <rms@gnu.org>
parents: 8420
diff changeset
674 '("Add Label..." . rmail-add-label))
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
675
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
676 (define-key rmail-mode-map [menu-bar summary]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
677 (cons "Summary" (make-sparse-keymap "Summary")))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
678
12447
240de864f06c (rmail-find-all-files): Bind case-fold-search.
Richard M. Stallman <rms@gnu.org>
parents: 12377
diff changeset
679 (define-key rmail-mode-map [menu-bar summary senders]
240de864f06c (rmail-find-all-files): Bind case-fold-search.
Richard M. Stallman <rms@gnu.org>
parents: 12377
diff changeset
680 '("By Senders..." . rmail-summary-by-senders))
240de864f06c (rmail-find-all-files): Bind case-fold-search.
Richard M. Stallman <rms@gnu.org>
parents: 12377
diff changeset
681
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
682 (define-key rmail-mode-map [menu-bar summary labels]
8423
960d9fb24788 (rmail-mode-map): Fix the Get New Mail entry.
Richard M. Stallman <rms@gnu.org>
parents: 8420
diff changeset
683 '("By Labels..." . rmail-summary-by-labels))
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
684
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
685 (define-key rmail-mode-map [menu-bar summary recipients]
8423
960d9fb24788 (rmail-mode-map): Fix the Get New Mail entry.
Richard M. Stallman <rms@gnu.org>
parents: 8420
diff changeset
686 '("By Recipients..." . rmail-summary-by-recipients))
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
687
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
688 (define-key rmail-mode-map [menu-bar summary topic]
8423
960d9fb24788 (rmail-mode-map): Fix the Get New Mail entry.
Richard M. Stallman <rms@gnu.org>
parents: 8420
diff changeset
689 '("By Topic..." . rmail-summary-by-topic))
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
690
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
691 (define-key rmail-mode-map [menu-bar summary regexp]
8423
960d9fb24788 (rmail-mode-map): Fix the Get New Mail entry.
Richard M. Stallman <rms@gnu.org>
parents: 8420
diff changeset
692 '("By Regexp..." . rmail-summary-by-regexp))
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
693
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
694 (define-key rmail-mode-map [menu-bar summary all]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
695 '("All" . rmail-summary))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
696
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
697 (define-key rmail-mode-map [menu-bar mail]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
698 (cons "Mail" (make-sparse-keymap "Mail")))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
699
8420
988800dcb009 (rmail-mode-map): Fix the Get New Mail entry.
Richard M. Stallman <rms@gnu.org>
parents: 8399
diff changeset
700 (define-key rmail-mode-map [menu-bar mail rmail-get-new-mail]
8219
5d9da948dc9f (rmail-mode-map): Add "Get New Mail" menu item under Mail.
Richard M. Stallman <rms@gnu.org>
parents: 8094
diff changeset
701 '("Get New Mail" . rmail-get-new-mail))
5d9da948dc9f (rmail-mode-map): Add "Get New Mail" menu item under Mail.
Richard M. Stallman <rms@gnu.org>
parents: 8094
diff changeset
702
5d9da948dc9f (rmail-mode-map): Add "Get New Mail" menu item under Mail.
Richard M. Stallman <rms@gnu.org>
parents: 8094
diff changeset
703 (define-key rmail-mode-map [menu-bar mail lambda]
8230
740b46022e15 (rmail-mode-map): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 8219
diff changeset
704 '("----"))
8219
5d9da948dc9f (rmail-mode-map): Add "Get New Mail" menu item under Mail.
Richard M. Stallman <rms@gnu.org>
parents: 8094
diff changeset
705
5d9da948dc9f (rmail-mode-map): Add "Get New Mail" menu item under Mail.
Richard M. Stallman <rms@gnu.org>
parents: 8094
diff changeset
706 (define-key rmail-mode-map [menu-bar mail continue]
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
707 '("Continue" . rmail-continue))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
708
8393
4d3ae3aff631 (rmail-mode-map): Move new Re-send menu item to right place.
Richard M. Stallman <rms@gnu.org>
parents: 8384
diff changeset
709 (define-key rmail-mode-map [menu-bar mail resend]
8423
960d9fb24788 (rmail-mode-map): Fix the Get New Mail entry.
Richard M. Stallman <rms@gnu.org>
parents: 8420
diff changeset
710 '("Re-send..." . rmail-resend))
8393
4d3ae3aff631 (rmail-mode-map): Move new Re-send menu item to right place.
Richard M. Stallman <rms@gnu.org>
parents: 8384
diff changeset
711
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
712 (define-key rmail-mode-map [menu-bar mail forward]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
713 '("Forward" . rmail-forward))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
714
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
715 (define-key rmail-mode-map [menu-bar mail retry]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
716 '("Retry" . rmail-retry-failure))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
717
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
718 (define-key rmail-mode-map [menu-bar mail reply]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
719 '("Reply" . rmail-reply))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
720
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
721 (define-key rmail-mode-map [menu-bar mail mail]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
722 '("Mail" . rmail-mail))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
723
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
724 (define-key rmail-mode-map [menu-bar delete]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
725 (cons "Delete" (make-sparse-keymap "Delete")))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
726
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
727 (define-key rmail-mode-map [menu-bar delete expunge/save]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
728 '("Expunge/Save" . rmail-expunge-and-save))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
729
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
730 (define-key rmail-mode-map [menu-bar delete expunge]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
731 '("Expunge" . rmail-expunge))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
732
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
733 (define-key rmail-mode-map [menu-bar delete undelete]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
734 '("Undelete" . rmail-undelete-previous-message))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
735
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
736 (define-key rmail-mode-map [menu-bar delete delete]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
737 '("Delete" . rmail-delete-forward))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
738
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
739 (define-key rmail-mode-map [menu-bar move]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
740 (cons "Move" (make-sparse-keymap "Move")))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
741
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
742 (define-key rmail-mode-map [menu-bar move search-back]
10187
a3b8bfad0a75 (rmail-search-backward): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 10160
diff changeset
743 '("Search Back..." . rmail-search-backwards))
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
744
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
745 (define-key rmail-mode-map [menu-bar move search]
8423
960d9fb24788 (rmail-mode-map): Fix the Get New Mail entry.
Richard M. Stallman <rms@gnu.org>
parents: 8420
diff changeset
746 '("Search..." . rmail-search))
3863
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
747
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
748 (define-key rmail-mode-map [menu-bar move previous]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
749 '("Previous Nondeleted" . rmail-previous-undeleted-message))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
750
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
751 (define-key rmail-mode-map [menu-bar move next]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
752 '("Next Nondeleted" . rmail-next-undeleted-message))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
753
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
754 (define-key rmail-mode-map [menu-bar move last]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
755 '("Last" . rmail-last-message))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
756
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
757 (define-key rmail-mode-map [menu-bar move first]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
758 '("First" . rmail-first-message))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
759
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
760 (define-key rmail-mode-map [menu-bar move previous]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
761 '("Previous" . rmail-previous-message))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
762
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
763 (define-key rmail-mode-map [menu-bar move next]
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
764 '("Next" . rmail-next-message))
049283382a10 (rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents: 3631
diff changeset
765
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
766 ;; Rmail mode is suitable only for specially formatted data.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
767 (put 'rmail-mode 'mode-class 'special)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
768
8963
286aacffb920 (rmail-mode-kill-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8909
diff changeset
769 (defun rmail-mode-kill-summary ()
286aacffb920 (rmail-mode-kill-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8909
diff changeset
770 (if rmail-summary-buffer (kill-buffer rmail-summary-buffer)))
286aacffb920 (rmail-mode-kill-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8909
diff changeset
771
1382
9b210c7d6c23 * rmail.el (rmail-mode): Make this autoload; we might find a file
Jim Blandy <jimb@redhat.com>
parents: 1372
diff changeset
772 ;;;###autoload
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
773 (defun rmail-mode ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
774 "Rmail Mode is used by \\<rmail-mode-map>\\[rmail] for editing Rmail files.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
775 All normal editing commands are turned off.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
776 Instead, these commands are available:
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
777
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
778 \\[rmail-beginning-of-message] Move point to front of this message (same as \\[beginning-of-buffer]).
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
779 \\[scroll-up] Scroll to next screen of this message.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
780 \\[scroll-down] Scroll to previous screen of this message.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
781 \\[rmail-next-undeleted-message] Move to Next non-deleted message.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
782 \\[rmail-previous-undeleted-message] Move to Previous non-deleted message.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
783 \\[rmail-next-message] Move to Next message whether deleted or not.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
784 \\[rmail-previous-message] Move to Previous message whether deleted or not.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
785 \\[rmail-first-message] Move to the first message in Rmail file.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
786 \\[rmail-last-message] Move to the last message in Rmail file.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
787 \\[rmail-show-message] Jump to message specified by numeric position in file.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
788 \\[rmail-search] Search for string and show message it is found in.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
789 \\[rmail-delete-forward] Delete this message, move to next nondeleted.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
790 \\[rmail-delete-backward] Delete this message, move to previous nondeleted.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
791 \\[rmail-undelete-previous-message] Undelete message. Tries current message, then earlier messages
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
792 till a deleted message is found.
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
793 \\[rmail-edit-current-message] Edit the current message. \\[rmail-cease-edit] to return to Rmail.
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
794 \\[rmail-expunge] Expunge deleted messages.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
795 \\[rmail-expunge-and-save] Expunge and save the file.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
796 \\[rmail-quit] Quit Rmail: expunge, save, then switch to another buffer.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
797 \\[save-buffer] Save without expunging.
2423
5dd3b7338f71 (rmail): Don't use mbox as inbox by default.
Richard M. Stallman <rms@gnu.org>
parents: 2076
diff changeset
798 \\[rmail-get-new-mail] Move new mail from system spool directory into this file.
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
799 \\[rmail-mail] Mail a message (same as \\[mail-other-window]).
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
800 \\[rmail-continue] Continue composing outgoing message started before.
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
801 \\[rmail-reply] Reply to this message. Like \\[rmail-mail] but initializes some fields.
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
802 \\[rmail-retry-failure] Send this message again. Used on a mailer failure message.
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
803 \\[rmail-forward] Forward this message to another user.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
804 \\[rmail-output-to-rmail-file] Output this message to an Rmail file (append it).
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
805 \\[rmail-output] Output this message to a Unix-format mail file (append it).
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
806 \\[rmail-input] Input Rmail file. Run Rmail on that file.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
807 \\[rmail-add-label] Add label to message. It will be displayed in the mode line.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
808 \\[rmail-kill-label] Kill label. Remove a label from current message.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
809 \\[rmail-next-labeled-message] Move to Next message with specified label
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
810 (label defaults to last one specified).
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
811 Standard labels: filed, unseen, answered, forwarded, deleted.
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
812 Any other label is present only if you add it with \\[rmail-add-label].
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
813 \\[rmail-previous-labeled-message] Move to Previous message with specified label
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
814 \\[rmail-summary] Show headers buffer, with a one line summary of each message.
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
815 \\[rmail-summary-by-labels] Summarize only messages with particular label(s).
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
816 \\[rmail-summary-by-recipients] Summarize only messages with particular recipient(s).
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
817 \\[rmail-summary-by-regexp] Summarize only messages with particular regexp(s).
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
818 \\[rmail-summary-by-topic] Summarize only messages with subject line regexp(s).
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
819 \\[rmail-toggle-header] Toggle display of complete header."
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
820 (interactive)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
821 (rmail-mode-2)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
822 (rmail-set-message-counters)
16431
65d3768ccb05 (rmail): Run rmail-mail-hook last.
Richard M. Stallman <rms@gnu.org>
parents: 16349
diff changeset
823 (rmail-show-message rmail-total-messages)
65d3768ccb05 (rmail): Run rmail-mail-hook last.
Richard M. Stallman <rms@gnu.org>
parents: 16349
diff changeset
824 (run-hooks 'rmail-mode-hook))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
825
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
826 (defun rmail-mode-2 ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
827 (kill-all-local-variables)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
828 (rmail-mode-1)
16431
65d3768ccb05 (rmail): Run rmail-mail-hook last.
Richard M. Stallman <rms@gnu.org>
parents: 16349
diff changeset
829 (rmail-variables))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
830
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
831 (defun rmail-mode-1 ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
832 (setq major-mode 'rmail-mode)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
833 (setq mode-name "RMAIL")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
834 (setq buffer-read-only t)
5330
bd122ee8c338 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 5325
diff changeset
835 ;; No need to auto save RMAIL files in normal circumstances
bd122ee8c338 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 5325
diff changeset
836 ;; because they contain no info except attribute changes
bd122ee8c338 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 5325
diff changeset
837 ;; and deletion of messages.
bd122ee8c338 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 5325
diff changeset
838 ;; The one exception is when messages are copied into an Rmail mode buffer.
bd122ee8c338 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 5325
diff changeset
839 ;; rmail-output-to-rmail-file enables auto save when you do that.
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
840 (setq buffer-auto-save-file-name nil)
19536
e0cd56c5b0ac (rmail-mode-1): Update the value for mode-line-modified.
Richard M. Stallman <rms@gnu.org>
parents: 19509
diff changeset
841 (setq mode-line-modified "--")
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
842 (use-local-map rmail-mode-map)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
843 (set-syntax-table text-mode-syntax-table)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
844 (setq local-abbrev-table text-mode-abbrev-table))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
845
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
846 (defun rmail-variables ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
847 (make-local-variable 'revert-buffer-function)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
848 (setq revert-buffer-function 'rmail-revert)
14467
f95ca90841d7 Fix up specialised fontification stuff.
Simon Marshall <simon@gnu.org>
parents: 14374
diff changeset
849 (make-local-variable 'font-lock-defaults)
14374
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
850 (setq font-lock-defaults
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
851 '(rmail-font-lock-keywords t nil nil nil
15497
7df33f9d1edd In Rmail mode, make sure font-lock-maximum-size locally becomes nil.
Simon Marshall <simon@gnu.org>
parents: 15403
diff changeset
852 (font-lock-maximum-size . nil)
14467
f95ca90841d7 Fix up specialised fontification stuff.
Simon Marshall <simon@gnu.org>
parents: 14374
diff changeset
853 (font-lock-fontify-buffer-function . rmail-fontify-buffer-function)
f95ca90841d7 Fix up specialised fontification stuff.
Simon Marshall <simon@gnu.org>
parents: 14374
diff changeset
854 (font-lock-unfontify-buffer-function . rmail-unfontify-buffer-function)
f95ca90841d7 Fix up specialised fontification stuff.
Simon Marshall <simon@gnu.org>
parents: 14374
diff changeset
855 (font-lock-inhibit-thing-lock . (lazy-lock-mode fast-lock-mode))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
856 (make-local-variable 'rmail-last-label)
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
857 (make-local-variable 'rmail-last-regexp)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
858 (make-local-variable 'rmail-deleted-vector)
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
859 (make-local-variable 'rmail-buffer)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
860 (setq rmail-buffer (current-buffer))
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
861 (make-local-variable 'rmail-view-buffer)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
862 (setq rmail-view-buffer rmail-buffer)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
863 (make-local-variable 'rmail-summary-buffer)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
864 (make-local-variable 'rmail-summary-vector)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
865 (make-local-variable 'rmail-current-message)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
866 (make-local-variable 'rmail-total-messages)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
867 (make-local-variable 'require-final-newline)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
868 (setq require-final-newline nil)
7061
9f27a57b7662 (rmail-show-message): Use overlays, not text properties.
Richard M. Stallman <rms@gnu.org>
parents: 7051
diff changeset
869 (make-local-variable 'rmail-overlay-list)
9f27a57b7662 (rmail-show-message): Use overlays, not text properties.
Richard M. Stallman <rms@gnu.org>
parents: 7051
diff changeset
870 (setq rmail-overlay-list nil)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
871 (make-local-variable 'version-control)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
872 (setq version-control 'never)
8963
286aacffb920 (rmail-mode-kill-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8909
diff changeset
873 (make-local-variable 'kill-buffer-hook)
286aacffb920 (rmail-mode-kill-summary): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8909
diff changeset
874 (add-hook 'kill-buffer-hook 'rmail-mode-kill-summary)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
875 (make-local-variable 'file-precious-flag)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
876 (setq file-precious-flag t)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
877 (make-local-variable 'rmail-message-vector)
17620
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
878 (make-local-variable 'rmail-msgref-vector)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
879 (make-local-variable 'rmail-inbox-list)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
880 (setq rmail-inbox-list (rmail-parse-file-inboxes))
3540
c14c0f2954fd (rmail-variables): Default rmail-inbox-list here.
Richard M. Stallman <rms@gnu.org>
parents: 3484
diff changeset
881 ;; Provide default set of inboxes for primary mail file ~/RMAIL.
c14c0f2954fd (rmail-variables): Default rmail-inbox-list here.
Richard M. Stallman <rms@gnu.org>
parents: 3484
diff changeset
882 (and (null rmail-inbox-list)
4010
735b8dc6cdd2 (rmail-variables): Compare truename as well as given name
Richard M. Stallman <rms@gnu.org>
parents: 3931
diff changeset
883 (or (equal buffer-file-name (expand-file-name rmail-file-name))
5192
3fb665ab94c1 (rmail-variables): Abbreviate truename for comparison.
Richard M. Stallman <rms@gnu.org>
parents: 5047
diff changeset
884 (equal buffer-file-truename
3fb665ab94c1 (rmail-variables): Abbreviate truename for comparison.
Richard M. Stallman <rms@gnu.org>
parents: 5047
diff changeset
885 (abbreviate-file-name (file-truename rmail-file-name))))
3540
c14c0f2954fd (rmail-variables): Default rmail-inbox-list here.
Richard M. Stallman <rms@gnu.org>
parents: 3484
diff changeset
886 (setq rmail-inbox-list
c14c0f2954fd (rmail-variables): Default rmail-inbox-list here.
Richard M. Stallman <rms@gnu.org>
parents: 3484
diff changeset
887 (or rmail-primary-inbox-list
c14c0f2954fd (rmail-variables): Default rmail-inbox-list here.
Richard M. Stallman <rms@gnu.org>
parents: 3484
diff changeset
888 (list (or (getenv "MAIL")
c14c0f2954fd (rmail-variables): Default rmail-inbox-list here.
Richard M. Stallman <rms@gnu.org>
parents: 3484
diff changeset
889 (concat rmail-spool-directory
5913
3d155c2636bf (rmail-variables, rmail-insert-inbox-text): Change user-original-login-name to
Karl Heuer <kwzh@gnu.org>
parents: 5860
diff changeset
890 (user-login-name)))))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
891 (make-local-variable 'rmail-keywords)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
892 ;; this gets generated as needed
7563
4b15aee0be13 (rmail-variables): Don't add any permanent-local props.
Richard M. Stallman <rms@gnu.org>
parents: 7435
diff changeset
893 (setq rmail-keywords nil))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
894
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
895 ;; Handle M-x revert-buffer done in an rmail-mode buffer.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
896 (defun rmail-revert (arg noconfirm)
12377
3cd65cb4c643 (rmail-revert): Use the default revert-buffer-function
Richard M. Stallman <rms@gnu.org>
parents: 12198
diff changeset
897 (let ((revert-buffer-function (default-value 'revert-buffer-function)))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
898 ;; Call our caller again, but this time it does the default thing.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
899 (if (revert-buffer arg noconfirm)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
900 ;; If the user said "yes", and we changed something,
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
901 ;; reparse the messages.
20681
4a46ac370fc8 (rmail): Don't bind enable-multibyte-characters;
Richard M. Stallman <rms@gnu.org>
parents: 20662
diff changeset
902 (progn
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
903 (rmail-convert-file)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
904 (goto-char (point-max))
11497
c98433c64db1 (rmail-revert): Call rmail-mode after reverting
Richard M. Stallman <rms@gnu.org>
parents: 11452
diff changeset
905 (rmail-mode)))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
906
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
907 ;; Return a list of files from this buffer's Mail: option.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
908 ;; Does not assume that messages have been parsed.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
909 ;; Just returns nil if buffer does not look like Babyl format.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
910 (defun rmail-parse-file-inboxes ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
911 (save-excursion
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
912 (save-restriction
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
913 (widen)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
914 (goto-char 1)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
915 (cond ((looking-at "BABYL OPTIONS:")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
916 (search-forward "\n\^_" nil 'move)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
917 (narrow-to-region 1 (point))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
918 (goto-char 1)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
919 (if (search-forward "\nMail:" nil t)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
920 (progn
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
921 (narrow-to-region (point) (progn (end-of-line) (point)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
922 (goto-char (point-min))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
923 (mail-parse-comma-list))))))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
924
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
925 (defun rmail-expunge-and-save ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
926 "Expunge and save RMAIL file."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
927 (interactive)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
928 (rmail-expunge)
5860
ba1ff614b8f2 (rmail-expunge-and-save): Mark summary buffer as unmodified.
Karl Heuer <kwzh@gnu.org>
parents: 5850
diff changeset
929 (save-buffer)
ba1ff614b8f2 (rmail-expunge-and-save): Mark summary buffer as unmodified.
Karl Heuer <kwzh@gnu.org>
parents: 5850
diff changeset
930 (if (rmail-summary-exists)
ba1ff614b8f2 (rmail-expunge-and-save): Mark summary buffer as unmodified.
Karl Heuer <kwzh@gnu.org>
parents: 5850
diff changeset
931 (rmail-select-summary (set-buffer-modified-p nil))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
932
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
933 (defun rmail-quit ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
934 "Quit out of RMAIL."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
935 (interactive)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
936 (rmail-expunge-and-save)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
937 ;; Don't switch to the summary buffer even if it was recently visible.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
938 (if rmail-summary-buffer
6484
04993cb5dcda (rmail-quit): Remove summary buffer from display.
Richard M. Stallman <rms@gnu.org>
parents: 6483
diff changeset
939 (progn
04993cb5dcda (rmail-quit): Remove summary buffer from display.
Richard M. Stallman <rms@gnu.org>
parents: 6483
diff changeset
940 (replace-buffer-in-windows rmail-summary-buffer)
04993cb5dcda (rmail-quit): Remove summary buffer from display.
Richard M. Stallman <rms@gnu.org>
parents: 6483
diff changeset
941 (bury-buffer rmail-summary-buffer)))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
942 (let ((obuf (current-buffer)))
6484
04993cb5dcda (rmail-quit): Remove summary buffer from display.
Richard M. Stallman <rms@gnu.org>
parents: 6483
diff changeset
943 (replace-buffer-in-windows obuf)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
944 (bury-buffer obuf)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
945
10970
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
946 (defun rmail-bury ()
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
947 "Bury current Rmail buffer and its summary buffer."
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
948 (interactive)
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
949 ;; This let var was called rmail-buffer, but that interfered
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
950 ;; with the buffer-local var used in summary buffers.
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
951 (let ((buffer-to-bury (current-buffer)))
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
952 (if (rmail-summary-exists)
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
953 (let (window)
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
954 (while (setq window (get-buffer-window rmail-summary-buffer))
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
955 (set-window-buffer window (other-buffer rmail-summary-buffer)))
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
956 (bury-buffer rmail-summary-buffer)))
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
957 (switch-to-buffer (other-buffer (current-buffer)))
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
958 (bury-buffer buffer-to-bury)))
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
959
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
960 (defun rmail-duplicate-message ()
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
961 "Create a duplicated copy of the current message.
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
962 The duplicate copy goes into the Rmail file just after the
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
963 original copy."
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
964 (interactive)
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
965 (widen)
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
966 (let ((buffer-read-only nil)
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
967 (number rmail-current-message)
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
968 (string (buffer-substring (rmail-msgbeg rmail-current-message)
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
969 (rmail-msgend rmail-current-message))))
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
970 (goto-char (rmail-msgend rmail-current-message))
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
971 (insert string)
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
972 (rmail-forget-messages)
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
973 (rmail-show-message number)
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
974 (message "Message duplicated")))
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
975
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
976 ;;;###autoload
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
977 (defun rmail-input (filename)
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
978 "Run Rmail on file FILENAME."
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
979 (interactive "FRun rmail on RMAIL file: ")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
980 (rmail filename))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
981
16241
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
982
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
983 ;; This used to scan subdirectories recursively, but someone pointed out
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
984 ;; that if the user wants that, person can put all the files in one dir.
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
985 ;; And the recursive scan was slow. So I took it out.
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
986 ;; rms, Sep 1996.
8909
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
987 (defun rmail-find-all-files (start)
16241
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
988 "Return list of file in dir START that match `rmail-secondary-file-regexp'."
8909
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
989 (if (file-accessible-directory-p start)
9449
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
990 ;; Don't sort here.
16241
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
991 (let* ((case-fold-search t)
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
992 (files (directory-files start t rmail-secondary-file-regexp)))
9449
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
993 ;; Sort here instead of in directory-files
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
994 ;; because this list is usually much shorter.
16241
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
995 (sort files 'string<))))
7321
f8ee542dbe80 (rmail-input-menu): Don't call expand-file-name.
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
996
8909
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
997 (defun rmail-list-to-menu (menu-name l action &optional full-name)
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
998 (let ((menu (make-sparse-keymap menu-name)))
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
999 (mapcar
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
1000 (function (lambda (item)
10971
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1001 (let (command)
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1002 (if (consp item)
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1003 (progn
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1004 (setq command
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1005 (rmail-list-to-menu (car item) (cdr item)
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1006 action
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1007 (if full-name
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1008 (concat full-name "/"
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1009 (car item))
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1010 (car item))))
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1011 (setq name (car item)))
8909
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
1012 (progn
10971
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1013 (setq name item)
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1014 (setq command
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1015 (list 'lambda () '(interactive)
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1016 (list action
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1017 (expand-file-name
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1018 (if full-name
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1019 (concat full-name "/" item)
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1020 item)
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1021 rmail-secondary-file-directory))))))
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1022 (define-key menu (vector (intern name))
d7f0852f800f (rmail-list-to-menu): Bind `command' with let.
Richard M. Stallman <rms@gnu.org>
parents: 10970
diff changeset
1023 (cons name command)))))
9449
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
1024 (reverse l))
8909
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
1025 menu))
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
1026
9449
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
1027 ;; This command is always "disabled" when it appears in a menu.
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
1028 (put 'rmail-disable-menu 'menu-enable ''nil)
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
1029
8909
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
1030 (defun rmail-construct-io-menu ()
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
1031 (let ((files (rmail-find-all-files rmail-secondary-file-directory)))
9449
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
1032 (if files
8909
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
1033 (progn
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
1034 (define-key rmail-mode-map [menu-bar classify input-menu]
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
1035 (cons "Input Rmail File"
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
1036 (rmail-list-to-menu "Input Rmail File"
9449
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
1037 files
8909
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
1038 'rmail-input)))
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
1039 (define-key rmail-mode-map [menu-bar classify output-menu]
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
1040 (cons "Output Rmail File"
d9c10eb46ce9 Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
Richard M. Stallman <rms@gnu.org>
parents: 8875
diff changeset
1041 (rmail-list-to-menu "Output Rmail File"
9449
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
1042 files
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
1043 'rmail-output-to-rmail-file))))
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
1044
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
1045 (define-key rmail-mode-map [menu-bar classify input-menu]
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
1046 '("Input Rmail File" . rmail-disable-menu))
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
1047 (define-key rmail-mode-map [menu-bar classify output-menu]
d11a719d7bde (rmail-find-all-files): Fix several errors and make faster.
Richard M. Stallman <rms@gnu.org>
parents: 9431
diff changeset
1048 '("Output Rmail File" . rmail-disable-menu)))))
6408
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
1049
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1050
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1051 ;;;; *** Rmail input ***
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1052
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1053 ;; RLK feature not added in this version:
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1054 ;; argument specifies inbox file or files in various ways.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1055
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1056 (defun rmail-get-new-mail (&optional file-name)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1057 "Move any new mail from this RMAIL file's inbox files.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1058 The inbox files can be specified with the file's Mail: option. The
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1059 variable `rmail-primary-inbox-list' specifies the inboxes for your
2423
5dd3b7338f71 (rmail): Don't use mbox as inbox by default.
Richard M. Stallman <rms@gnu.org>
parents: 2076
diff changeset
1060 primary RMAIL file if it has no Mail: option. By default, this is
5dd3b7338f71 (rmail): Don't use mbox as inbox by default.
Richard M. Stallman <rms@gnu.org>
parents: 2076
diff changeset
1061 your /usr/spool/mail/$USER.
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1062
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1063 You can also specify the file to get new mail from. In this case, the
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1064 file of new mail is not changed or deleted. Noninteractively, you can
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1065 pass the inbox file name as an argument. Interactively, a prefix
8701
f3567d21b4e9 (rmail-get-new-mail): Run rmail-get-new-mail-hook.
Richard M. Stallman <rms@gnu.org>
parents: 8591
diff changeset
1066 argument causes us to read a file name and use that file as the inbox.
f3567d21b4e9 (rmail-get-new-mail): Run rmail-get-new-mail-hook.
Richard M. Stallman <rms@gnu.org>
parents: 8591
diff changeset
1067
16908
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1068 If the variable `rmail-preserve-inbox' is non-nil, new mail will
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1069 always be left in inbox files rather than deleted.
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1070
10103
efb97e6ec979 (rmail-get-new-mail): Position on first unseen message.
Richard M. Stallman <rms@gnu.org>
parents: 9633
diff changeset
1071 This function runs `rmail-get-new-mail-hook' before saving the updated file.
efb97e6ec979 (rmail-get-new-mail): Position on first unseen message.
Richard M. Stallman <rms@gnu.org>
parents: 9633
diff changeset
1072 It returns t if it got any new messages."
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1073 (interactive
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1074 (list (if current-prefix-arg
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1075 (read-file-name "Get new mail from file: "))))
15549
212868acf99e (rmail-get-new-mail): Run rmail-before-get-new-mail-hook.
Richard M. Stallman <rms@gnu.org>
parents: 15547
diff changeset
1076 (run-hooks 'rmail-before-get-new-mail-hook)
11533
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
1077 ;; If the disk file has been changed from under us,
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
1078 ;; revert to it before we get new mail.
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1079 (or (verify-visited-file-modtime (current-buffer))
11533
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
1080 (find-file (buffer-file-name)))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1081 (rmail-maybe-set-message-counters)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1082 (widen)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1083 ;; Get rid of all undo records for this buffer.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1084 (or (eq buffer-undo-list t)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1085 (setq buffer-undo-list nil))
16241
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1086 (let ((all-files (if file-name (list file-name)
20053
c315820510ba (rmail): Avoid showing message twice.
Karl Heuer <kwzh@gnu.org>
parents: 19674
diff changeset
1087 rmail-inbox-list))
c315820510ba (rmail): Avoid showing message twice.
Karl Heuer <kwzh@gnu.org>
parents: 19674
diff changeset
1088 found)
16241
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1089 (unwind-protect
20053
c315820510ba (rmail): Avoid showing message twice.
Karl Heuer <kwzh@gnu.org>
parents: 19674
diff changeset
1090 (progn
16928
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1091 (while all-files
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1092 (let ((opoint (point))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1093 (new-messages 0)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1094 (delete-files ())
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1095 ;; If buffer has not changed yet, and has not been saved yet,
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1096 ;; don't replace the old backup file now.
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1097 (make-backup-files (and make-backup-files (buffer-modified-p)))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1098 (buffer-read-only nil)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1099 ;; Don't make undo records for what we do in getting mail.
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1100 (buffer-undo-list t)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1101 success
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1102 ;; Files to insert this time around.
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1103 files
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1104 ;; Last names of those files.
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1105 file-last-names)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1106 ;; Pull files off all-files onto files
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1107 ;; as long as there is no name conflict.
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1108 ;; A conflict happens when two inbox file names
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1109 ;; have the same last component.
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1110 (while (and all-files
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1111 (not (member (file-name-nondirectory (car all-files))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1112 file-last-names)))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1113 (setq files (cons (car all-files) files)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1114 file-last-names
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1115 (cons (file-name-nondirectory (car all-files)) files))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1116 (setq all-files (cdr all-files)))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1117 ;; Put them back in their original order.
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1118 (setq files (nreverse files))
16241
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1119
16928
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1120 (goto-char (point-max))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1121 (skip-chars-backward " \t\n") ; just in case of brain damage
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1122 (delete-region (point) (point-max)) ; caused by require-final-newline
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1123 (save-excursion
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1124 (save-restriction
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1125 (narrow-to-region (point) (point))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1126 ;; Read in the contents of the inbox files,
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1127 ;; renaming them as necessary,
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1128 ;; and adding to the list of files to delete eventually.
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1129 (if file-name
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1130 (rmail-insert-inbox-text files nil)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1131 (setq delete-files (rmail-insert-inbox-text files t)))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1132 ;; Scan the new text and convert each message to babyl format.
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1133 (goto-char (point-min))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1134 (unwind-protect
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1135 (save-excursion
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1136 (setq new-messages (rmail-convert-to-babyl-format)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1137 success t))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1138 ;; If we could not convert the file's inboxes,
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1139 ;; rename the files we tried to read
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1140 ;; so we won't over and over again.
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1141 (if (and (not file-name) (not success))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1142 (let ((delfiles delete-files)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1143 (count 0))
18442
83a349d63da6 (rmail-get-new-mail): If conversion fails, delete the text that was inserted.
Richard M. Stallman <rms@gnu.org>
parents: 18296
diff changeset
1144 ;; Try to delete the garbage just inserted.
83a349d63da6 (rmail-get-new-mail): If conversion fails, delete the text that was inserted.
Richard M. Stallman <rms@gnu.org>
parents: 18296
diff changeset
1145 (delete-region (point-min) (point-max))
16928
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1146 (while delfiles
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1147 (while (file-exists-p (format "RMAILOSE.%d" count))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1148 (setq count (1+ count)))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1149 (rename-file (car delfiles)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1150 (format "RMAILOSE.%d" count))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1151 (setq delfiles (cdr delfiles))))))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1152 (or (zerop new-messages)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1153 (let (success)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1154 (widen)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1155 (search-backward "\n\^_" nil t)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1156 (narrow-to-region (point) (point-max))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1157 (goto-char (1+ (point-min)))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1158 (rmail-count-new-messages)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1159 (run-hooks 'rmail-get-new-mail-hook)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1160 (save-buffer)))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1161 ;; Delete the old files, now that babyl file is saved.
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1162 (while delete-files
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1163 (condition-case ()
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1164 ;; First, try deleting.
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1165 (condition-case ()
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1166 (delete-file (car delete-files))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1167 (file-error
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1168 ;; If we can't delete it, truncate it.
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1169 (write-region (point) (point) (car delete-files))))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1170 (file-error nil))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1171 (setq delete-files (cdr delete-files)))))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1172 (if (= new-messages 0)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1173 (progn (goto-char opoint)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1174 (if (or file-name rmail-inbox-list)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1175 (message "(No new mail has arrived)")))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1176 (if (rmail-summary-exists)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1177 (rmail-select-summary
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1178 (rmail-update-summary)))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1179 (message "%d new message%s read"
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1180 new-messages (if (= 1 new-messages) "" "s"))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1181 ;; Move to the first new message
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1182 ;; unless we have other unseen messages before it.
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1183 (rmail-show-message (rmail-first-unseen-message))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1184 (run-hooks 'rmail-after-get-new-mail-hook)
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1185 (setq found t))))
28186ed53849 (rmail-get-new-mail): Fix return value to match doc.
Karl Heuer <kwzh@gnu.org>
parents: 16908
diff changeset
1186 found)
16241
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1187 ;; Don't leave the buffer screwed up if we get a disk-full error.
20053
c315820510ba (rmail): Avoid showing message twice.
Karl Heuer <kwzh@gnu.org>
parents: 19674
diff changeset
1188 (or found (rmail-show-message)))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1189
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1190 (defun rmail-insert-inbox-text (files renamep)
16241
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1191 ;; Detect a locked file now, so that we avoid moving mail
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1192 ;; out of the real inbox file. (That could scare people.)
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1193 (or (memq (file-locked-p buffer-file-name) '(nil t))
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1194 (error "RMAIL file %s is locked"
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1195 (file-name-nondirectory buffer-file-name)))
18989
6253a99afd95 (rmail-pop-password-error): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18957
diff changeset
1196 (let (file tofile delete-files movemail popmail got-password)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1197 (while files
6035
a96a9f6cb250 (rmail-insert-inbox-text): Recognize the spool directory even if symlinks are
Karl Heuer <kwzh@gnu.org>
parents: 5913
diff changeset
1198 (setq file (file-truename
a96a9f6cb250 (rmail-insert-inbox-text): Recognize the spool directory even if symlinks are
Karl Heuer <kwzh@gnu.org>
parents: 5913
diff changeset
1199 (expand-file-name (substitute-in-file-name (car files))))
12650
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1200 tofile (expand-file-name
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1201 ;; Generate name to move to from inbox name,
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1202 ;; in case of multiple inboxes that need moving.
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1203 (concat ".newmail-" (file-name-nondirectory file))
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1204 ;; Use the directory of this rmail file
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1205 ;; because it's a nuisance to use the homedir
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1206 ;; if that is on a full disk and this rmail
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1207 ;; file isn't.
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1208 (file-name-directory
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1209 (expand-file-name buffer-file-name))))
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1210 ;; Always use movemail to rename the file,
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1211 ;; since there can be mailboxes in various directories.
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1212 (setq movemail t)
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1213 ;;; ;; If getting from mail spool directory,
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1214 ;;; ;; use movemail to move rather than just renaming,
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1215 ;;; ;; so as to interlock with the mailer.
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1216 ;;; (setq movemail (string= file
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1217 ;;; (file-truename
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1218 ;;; (concat rmail-spool-directory
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1219 ;;; (file-name-nondirectory file)))))
6f4785fee5cc (rmail-insert-inbox-text): Always use movemail when renaming a file.
Richard M. Stallman <rms@gnu.org>
parents: 12447
diff changeset
1220 (setq popmail (string-match "^po:" (file-name-nondirectory file)))
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1221 (if popmail (setq file (file-name-nondirectory file)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1222 renamep t))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1223 (if movemail
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1224 (progn
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1225 ;; On some systems, /usr/spool/mail/foo is a directory
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1226 ;; and the actual inbox is /usr/spool/mail/foo/foo.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1227 (if (file-directory-p file)
5913
3d155c2636bf (rmail-variables, rmail-insert-inbox-text): Change user-original-login-name to
Karl Heuer <kwzh@gnu.org>
parents: 5860
diff changeset
1228 (setq file (expand-file-name (user-login-name)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1229 file)))))
11452
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1230 (cond (popmail
15085
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1231 (if (and rmail-pop-password-required (not rmail-pop-password))
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1232 (setq rmail-pop-password
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1233 (rmail-read-passwd
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1234 (format "Password for %s: "
18989
6253a99afd95 (rmail-pop-password-error): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18957
diff changeset
1235 (substring file (+ popmail 3))))
6253a99afd95 (rmail-pop-password-error): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18957
diff changeset
1236 got-password t))
15085
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1237 (if (eq system-type 'windows-nt)
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1238 ;; cannot have "po:" in file name
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1239 (setq tofile
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1240 (expand-file-name
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1241 (concat ".newmail-pop-" (substring file (+ popmail 3)))
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1242 (file-name-directory
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1243 (expand-file-name buffer-file-name)))))
11452
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1244 (message "Getting mail from post office ..."))
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1245 ((and (file-exists-p tofile)
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1246 (/= 0 (nth 7 (file-attributes tofile))))
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1247 (message "Getting mail from %s..." tofile))
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1248 ((and (file-exists-p file)
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1249 (/= 0 (nth 7 (file-attributes file))))
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1250 (message "Getting mail from %s..." file)))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1251 ;; Set TOFILE if have not already done so, and
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1252 ;; rename or copy the file FILE to TOFILE if and as appropriate.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1253 (cond ((not renamep)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1254 (setq tofile file))
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1255 ((or (file-exists-p tofile) (and (not popmail)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1256 (not (file-exists-p file))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1257 nil)
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1258 ((and (not movemail) (not popmail))
16908
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1259 ;; Try copying. If that fails (perhaps no space) and
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1260 ;; we're allowed to blow away the inbox, rename instead.
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1261 (if rmail-preserve-inbox
4071
4f387cc0a49f (rmail-insert-inbox-text): If inbox is not in the
Richard M. Stallman <rms@gnu.org>
parents: 4020
diff changeset
1262 (copy-file file tofile nil)
16908
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1263 (condition-case nil
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1264 (copy-file file tofile nil)
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1265 (error
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1266 ;; Third arg is t so we can replace existing file TOFILE.
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1267 (rename-file file tofile t))))
1165
8aa120c74487 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 1161
diff changeset
1268 ;; Make the real inbox file empty.
8aa120c74487 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 1161
diff changeset
1269 ;; Leaving it deleted could cause lossage
8aa120c74487 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 1161
diff changeset
1270 ;; because mailers often won't create the file.
16908
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1271 (if (not rmail-preserve-inbox)
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1272 (condition-case ()
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1273 (write-region (point) (point) file)
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1274 (file-error nil))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1275 (t
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1276 (let ((errors nil))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1277 (unwind-protect
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1278 (save-excursion
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1279 (setq errors (generate-new-buffer " *rmail loss*"))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1280 (buffer-disable-undo errors)
16908
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1281 (let ((args
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1282 (append
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1283 (list (or rmail-movemail-program
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1284 (expand-file-name "movemail"
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1285 exec-directory))
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1286 nil errors nil)
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1287 (if rmail-preserve-inbox
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1288 (list "-p")
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1289 nil)
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1290 (list file tofile)
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1291 (if rmail-pop-password
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1292 (list rmail-pop-password)
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1293 nil))))
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1294 (apply 'call-process args))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1295 (if (not (buffer-modified-p errors))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1296 ;; No output => movemail won
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1297 nil
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1298 (set-buffer errors)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1299 (subst-char-in-region (point-min) (point-max)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1300 ?\n ?\ )
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1301 (goto-char (point-max))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1302 (skip-chars-backward " \t")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1303 (delete-region (point) (point-max))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1304 (goto-char (point-min))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1305 (if (looking-at "movemail: ")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1306 (delete-region (point-min) (match-end 0)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1307 (beep t)
14325
51bfdecb7084 (rmail-insert-inbox-text): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
1308 (message "movemail: %s"
51bfdecb7084 (rmail-insert-inbox-text): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
1309 (buffer-substring (point-min)
51bfdecb7084 (rmail-insert-inbox-text): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
1310 (point-max)))
18990
53cfff0db399 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 18989
diff changeset
1311 ;; If we just read the password, most likely it is
53cfff0db399 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 18989
diff changeset
1312 ;; wrong. Otherwise, see if there is a specific
53cfff0db399 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 18989
diff changeset
1313 ;; reason to think that the problem is a wrong passwd.
18989
6253a99afd95 (rmail-pop-password-error): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18957
diff changeset
1314 (if (or got-password
6253a99afd95 (rmail-pop-password-error): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18957
diff changeset
1315 (re-search-forward rmail-pop-password-error
6253a99afd95 (rmail-pop-password-error): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18957
diff changeset
1316 nil t))
6253a99afd95 (rmail-pop-password-error): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18957
diff changeset
1317 (setq rmail-pop-password nil))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1318 (sit-for 3)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1319 nil))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1320 (if errors (kill-buffer errors))))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1321 ;; At this point, TOFILE contains the name to read:
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1322 ;; Either the alternate name (if we renamed)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1323 ;; or the actual inbox (if not renaming).
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1324 (if (file-exists-p tofile)
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1325 (let ((coding-system-for-read 'no-conversion)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1326 size)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1327 (goto-char (point-max))
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1328 (setq size (nth 1 (insert-file-contents tofile)))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1329 (goto-char (point-max))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1330 (or (= (preceding-char) ?\n)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1331 (zerop size)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1332 (insert ?\n))
16908
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1333 (if (not (and rmail-preserve-inbox (string= file tofile)))
fd99785417a5 (rmail-preserve-inbox): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16772
diff changeset
1334 (setq delete-files (cons tofile delete-files)))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1335 (message "")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1336 (setq files (cdr files)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1337 delete-files))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1338
15085
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1339 (defun rmail-read-passwd (prompt &optional default)
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1340 "Read a password, echoing `.' for each character typed.
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1341 End with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line.
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1342 Optional DEFAULT is password to start with."
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1343 (let ((pass (if default default ""))
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1344 (c 0)
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1345 (echo-keystrokes 0)
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1346 (cursor-in-echo-area t))
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1347 (while (progn (message "%s%s"
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1348 prompt
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1349 (make-string (length pass) ?.))
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1350 (setq c (read-char))
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1351 (and (/= c ?\r) (/= c ?\n) (/= c ?\e)))
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1352 (if (= c ?\C-u)
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1353 (setq pass "")
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1354 (if (and (/= c ?\b) (/= c ?\177))
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1355 (setq pass (concat pass (char-to-string c)))
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1356 (if (> (length pass) 0)
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1357 (setq pass (substring pass 0 -1))))))
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1358 (message "")
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1359 (message nil)
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1360 pass))
7048437bc690 (rmail-insert-inbox-text): When required, prompt for
Richard M. Stallman <rms@gnu.org>
parents: 14916
diff changeset
1361
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1362 ;; the rmail-break-forwarded-messages feature is not implemented
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1363 (defun rmail-convert-to-babyl-format ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1364 (let ((count 0) start
402
14485c6a56aa *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 346
diff changeset
1365 (case-fold-search nil)
14485c6a56aa *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 346
diff changeset
1366 (invalid-input-resync
14485c6a56aa *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 346
diff changeset
1367 (function (lambda ()
14485c6a56aa *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 346
diff changeset
1368 (message "Invalid Babyl format in inbox!")
16241
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1369 (sit-for 3)
402
14485c6a56aa *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 346
diff changeset
1370 ;; Try to get back in sync with a real message.
14485c6a56aa *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 346
diff changeset
1371 (if (re-search-forward
18091
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
1372 (concat rmail-mmdf-delim1 "\\|^From") nil t)
402
14485c6a56aa *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 346
diff changeset
1373 (beginning-of-line)
14485c6a56aa *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 346
diff changeset
1374 (goto-char (point-max)))))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1375 (goto-char (point-min))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1376 (save-restriction
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1377 (while (not (eobp))
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1378 (setq start (point))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1379 (cond ((looking-at "BABYL OPTIONS:");Babyl header
402
14485c6a56aa *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 346
diff changeset
1380 (if (search-forward "\n\^_" nil t)
14485c6a56aa *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 346
diff changeset
1381 ;; If we find the proper terminator, delete through there.
14485c6a56aa *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 346
diff changeset
1382 (delete-region (point-min) (point))
14485c6a56aa *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 346
diff changeset
1383 (funcall invalid-input-resync)
405
698d5d6e8f8b *** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents: 403
diff changeset
1384 (delete-region (point-min) (point))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1385 ;; Babyl format message
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1386 ((looking-at "\^L")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1387 (or (search-forward "\n\^_" nil t)
402
14485c6a56aa *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 346
diff changeset
1388 (funcall invalid-input-resync))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1389 (setq count (1+ count))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1390 ;; Make sure there is no extra white space after the ^_
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1391 ;; at the end of the message.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1392 ;; Narrowing will make sure that whatever follows the junk
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1393 ;; will be treated properly.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1394 (delete-region (point)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1395 (save-excursion
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1396 (skip-chars-forward " \t\n")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1397 (point)))
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1398 (or rmail-enable-mime
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1399 (not rmail-file-coding-system)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1400 (decode-coding-region start (point)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1401 rmail-file-coding-system))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1402 (narrow-to-region (point) (point-max)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1403 ;;*** MMDF format
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1404 ((let ((case-fold-search t))
18091
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
1405 (looking-at rmail-mmdf-delim1))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1406 (let ((case-fold-search t))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1407 (replace-match "\^L\n0, unseen,,\n*** EOOH ***\n")
18091
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
1408 (re-search-forward rmail-mmdf-delim2 nil t)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1409 (replace-match "\^_"))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1410 (save-excursion
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1411 (save-restriction
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1412 (narrow-to-region start (1- (point)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1413 (goto-char (point-min))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1414 (while (search-forward "\n\^_" nil t); single char "\^_"
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1415 (replace-match "\n^_")))); 2 chars: "^" and "_"
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1416 (or rmail-enable-mime
18296
5b6f098f3d32 (rmail-enable-decoding-message): Deleted.
Kenichi Handa <handa@m17n.org>
parents: 18091
diff changeset
1417 (not enable-multibyte-characters)
17839
b4a81f70d905 Coding system names changed as follows:
Kenichi Handa <handa@m17n.org>
parents: 17822
diff changeset
1418 (decode-coding-region start (point) 'undecided))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1419 (narrow-to-region (point) (point-max))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1420 (setq count (1+ count)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1421 ;;*** Mail format
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1422 ((looking-at "^From ")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1423 (insert "\^L\n0, unseen,,\n*** EOOH ***\n")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1424 (rmail-nuke-pinhead-header)
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1425 ;; If this message has a Content-Length field,
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1426 ;; skip to the end of the contents.
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1427 (let* ((header-end (save-excursion
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1428 (and (re-search-forward "\n\n" nil t)
5466
794b93d511b9 (rmail-convert-to-babyl-format):
Richard M. Stallman <rms@gnu.org>
parents: 5419
diff changeset
1429 (1- (point)))))
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1430 (case-fold-search t)
20273
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1431 (quoted-printable-header-field-end
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1432 (save-excursion
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1433 (re-search-forward
20274
faa32765fb8f Improve previous change.
Karl Heuer <kwzh@gnu.org>
parents: 20273
diff changeset
1434 "^content-transfer-encoding:\\(\n?[\t ]\\)*quoted-printable\\(\n?[\t ]\\)*"
20273
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1435 header-end t)))
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1436 (size
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1437 ;; Get the numeric value from the Content-Length field.
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1438 (save-excursion
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1439 ;; Back up to end of prev line,
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1440 ;; in case the Content-Length field comes first.
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1441 (forward-char -1)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1442 (and (search-forward "\ncontent-length: "
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1443 header-end t)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1444 (let ((beg (point))
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1445 (eol (progn (end-of-line) (point))))
6389
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1446 (string-to-int (buffer-substring beg eol)))))))
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1447 (and size
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1448 (if (and (natnump size)
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1449 (<= (+ header-end size) (point-max))
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1450 ;; Make sure this would put us at a position
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1451 ;; that we could continue from.
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1452 (save-excursion
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1453 (goto-char (+ header-end size))
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1454 (skip-chars-forward "\n")
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1455 (or (eobp)
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1456 (and (looking-at "BABYL OPTIONS:")
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1457 (search-forward "\n\^_" nil t))
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1458 (and (looking-at "\^L")
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1459 (search-forward "\n\^_" nil t))
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1460 (let ((case-fold-search t))
18091
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
1461 (looking-at rmail-mmdf-delim1))
6389
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1462 (looking-at "From "))))
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1463 (goto-char (+ header-end size))
9b45e828c2a7 (rmail-convert-to-babyl-format): Check Content-Length field for consistency.
Karl Heuer <kwzh@gnu.org>
parents: 6289
diff changeset
1464 (message "Ignoring invalid Content-Length field")
20273
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1465 (sit-for 1 0 t)))
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1466 (if (re-search-forward
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1467 (concat "^[\^_]?\\("
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1468 rmail-unix-mail-delimiter
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1469 "\\|"
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1470 rmail-mmdf-delim1 "\\|"
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1471 "^BABYL OPTIONS:\\|"
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1472 "\^L\n[01],\\)") nil t)
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1473 (goto-char (match-beginning 1))
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1474 (goto-char (point-max)))
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1475 (setq count (1+ count))
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1476 (if quoted-printable-header-field-end
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1477 (save-excursion
20399
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1478 (rmail-decode-quoted-printable header-end (point))
20273
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1479 ;; Change "quoted-printable" to "8bit",
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1480 ;; to reflect the decoding we just did.
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1481 (goto-char quoted-printable-header-field-end)
20274
faa32765fb8f Improve previous change.
Karl Heuer <kwzh@gnu.org>
parents: 20273
diff changeset
1482 (delete-region (point) (search-backward ":"))
20273
f451d46a8c68 (rmail-convert-to-babyl-format): If the
Karl Heuer <kwzh@gnu.org>
parents: 20261
diff changeset
1483 (insert ": 8bit"))))
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1484
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1485 (save-excursion
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1486 (save-restriction
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1487 (narrow-to-region start (point))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1488 (goto-char (point-min))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1489 (while (search-forward "\n\^_" nil t); single char
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1490 (replace-match "\n^_")))); 2 chars: "^" and "_"
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1491 (insert ?\^_)
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1492 (or rmail-enable-mime
18296
5b6f098f3d32 (rmail-enable-decoding-message): Deleted.
Kenichi Handa <handa@m17n.org>
parents: 18091
diff changeset
1493 (not enable-multibyte-characters)
17839
b4a81f70d905 Coding system names changed as follows:
Kenichi Handa <handa@m17n.org>
parents: 17822
diff changeset
1494 (decode-coding-region start (point) 'undecided))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1495 (narrow-to-region (point) (point-max)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1496 ;;
2700
9de57e00caf7 (rmail-convert-to-babyl-format): Delete 1 char
Richard M. Stallman <rms@gnu.org>
parents: 2687
diff changeset
1497 ;; This kludge is because some versions of sendmail.el
9de57e00caf7 (rmail-convert-to-babyl-format): Delete 1 char
Richard M. Stallman <rms@gnu.org>
parents: 2687
diff changeset
1498 ;; insert an extra newline at the beginning that shouldn't
9de57e00caf7 (rmail-convert-to-babyl-format): Delete 1 char
Richard M. Stallman <rms@gnu.org>
parents: 2687
diff changeset
1499 ;; be there. sendmail.el has been fixed, but old versions
9de57e00caf7 (rmail-convert-to-babyl-format): Delete 1 char
Richard M. Stallman <rms@gnu.org>
parents: 2687
diff changeset
1500 ;; may still be in use. -- rms, 7 May 1993.
9de57e00caf7 (rmail-convert-to-babyl-format): Delete 1 char
Richard M. Stallman <rms@gnu.org>
parents: 2687
diff changeset
1501 ((eolp) (delete-char 1))
405
698d5d6e8f8b *** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents: 403
diff changeset
1502 (t (error "Cannot convert to babyl format")))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1503 count))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1504
20399
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1505 (defun rmail-hex-char-to-integer (character)
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1506 "Return CHARACTER's value interpreted as a hex digit."
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1507 (if (and (>= character ?0) (<= character ?9))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1508 (- character ?0)
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1509 (let ((ch (logior character 32)))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1510 (if (and (>= ch ?a) (<= ch ?f))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1511 (- ch (- ?a 10))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1512 (error "Invalid hex digit `%c'" ch)))))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1513
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1514 (defun rmail-hex-string-to-integer (hex-string)
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1515 "Return decimal integer for HEX-STRING."
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1516 (let ((hex-num 0)
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1517 (index 0))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1518 (while (< index (length hex-string))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1519 (setq hex-num (+ (* hex-num 16)
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1520 (rmail-hex-char-to-integer (aref hex-string index))))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1521 (setq index (1+ index)))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1522 hex-num))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1523
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1524 (defun rmail-decode-quoted-printable (from to)
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1525 "Decode Quoted-Printable in the region between FROM and TO."
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1526 (interactive "r")
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1527 (goto-char from)
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1528 (or (markerp to)
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1529 (setq to (copy-marker to)))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1530 (while (search-forward "=" to t)
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1531 (cond ((eq (following-char) ?\n)
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1532 (delete-char -1)
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1533 (delete-char 1))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1534 ((looking-at "[0-9A-F][0-9A-F]")
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1535 (subst-char-in-region
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1536 (1- (point)) (point) ?=
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1537 (rmail-hex-string-to-integer
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1538 (buffer-substring (point) (+ 2 (point)))))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1539 (delete-char 2))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1540 ((looking-at "=")
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1541 (delete-char 1))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1542 (t
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1543 (message "Malformed MIME quoted-printable message")))))
04ce86b23ffa (rmail-decode-quoted-printable): New function
Karl Heuer <kwzh@gnu.org>
parents: 20274
diff changeset
1544
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1545 ;; Delete the "From ..." line, creating various other headers with
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1546 ;; information from it if they don't already exist. Now puts the
4838
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
1547 ;; original line into a mail-from: header line for debugging and for
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
1548 ;; use by the rmail-output function.
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1549 (defun rmail-nuke-pinhead-header ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1550 (save-excursion
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1551 (save-restriction
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1552 (let ((start (point))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1553 (end (progn
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1554 (condition-case ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1555 (search-forward "\n\n")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1556 (error
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1557 (goto-char (point-max))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1558 (insert "\n\n")))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1559 (point)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1560 has-from has-date)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1561 (narrow-to-region start end)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1562 (let ((case-fold-search t))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1563 (goto-char start)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1564 (setq has-from (search-forward "\nFrom:" nil t))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1565 (goto-char start)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1566 (setq has-date (and (search-forward "\nDate:" nil t) (point)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1567 (goto-char start))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1568 (let ((case-fold-search nil))
617
cde1f15848c6 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 584
diff changeset
1569 (if (re-search-forward (concat "^" rmail-unix-mail-delimiter) nil t)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1570 (replace-match
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1571 (concat
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1572 "Mail-from: \\&"
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1573 ;; Keep and reformat the date if we don't
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1574 ;; have a Date: field.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1575 (if has-date
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1576 ""
1112
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
1577 (concat
15534
7f169dd814ce (rmail-unix-mail-delimiter):
Richard M. Stallman <rms@gnu.org>
parents: 15503
diff changeset
1578 "Date: \\2, \\4 \\3 \\9 \\5 "
1112
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
1579
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
1580 ;; The timezone could be matched by group 7 or group 10.
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
1581 ;; If neither of them matched, assume EST, since only
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
1582 ;; Easterners would be so sloppy.
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
1583 ;; It's a shame the substitution can't use "\\10".
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
1584 (cond
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
1585 ((/= (match-beginning 7) (match-end 7)) "\\7")
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
1586 ((/= (match-beginning 10) (match-end 10))
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
1587 (buffer-substring (match-beginning 10)
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
1588 (match-end 10)))
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
1589 (t "EST"))
1dba066c1e0a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 1078
diff changeset
1590 "\n"))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1591 ;; Keep and reformat the sender if we don't
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1592 ;; have a From: field.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1593 (if has-from
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1594 ""
4340
505fb5222dea (rmail-nuke-pinhead-header): Tell replace-match not to alter the case.
Richard M. Stallman <rms@gnu.org>
parents: 4332
diff changeset
1595 "From: \\1\n"))
505fb5222dea (rmail-nuke-pinhead-header): Tell replace-match not to alter the case.
Richard M. Stallman <rms@gnu.org>
parents: 4332
diff changeset
1596 t)))))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1597
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1598 ;;;; *** Rmail Message Formatting and Header Manipulation ***
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1599
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1600 (defun rmail-reformat-message (beg end)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1601 (goto-char beg)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1602 (forward-line 1)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1603 (if (/= (following-char) ?0)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1604 (error "Bad format in RMAIL file."))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1605 (let ((buffer-read-only nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1606 (delta (- (buffer-size) end)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1607 (delete-char 1)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1608 (insert ?1)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1609 (forward-line 1)
4340
505fb5222dea (rmail-nuke-pinhead-header): Tell replace-match not to alter the case.
Richard M. Stallman <rms@gnu.org>
parents: 4332
diff changeset
1610 (let ((case-fold-search t))
4838
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
1611 (while (looking-at "Summary-line:\\|Mail-From:")
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
1612 (forward-line 1)))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1613 (if (looking-at "\\*\\*\\* EOOH \\*\\*\\*\n")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1614 (delete-region (point)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1615 (progn (forward-line 1) (point))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1616 (let ((str (buffer-substring (point)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1617 (save-excursion (search-forward "\n\n" end 'move)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1618 (point)))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1619 (insert str "*** EOOH ***\n")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1620 (narrow-to-region (point) (- (buffer-size) delta)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1621 (goto-char (point-min))
9062
1f55bc3c629e (rmail-reformat-message): Run mail-message-filter
Richard M. Stallman <rms@gnu.org>
parents: 9010
diff changeset
1622 (if rmail-message-filter (funcall rmail-message-filter))
11452
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1623 (if (or rmail-displayed-headers rmail-ignored-headers)
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1624 (rmail-clear-headers))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1625
9010
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
1626 (defun rmail-clear-headers (&optional ignored-headers)
11452
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1627 "Delete all header fields that Rmail should not show.
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1628 If the optional argument IGNORED-HEADERS is non-nil,
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1629 delete all header fields whose names match that regexp.
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1630 Otherwise, if `rmail-displayed-headers' is non-nil,
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1631 delete all header fields *except* those whose names match that regexp.
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1632 Otherwise, delete all header fields whose names match `rmail-ignored-headers'."
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1633 (if (search-forward "\n\n" nil t)
14680
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1634 (let ((case-fold-search t)
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1635 (buffer-read-only nil))
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1636 (if (and rmail-displayed-headers (null ignored-headers))
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1637 (save-restriction
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1638 (narrow-to-region (point-min) (point))
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1639 (let (lim)
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1640 (goto-char (point-min))
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1641 (while (save-excursion
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1642 (re-search-forward "\n[^ \t]")
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1643 (and (not (eobp))
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1644 (setq lim (1- (point)))))
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1645 (if (save-excursion
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1646 (re-search-forward rmail-displayed-headers lim t))
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1647 (goto-char lim)
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1648 (delete-region (point) lim))))
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1649 (goto-char (point-min)))
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1650 (or ignored-headers (setq ignored-headers rmail-ignored-headers))
11452
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1651 (save-restriction
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1652 (narrow-to-region (point-min) (point))
14680
8aa0ac31ba8a (rmail-clear-headers): Bind case-fold-search to t across the whole function.
Erik Naggum <erik@naggum.no>
parents: 14639
diff changeset
1653 (while (progn
11452
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1654 (goto-char (point-min))
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1655 (re-search-forward ignored-headers nil t))
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1656 (beginning-of-line)
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1657 (delete-region (point)
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1658 (progn (re-search-forward "\n[^ \t]")
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1659 (1- (point))))))))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1660
16772
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1661 (defun rmail-msg-is-pruned ()
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1662 (rmail-maybe-set-message-counters)
16772
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1663 (save-restriction
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1664 (save-excursion
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1665 (narrow-to-region (rmail-msgbeg rmail-current-message) (point-max))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1666 (goto-char (point-min))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1667 (forward-line 1)
16772
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1668 (= (following-char) ?1))))
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1669
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1670 (defun rmail-toggle-header (&optional arg)
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1671 "Show original message header if pruned header currently shown, or vice versa.
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1672 With argument ARG, show the message header pruned if ARG is greater than zero;
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1673 otherwise, show it in full."
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1674 (interactive "P")
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1675 (let* ((buffer-read-only nil)
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1676 (pruned (rmail-msg-is-pruned))
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1677 (prune (if arg
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1678 (> (prefix-numeric-value arg) 0)
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1679 (not pruned))))
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1680 (if (eq pruned prune)
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1681 t
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1682 (rmail-maybe-set-message-counters)
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1683 (narrow-to-region (rmail-msgbeg rmail-current-message) (point-max))
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1684 (if pruned
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1685 (progn (goto-char (point-min))
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1686 (forward-line 1)
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1687 (delete-char 1)
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1688 (insert ?0)
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1689 (forward-line 1)
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1690 (let ((case-fold-search t))
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1691 (while (looking-at "Summary-Line:\\|Mail-From:")
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1692 (forward-line 1)))
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1693 (insert "*** EOOH ***\n")
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1694 (forward-char -1)
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1695 (search-forward "\n*** EOOH ***\n")
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1696 (forward-line -1)
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1697 (let ((temp (point)))
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1698 (and (search-forward "\n\n" nil t)
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1699 (delete-region temp (point))))
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1700 (goto-char (point-min))
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1701 (search-forward "\n*** EOOH ***\n")
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1702 (narrow-to-region (point) (point-max)))
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1703 (rmail-reformat-message (point-min) (point-max)))
ce2945525699 (rmail-msg-is-pruned): New function.
Richard M. Stallman <rms@gnu.org>
parents: 16633
diff changeset
1704 (rmail-highlight-headers))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1705
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1706 ;;;; *** Rmail Attributes and Keywords ***
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1707
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1708 ;; Make a string describing current message's attributes and keywords
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1709 ;; and set it up as the name of a minor mode
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1710 ;; so it will appear in the mode line.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1711 (defun rmail-display-labels ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1712 (let ((blurb "") (beg (point-min-marker)) (end (point-max-marker)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1713 (save-excursion
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1714 (unwind-protect
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1715 (progn
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1716 (widen)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1717 (goto-char (rmail-msgbeg rmail-current-message))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1718 (forward-line 1)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1719 (if (looking-at "[01],")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1720 (progn
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1721 (narrow-to-region (point) (progn (end-of-line) (point)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1722 ;; Truly valid BABYL format requires a space before each
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1723 ;; attribute or keyword name. Put them in if missing.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1724 (let (buffer-read-only)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1725 (goto-char (point-min))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1726 (while (search-forward "," nil t)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1727 (or (looking-at "[ ,]") (eobp)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1728 (insert " "))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1729 (goto-char (point-max))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1730 (if (search-backward ",," nil 'move)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1731 (progn
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1732 (if (> (point) (1+ (point-min)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1733 (setq blurb (buffer-substring (+ 1 (point-min)) (point))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1734 (if (> (- (point-max) (point)) 2)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1735 (setq blurb
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1736 (concat blurb
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1737 ";"
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1738 (buffer-substring (+ (point) 3)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1739 (1- (point-max)))))))))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1740 ;; Note: we don't use save-restriction because that does not work right
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1741 ;; if changes are made outside the saved restriction
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1742 ;; before that restriction is restored.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1743 (narrow-to-region beg end)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1744 (set-marker beg nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1745 (set-marker end nil)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1746 (while (string-match " +," blurb)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1747 (setq blurb (concat (substring blurb 0 (match-beginning 0)) ","
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1748 (substring blurb (match-end 0)))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1749 (while (string-match ", +" blurb)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1750 (setq blurb (concat (substring blurb 0 (match-beginning 0)) ","
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1751 (substring blurb (match-end 0)))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1752 (setq mode-line-process
11452
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1753 (format " %d/%d%s"
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
1754 rmail-current-message rmail-total-messages blurb))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1755
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1756 ;; Turn an attribute of a message on or off according to STATE.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1757 ;; ATTR is the name of the attribute, as a string.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1758 ;; MSGNUM is message number to change; nil means current message.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1759 (defun rmail-set-attribute (attr state &optional msgnum)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1760 (let ((omax (point-max-marker))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1761 (omin (point-min-marker))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1762 (buffer-read-only nil))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1763 (or msgnum (setq msgnum rmail-current-message))
5047
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1764 (if (> msgnum 0)
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1765 (unwind-protect
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1766 (save-excursion
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1767 (widen)
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1768 (goto-char (+ 3 (rmail-msgbeg msgnum)))
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1769 (let ((curstate
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1770 (not
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1771 (null (search-backward (concat ", " attr ",")
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1772 (prog1 (point) (end-of-line)) t)))))
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1773 (or (eq curstate (not (not state)))
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1774 (if curstate
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1775 (delete-region (point) (1- (match-end 0)))
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1776 (beginning-of-line)
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1777 (forward-char 2)
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1778 (insert " " attr ","))))
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1779 (if (string= attr "deleted")
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1780 (rmail-set-message-deleted-p msgnum state)))
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1781 ;; Note: we don't use save-restriction because that does not work right
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1782 ;; if changes are made outside the saved restriction
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1783 ;; before that restriction is restored.
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1784 (narrow-to-region omin omax)
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1785 (set-marker omin nil)
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1786 (set-marker omax nil)
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1787 (if (= msgnum rmail-current-message)
1ada11e2d89a (rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents: 4969
diff changeset
1788 (rmail-display-labels))))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1789
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1790 ;; Return t if the attributes/keywords line of msg number MSG
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1791 ;; contains a match for the regexp LABELS.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1792 (defun rmail-message-labels-p (msg labels)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1793 (save-excursion
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1794 (save-restriction
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1795 (widen)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1796 (goto-char (rmail-msgbeg msg))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1797 (forward-char 3)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1798 (re-search-backward labels (prog1 (point) (end-of-line)) t))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1799
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1800 ;;;; *** Rmail Message Selection And Support ***
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1801
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1802 (defun rmail-msgend (n)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1803 (marker-position (aref rmail-message-vector (1+ n))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1804
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1805 (defun rmail-msgbeg (n)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1806 (marker-position (aref rmail-message-vector n)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1807
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1808 (defun rmail-widen-to-current-msgbeg (function)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1809 "Call FUNCTION with point at start of internal data of current message.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1810 Assumes that bounds were previously narrowed to display the message in Rmail.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1811 The bounds are widened enough to move point where desired, then narrowed
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1812 again afterward.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1813
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1814 FUNCTION may not change the visible text of the message, but it may
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1815 change the invisible header text."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1816 (save-excursion
344
057b6b26930e *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 280
diff changeset
1817 (let ((obeg (- (point-max) (point-min))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1818 (unwind-protect
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1819 (progn
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1820 (narrow-to-region (rmail-msgbeg rmail-current-message)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1821 (point-max))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1822 (goto-char (point-min))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1823 (funcall function))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1824 ;; Note: we don't use save-restriction because that does not work right
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1825 ;; if changes are made outside the saved restriction
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1826 ;; before that restriction is restored.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1827 ;; Here we assume that changes made by FUNCTION
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1828 ;; occur before the visible region of the message.
344
057b6b26930e *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 280
diff changeset
1829 (narrow-to-region (- (point-max) obeg) (point-max))))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1830
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1831 (defun rmail-forget-messages ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1832 (unwind-protect
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1833 (if (vectorp rmail-message-vector)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1834 (let* ((i 0)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1835 (v rmail-message-vector)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1836 (n (length v)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1837 (while (< i n)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1838 (move-marker (aref v i) nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1839 (setq i (1+ i)))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1840 (setq rmail-message-vector nil)
17620
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
1841 (setq rmail-msgref-vector nil)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1842 (setq rmail-deleted-vector nil)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1843
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1844 (defun rmail-maybe-set-message-counters ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1845 (if (not (and rmail-deleted-vector
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1846 rmail-message-vector
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1847 rmail-current-message
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1848 rmail-total-messages))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1849 (rmail-set-message-counters)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1850
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1851 (defun rmail-count-new-messages (&optional nomsg)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1852 (let* ((case-fold-search nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1853 (total-messages 0)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1854 (messages-head nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1855 (deleted-head nil))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1856 (or nomsg (message "Counting new messages..."))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1857 (goto-char (point-max))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1858 ;; Put at the end of messages-head
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1859 ;; the entry for message N+1, which marks
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1860 ;; the end of message N. (N = number of messages).
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1861 (search-backward "\n\^_")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1862 (forward-char 1)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1863 (setq messages-head (list (point-marker)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1864 (rmail-set-message-counters-counter (point-min))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1865 (setq rmail-current-message (1+ rmail-total-messages))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1866 (setq rmail-total-messages
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1867 (+ rmail-total-messages total-messages))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1868 (setq rmail-message-vector
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1869 (vconcat rmail-message-vector (cdr messages-head)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1870 (aset rmail-message-vector
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1871 rmail-current-message (car messages-head))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1872 (setq rmail-deleted-vector
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1873 (concat rmail-deleted-vector deleted-head))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1874 (setq rmail-summary-vector
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1875 (vconcat rmail-summary-vector (make-vector total-messages nil)))
17620
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
1876 (setq rmail-msgref-vector
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
1877 (vconcat rmail-msgref-vector (make-vector total-messages nil)))
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
1878 ;; Fill in the new elements of rmail-msgref-vector.
17640
bd31032a2940 (rmail-count-new-messages): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 17630
diff changeset
1879 (let ((i (1+ (- rmail-total-messages total-messages))))
17620
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
1880 (while (<= i rmail-total-messages)
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
1881 (aset rmail-msgref-vector i (list i))
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
1882 (setq i (1+ i))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1883 (goto-char (point-min))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1884 (or nomsg (message "Counting new messages...done (%d)" total-messages))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1885
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1886 (defun rmail-set-message-counters ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1887 (rmail-forget-messages)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1888 (save-excursion
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1889 (save-restriction
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1890 (widen)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1891 (let* ((point-save (point))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1892 (total-messages 0)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1893 (messages-after-point)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1894 (case-fold-search nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1895 (messages-head nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1896 (deleted-head nil))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1897 (message "Counting messages...")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1898 (goto-char (point-max))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1899 ;; Put at the end of messages-head
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1900 ;; the entry for message N+1, which marks
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1901 ;; the end of message N. (N = number of messages).
5586
fdf1d3924296 (rmail-bury): Rename local rmail-buffer to buffer-to-bury.
Richard M. Stallman <rms@gnu.org>
parents: 5470
diff changeset
1902 (search-backward "\n\^_" nil t)
fdf1d3924296 (rmail-bury): Rename local rmail-buffer to buffer-to-bury.
Richard M. Stallman <rms@gnu.org>
parents: 5470
diff changeset
1903 (if (/= (point) (point-max)) (forward-char 1))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1904 (setq messages-head (list (point-marker)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1905 (rmail-set-message-counters-counter (min (point) point-save))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1906 (setq messages-after-point total-messages)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1907 (rmail-set-message-counters-counter)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1908 (setq rmail-total-messages total-messages)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1909 (setq rmail-current-message
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1910 (min total-messages
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1911 (max 1 (- total-messages messages-after-point))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1912 (setq rmail-message-vector
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1913 (apply 'vector (cons (point-min-marker) messages-head))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1914 rmail-deleted-vector (concat "D" deleted-head)
17620
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
1915 rmail-summary-vector (make-vector rmail-total-messages nil)
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
1916 rmail-msgref-vector (make-vector (1+ rmail-total-messages) nil))
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
1917 (let ((i 0))
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
1918 (while (<= i rmail-total-messages)
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
1919 (aset rmail-msgref-vector i (list i))
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
1920 (setq i (1+ i))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1921 (message "Counting messages...done")))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1922
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1923 (defun rmail-set-message-counters-counter (&optional stop)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1924 (while (search-backward "\n\^_\^L\n" stop t)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1925 (forward-char 1)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1926 (setq messages-head (cons (point-marker) messages-head))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1927 (save-excursion
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1928 (setq deleted-head
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1929 (cons (if (search-backward ", deleted,"
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1930 (prog1 (point)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1931 (forward-line 2))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1932 t)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1933 ?D ?\ )
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1934 deleted-head)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1935 (if (zerop (% (setq total-messages (1+ total-messages)) 20))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1936 (message "Counting messages...%d" total-messages))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1937
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1938 (defun rmail-beginning-of-message ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1939 "Show current message starting from the beginning."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1940 (interactive)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1941 (rmail-show-message rmail-current-message))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1942
9431
65e65fe6e8f3 (rmail-show-message): New argument no-summary.
Richard M. Stallman <rms@gnu.org>
parents: 9394
diff changeset
1943 (defun rmail-show-message (&optional n no-summary)
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1944 "Show message number N (prefix argument), counting from start of file.
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1945 If summary buffer is currently displayed, update current message there also."
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1946 (interactive "p")
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1947 (or (eq major-mode 'rmail-mode)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1948 (switch-to-buffer rmail-buffer))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1949 (rmail-maybe-set-message-counters)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1950 (widen)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1951 (if (zerop rmail-total-messages)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1952 (progn (narrow-to-region (point-min) (1- (point-max)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1953 (goto-char (point-min))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1954 (setq mode-line-process nil))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1955 (let (blurb)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1956 (if (not n)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1957 (setq n rmail-current-message)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1958 (cond ((<= n 0)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1959 (setq n 1
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1960 rmail-current-message 1
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1961 blurb "No previous message"))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1962 ((> n rmail-total-messages)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1963 (setq n rmail-total-messages
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1964 rmail-current-message rmail-total-messages
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1965 blurb "No following message"))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1966 (t
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1967 (setq rmail-current-message n))))
16241
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1968 (let ((beg (rmail-msgbeg n)))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1969 (goto-char beg)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1970 (forward-line 1)
16241
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1971 ;; Clear the "unseen" attribute when we show a message.
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1972 (rmail-set-attribute "unseen" nil)
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1973 ;; Reformat the header, or else find the reformatted header.
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1974 (let ((end (rmail-msgend n)))
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1975 (if (= (following-char) ?0)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1976 (rmail-reformat-message beg end)
16241
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1977 (search-forward "\n*** EOOH ***\n" end t)
3c84b8d28902 (rmail-insert-inbox-text): Detect locked
Richard M. Stallman <rms@gnu.org>
parents: 15879
diff changeset
1978 (narrow-to-region (point) end)))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1979 (goto-char (point-min))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1980 (rmail-display-labels)
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1981 (if (eq rmail-enable-mime t)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1982 (funcall rmail-show-mime-function)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1983 (setq rmail-view-buffer rmail-buffer)
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
1984 )
7084
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
1985 (rmail-highlight-headers)
7696
ebcefadd2e1b (rmail-show-message): If transient-mark-mode, deactivate the mark.
Richard M. Stallman <rms@gnu.org>
parents: 7563
diff changeset
1986 (if transient-mark-mode (deactivate-mark))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1987 (run-hooks 'rmail-show-message-hook)
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1988 ;; If there is a summary buffer, try to move to this message
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1989 ;; in that buffer. But don't complain if this message
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
1990 ;; is not mentioned in the summary.
9431
65e65fe6e8f3 (rmail-show-message): New argument no-summary.
Richard M. Stallman <rms@gnu.org>
parents: 9394
diff changeset
1991 ;; Don't do this at all if we were called on behalf
65e65fe6e8f3 (rmail-show-message): New argument no-summary.
Richard M. Stallman <rms@gnu.org>
parents: 9394
diff changeset
1992 ;; of cursor motion in the summary buffer.
65e65fe6e8f3 (rmail-show-message): New argument no-summary.
Richard M. Stallman <rms@gnu.org>
parents: 9394
diff changeset
1993 (and (rmail-summary-exists) (not no-summary)
65e65fe6e8f3 (rmail-show-message): New argument no-summary.
Richard M. Stallman <rms@gnu.org>
parents: 9394
diff changeset
1994 (let ((curr-msg rmail-current-message))
65e65fe6e8f3 (rmail-show-message): New argument no-summary.
Richard M. Stallman <rms@gnu.org>
parents: 9394
diff changeset
1995 (rmail-select-summary
65e65fe6e8f3 (rmail-show-message): New argument no-summary.
Richard M. Stallman <rms@gnu.org>
parents: 9394
diff changeset
1996 (rmail-summary-goto-msg curr-msg t t))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1997 (if blurb
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1998 (message blurb))))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
1999
7084
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2000 ;; Find all occurrences of certain fields, and highlight them.
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2001 (defun rmail-highlight-headers ()
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2002 ;; Do this only if the system supports faces.
8094
d9c6c2429f85 (rmail-highlight-headers): Do nothing if
Richard M. Stallman <rms@gnu.org>
parents: 7955
diff changeset
2003 (if (and (fboundp 'internal-find-face)
d9c6c2429f85 (rmail-highlight-headers): Do nothing if
Richard M. Stallman <rms@gnu.org>
parents: 7955
diff changeset
2004 rmail-highlighted-headers)
7084
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2005 (save-excursion
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2006 (search-forward "\n\n" nil 'move)
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2007 (save-restriction
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2008 (narrow-to-region (point-min) (point))
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2009 (let ((case-fold-search t)
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2010 (inhibit-read-only t)
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2011 ;; Highlight with boldface if that is available.
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2012 ;; Otherwise use the `highlight' face.
8383
d2b1b642f4e6 (rmail-highlighted-face): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 8378
diff changeset
2013 (face (or rmail-highlight-face
d2b1b642f4e6 (rmail-highlighted-face): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 8378
diff changeset
2014 (if (face-differs-from-default-p 'bold)
d2b1b642f4e6 (rmail-highlighted-face): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 8378
diff changeset
2015 'bold 'highlight)))
7084
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2016 ;; List of overlays to reuse.
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2017 (overlays rmail-overlay-list))
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2018 (goto-char (point-min))
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2019 (while (re-search-forward rmail-highlighted-headers nil t)
7955
a03d7bdee306 (rmail-highlight-headers): Don't skip newlines, just tab and space.
Richard M. Stallman <rms@gnu.org>
parents: 7696
diff changeset
2020 (skip-chars-forward " \t")
7084
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2021 (let ((beg (point))
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2022 overlay)
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2023 (while (progn (forward-line 1)
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2024 (looking-at "[ \t]")))
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2025 ;; Back up over newline, then trailing spaces or tabs
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2026 (forward-char -1)
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2027 (while (member (preceding-char) '(? ?\t))
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2028 (forward-char -1))
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2029 (if overlays
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2030 ;; Reuse an overlay we already have.
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2031 (progn
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2032 (setq overlay (car overlays)
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2033 overlays (cdr overlays))
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2034 (overlay-put overlay 'face face)
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2035 (move-overlay overlay beg (point)))
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2036 ;; Make a new overlay and add it to
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2037 ;; rmail-overlay-list.
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2038 (setq overlay (make-overlay beg (point)))
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2039 (overlay-put overlay 'face face)
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2040 (setq rmail-overlay-list
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2041 (cons overlay rmail-overlay-list))))))))))
5ceea5b326b6 (rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Karl Heuer <kwzh@gnu.org>
parents: 7065
diff changeset
2042
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2043 (defun rmail-next-message (n)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2044 "Show following message whether deleted or not.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2045 With prefix arg N, moves forward N messages, or backward if N is negative."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2046 (interactive "p")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2047 (rmail-maybe-set-message-counters)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2048 (rmail-show-message (+ rmail-current-message n)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2049
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2050 (defun rmail-previous-message (n)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2051 "Show previous message whether deleted or not.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2052 With prefix arg N, moves backward N messages, or forward if N is negative."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2053 (interactive "p")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2054 (rmail-next-message (- n)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2055
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2056 (defun rmail-next-undeleted-message (n)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2057 "Show following non-deleted message.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2058 With prefix arg N, moves forward N non-deleted messages,
4838
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2059 or backward if N is negative.
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2060
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2061 Returns t if a new message is being shown, nil otherwise."
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2062 (interactive "p")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2063 (rmail-maybe-set-message-counters)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2064 (let ((lastwin rmail-current-message)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2065 (current rmail-current-message))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2066 (while (and (> n 0) (< current rmail-total-messages))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2067 (setq current (1+ current))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2068 (if (not (rmail-message-deleted-p current))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2069 (setq lastwin current n (1- n))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2070 (while (and (< n 0) (> current 1))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2071 (setq current (1- current))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2072 (if (not (rmail-message-deleted-p current))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2073 (setq lastwin current n (1+ n))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2074 (if (/= lastwin rmail-current-message)
4838
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2075 (progn (rmail-show-message lastwin)
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2076 t)
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2077 (if (< n 0)
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2078 (message "No previous nondeleted message"))
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2079 (if (> n 0)
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2080 (message "No following nondeleted message"))
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2081 nil)))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2082
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2083 (defun rmail-previous-undeleted-message (n)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2084 "Show previous non-deleted message.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2085 With prefix argument N, moves backward N non-deleted messages,
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2086 or forward if N is negative."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2087 (interactive "p")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2088 (rmail-next-undeleted-message (- n)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2089
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2090 (defun rmail-first-message ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2091 "Show first message in file."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2092 (interactive)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2093 (rmail-maybe-set-message-counters)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2094 (rmail-show-message 1))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2095
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2096 (defun rmail-last-message ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2097 "Show last message in file."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2098 (interactive)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2099 (rmail-maybe-set-message-counters)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2100 (rmail-show-message rmail-total-messages))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2101
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2102 (defun rmail-what-message ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2103 (let ((where (point))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2104 (low 1)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2105 (high rmail-total-messages)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2106 (mid (/ rmail-total-messages 2)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2107 (while (> (- high low) 1)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2108 (if (>= where (rmail-msgbeg mid))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2109 (setq low mid)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2110 (setq high mid))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2111 (setq mid (+ low (/ (- high low) 2))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2112 (if (>= where (rmail-msgbeg high)) high low)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2113
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2114 (defun rmail-message-recipients-p (msg recipients &optional primary-only)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2115 (save-restriction
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2116 (goto-char (rmail-msgbeg msg))
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2117 (search-forward "\n*** EOOH ***\n")
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2118 (narrow-to-region (point) (progn (search-forward "\n\n") (point)))
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2119 (or (string-match recipients (or (mail-fetch-field "To") ""))
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2120 (string-match recipients (or (mail-fetch-field "From") ""))
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2121 (if (not primary-only)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2122 (string-match recipients (or (mail-fetch-field "Cc") ""))))))
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2123
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2124 (defun rmail-message-regexp-p (msg regexp)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2125 "Return t, if for message number MSG, regexp REGEXP matches in the header."
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2126 (goto-char (rmail-msgbeg msg))
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2127 (let ((end
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2128 (save-excursion
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2129 (search-forward "*** EOOH ***" (point-max)) (point))))
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2130 (re-search-forward regexp end t)))
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2131
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2132 (defvar rmail-search-last-regexp nil)
874
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2133 (defun rmail-search (regexp &optional n)
13808
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2134 "Show message containing next match for REGEXP (but not the current msg).
874
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2135 Prefix argument gives repeat count; negative argument means search
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2136 backwards (through earlier messages).
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2137 Interactively, empty argument means use same regexp used last time."
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2138 (interactive
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2139 (let* ((reversep (< (prefix-numeric-value current-prefix-arg) 0))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2140 (prompt
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2141 (concat (if reversep "Reverse " "") "Rmail search (regexp): "))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2142 regexp)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2143 (if rmail-search-last-regexp
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2144 (setq prompt (concat prompt
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2145 "(default "
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2146 rmail-search-last-regexp
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2147 ") ")))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2148 (setq regexp (read-string prompt))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2149 (cond ((not (equal regexp ""))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2150 (setq rmail-search-last-regexp regexp))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2151 ((not rmail-search-last-regexp)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2152 (error "No previous Rmail search string")))
874
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2153 (list rmail-search-last-regexp
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2154 (prefix-numeric-value current-prefix-arg))))
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2155 (or n (setq n 1))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2156 (message "%sRmail search for %s..."
937
0f082d63bfd6 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 874
diff changeset
2157 (if (< n 0) "Reverse " "")
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2158 regexp)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2159 (rmail-maybe-set-message-counters)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2160 (let ((omin (point-min))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2161 (omax (point-max))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2162 (opoint (point))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2163 win
874
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2164 (reversep (< n 0))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2165 (msg rmail-current-message))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2166 (unwind-protect
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2167 (progn
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2168 (widen)
874
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2169 (while (/= n 0)
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2170 ;; Check messages one by one, advancing message number up or down
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2171 ;; but searching forward through each message.
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2172 (if reversep
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2173 (while (and (null win) (> msg 1))
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2174 (goto-char (rmail-msgbeg (setq msg (1- msg))))
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2175 (setq win (re-search-forward
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2176 regexp (rmail-msgend msg) t)))
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2177 (while (and (null win) (< msg rmail-total-messages))
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2178 (goto-char (rmail-msgbeg (setq msg (1+ msg))))
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2179 (setq win (re-search-forward regexp (rmail-msgend msg) t))))
937
0f082d63bfd6 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 874
diff changeset
2180 (setq n (+ n (if reversep 1 -1)))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2181 (if win
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2182 (progn
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2183 ;; If this is a reverse search and we found a message,
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2184 ;; search backward thru this message to position point.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2185 (if reversep
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2186 (progn
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2187 (goto-char (rmail-msgend msg))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2188 (re-search-backward
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2189 regexp (rmail-msgbeg msg) t)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2190 (setq win (point))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2191 (rmail-show-message msg)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2192 (message "%sRmail search for %s...done"
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2193 (if reversep "Reverse " "")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2194 regexp)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2195 (goto-char win))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2196 (goto-char opoint)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2197 (narrow-to-region omin omax)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2198 (ding)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2199 (message "Search failed: %s" regexp)))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2200
874
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2201 (defun rmail-search-backwards (regexp &optional n)
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2202 "Show message containing previous match for REGEXP.
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2203 Prefix argument gives repeat count; negative argument means search
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2204 forward (through later messages).
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2205 Interactively, empty argument means use same regexp used last time."
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2206 (interactive
937
0f082d63bfd6 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 874
diff changeset
2207 (let* ((reversep (>= (prefix-numeric-value current-prefix-arg) 0))
874
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2208 (prompt
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2209 (concat (if reversep "Reverse " "") "Rmail search (regexp): "))
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2210 regexp)
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2211 (if rmail-search-last-regexp
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2212 (setq prompt (concat prompt
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2213 "(default "
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2214 rmail-search-last-regexp
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2215 ") ")))
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2216 (setq regexp (read-string prompt))
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2217 (cond ((not (equal regexp ""))
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2218 (setq rmail-search-last-regexp regexp))
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2219 ((not rmail-search-last-regexp)
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2220 (error "No previous Rmail search string")))
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2221 (list rmail-search-last-regexp
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2222 (prefix-numeric-value current-prefix-arg))))
12198
74afe5e734a8 (rmail-search-backwards): Default count is 1, not -1.
Karl Heuer <kwzh@gnu.org>
parents: 11552
diff changeset
2223 (rmail-search regexp (- (or n 1))))
874
b945f592b94d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
2224
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2225 ;; Show the first message which has the `unseen' attribute.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2226 (defun rmail-first-unseen-message ()
1360
9cb1a4b90b5c Cleaned up rmail-first-unseen-message.
Joseph Arceneaux <jla@gnu.org>
parents: 1342
diff changeset
2227 (rmail-maybe-set-message-counters)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2228 (let ((current 1)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2229 found)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2230 (save-restriction
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2231 (widen)
10191
f81679f84f68 (rmail-first-unseen-message): Fix 1-off error.
Richard M. Stallman <rms@gnu.org>
parents: 10187
diff changeset
2232 (while (and (not found) (<= current rmail-total-messages))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2233 (if (rmail-message-labels-p current ", ?\\(unseen\\),")
346
52cd078baf00 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 344
diff changeset
2234 (setq found current))
52cd078baf00 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 344
diff changeset
2235 (setq current (1+ current))))
1342
776d4c59f256 * rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents: 1267
diff changeset
2236 ;; Let the caller show the message.
776d4c59f256 * rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents: 1267
diff changeset
2237 ;; (if found
776d4c59f256 * rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents: 1267
diff changeset
2238 ;; (rmail-show-message found))
776d4c59f256 * rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents: 1267
diff changeset
2239 found))
10662
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2240
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2241 (defun rmail-next-same-subject (n)
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2242 "Go to the next mail message having the same subject header.
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2243 With prefix argument N, do this N times.
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2244 If N is negative, go backwards instead."
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2245 (interactive "p")
15746
d7a83c7ea12a (rmail-next-same-subject): Don't set search-regexp
Karl Heuer <kwzh@gnu.org>
parents: 15549
diff changeset
2246 (let ((subject (mail-fetch-field "Subject"))
d7a83c7ea12a (rmail-next-same-subject): Don't set search-regexp
Karl Heuer <kwzh@gnu.org>
parents: 15549
diff changeset
2247 (forward (> n 0))
d7a83c7ea12a (rmail-next-same-subject): Don't set search-regexp
Karl Heuer <kwzh@gnu.org>
parents: 15549
diff changeset
2248 (i rmail-current-message)
17065
01cba1834368 (rmail-next-same-subject, rmail-reply): Ignore case, to
Karl Heuer <kwzh@gnu.org>
parents: 17011
diff changeset
2249 (case-fold-search t)
15746
d7a83c7ea12a (rmail-next-same-subject): Don't set search-regexp
Karl Heuer <kwzh@gnu.org>
parents: 15549
diff changeset
2250 search-regexp found)
d7a83c7ea12a (rmail-next-same-subject): Don't set search-regexp
Karl Heuer <kwzh@gnu.org>
parents: 15549
diff changeset
2251 (if (string-match "Re:[ \t]*" subject)
d7a83c7ea12a (rmail-next-same-subject): Don't set search-regexp
Karl Heuer <kwzh@gnu.org>
parents: 15549
diff changeset
2252 (setq subject (substring subject (match-end 0))))
d7a83c7ea12a (rmail-next-same-subject): Don't set search-regexp
Karl Heuer <kwzh@gnu.org>
parents: 15549
diff changeset
2253 (setq search-regexp (concat "^Subject: *\\(Re: *\\)?"
10662
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2254 (regexp-quote subject)
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2255 "\n"))
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2256 (save-excursion
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2257 (save-restriction
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2258 (widen)
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2259 (while (and (/= n 0)
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2260 (if forward
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2261 (< i rmail-total-messages)
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2262 (> i 1)))
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2263 (let (done)
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2264 (while (and (not done)
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2265 (if forward
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2266 (< i rmail-total-messages)
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2267 (> i 1)))
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2268 (setq i (if forward (1+ i) (1- i)))
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2269 (goto-char (rmail-msgbeg i))
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2270 (search-forward "\n*** EOOH ***\n")
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2271 (let ((beg (point)) end)
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2272 (search-forward "\n\n")
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2273 (setq end (point))
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2274 (goto-char beg)
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2275 (setq done (re-search-forward search-regexp end t))))
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2276 (if done (setq found i)))
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2277 (setq n (if forward (1- n) (1+ n))))))
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2278 (if found
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2279 (rmail-show-message found)
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2280 (error "No %s message with same subject"
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2281 (if forward "following" "previous")))))
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2282
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2283 (defun rmail-previous-same-subject (n)
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2284 "Go to the previous mail message having the same subject header.
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2285 With prefix argument N, do this N times.
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2286 If N is negative, go forwards instead."
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2287 (interactive "p")
cd968ab6a0eb (rmail-next-same-subject): New command.
Richard M. Stallman <rms@gnu.org>
parents: 10640
diff changeset
2288 (rmail-next-same-subject (- n)))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2289
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2290 ;;;; *** Rmail Message Deletion Commands ***
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2291
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2292 (defun rmail-message-deleted-p (n)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2293 (= (aref rmail-deleted-vector n) ?D))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2294
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2295 (defun rmail-set-message-deleted-p (n state)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2296 (aset rmail-deleted-vector n (if state ?D ?\ )))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2297
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2298 (defun rmail-delete-message ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2299 "Delete this message and stay on it."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2300 (interactive)
13477
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
2301 (rmail-set-attribute "deleted" t)
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
2302 (run-hooks 'rmail-delete-message-hook))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2303
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2304 (defun rmail-undelete-previous-message ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2305 "Back up to deleted message, select it, and undelete it."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2306 (interactive)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2307 (let ((msg rmail-current-message))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2308 (while (and (> msg 0)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2309 (not (rmail-message-deleted-p msg)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2310 (setq msg (1- msg)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2311 (if (= msg 0)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2312 (error "No previous deleted message")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2313 (if (/= msg rmail-current-message)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2314 (rmail-show-message msg))
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2315 (rmail-set-attribute "deleted" nil)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2316 (if (rmail-summary-exists)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2317 (save-excursion
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2318 (set-buffer rmail-summary-buffer)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2319 (rmail-summary-mark-undeleted msg)))
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2320 (rmail-maybe-display-summary))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2321
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2322 (defun rmail-delete-forward (&optional backward)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2323 "Delete this message and move to next nondeleted one.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2324 Deleted messages stay in the file until the \\[rmail-expunge] command is given.
4838
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2325 With prefix argument, delete and move backward.
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2326
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2327 Returns t if a new message is displayed after the delete, or nil otherwise."
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2328 (interactive "P")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2329 (rmail-set-attribute "deleted" t)
13477
5c500f39271c (rmail-delete-message-hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 13302
diff changeset
2330 (run-hooks 'rmail-delete-message-hook)
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2331 (let ((del-msg rmail-current-message))
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2332 (if (rmail-summary-exists)
9394
802381617d14 (rmail-delete-forward): Use rmail-select-summary.
Richard M. Stallman <rms@gnu.org>
parents: 9380
diff changeset
2333 (rmail-select-summary
802381617d14 (rmail-delete-forward): Use rmail-select-summary.
Richard M. Stallman <rms@gnu.org>
parents: 9380
diff changeset
2334 (rmail-summary-mark-deleted del-msg)))
4838
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2335 (prog1 (rmail-next-undeleted-message (if backward -1 1))
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2336 (rmail-maybe-display-summary))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2337
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2338 (defun rmail-delete-backward ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2339 "Delete this message and move to previous nondeleted one.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2340 Deleted messages stay in the file until the \\[rmail-expunge] command is given."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2341 (interactive)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2342 (rmail-delete-forward t))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2343
9153
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2344 ;; Compute the message number a given message would have after expunging.
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2345 ;; The present number of the message is OLDNUM.
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2346 ;; DELETEDVEC should be rmail-deleted-vector.
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2347 ;; The value is nil for a message that would be deleted.
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2348 (defun rmail-msg-number-after-expunge (deletedvec oldnum)
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2349 (if (or (null oldnum) (= (aref deletedvec oldnum) ?D))
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2350 nil
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2351 (let ((i 0)
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2352 (newnum 0))
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2353 (while (< i oldnum)
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2354 (if (/= (aref deletedvec i) ?D)
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2355 (setq newnum (1+ newnum)))
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2356 (setq i (1+ i)))
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2357 newnum)))
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2358
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2359 (defun rmail-only-expunge ()
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2360 "Actually erase all deleted messages in the file."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2361 (interactive)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2362 (message "Expunging deleted messages...")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2363 ;; Discard all undo records for this buffer.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2364 (or (eq buffer-undo-list t)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2365 (setq buffer-undo-list nil))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2366 (rmail-maybe-set-message-counters)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2367 (let* ((omax (- (buffer-size) (point-max)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2368 (omin (- (buffer-size) (point-min)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2369 (opoint (if (and (> rmail-current-message 0)
7037
c205795eecc6 Cosmetic changes.
Karl Heuer <kwzh@gnu.org>
parents: 6727
diff changeset
2370 (rmail-message-deleted-p rmail-current-message))
c205795eecc6 Cosmetic changes.
Karl Heuer <kwzh@gnu.org>
parents: 6727
diff changeset
2371 0
c205795eecc6 Cosmetic changes.
Karl Heuer <kwzh@gnu.org>
parents: 6727
diff changeset
2372 (- (point) (point-min))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2373 (messages-head (cons (aref rmail-message-vector 0) nil))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2374 (messages-tail messages-head)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2375 ;; Don't make any undo records for the expunging.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2376 (buffer-undo-list t)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2377 (win))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2378 (unwind-protect
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2379 (save-excursion
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2380 (widen)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2381 (goto-char (point-min))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2382 (let ((counter 0)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2383 (number 1)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2384 (total rmail-total-messages)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2385 (new-message-number rmail-current-message)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2386 (new-summary nil)
17620
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2387 (new-msgref (list (list 0)))
9153
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2388 (rmailbuf (current-buffer))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2389 (buffer-read-only nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2390 (messages rmail-message-vector)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2391 (deleted rmail-deleted-vector)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2392 (summary rmail-summary-vector))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2393 (setq rmail-total-messages nil
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2394 rmail-current-message nil
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2395 rmail-message-vector nil
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2396 rmail-deleted-vector nil
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2397 rmail-summary-vector nil)
9153
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2398
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2399 (while (<= number total)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2400 (if (= (aref deleted number) ?D)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2401 (progn
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2402 (delete-region
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2403 (marker-position (aref messages number))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2404 (marker-position (aref messages (1+ number))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2405 (move-marker (aref messages number) nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2406 (if (> new-message-number counter)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2407 (setq new-message-number (1- new-message-number))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2408 (setq counter (1+ counter))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2409 (setq messages-tail
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2410 (setcdr messages-tail
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2411 (cons (aref messages number) nil)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2412 (setq new-summary
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2413 (cons (if (= counter number) (aref summary (1- number)))
17620
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2414 new-summary))
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2415 (setq new-msgref
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2416 (cons (aref rmail-msgref-vector number)
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2417 new-msgref))
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2418 (setcar (car new-msgref) counter))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2419 (if (zerop (% (setq number (1+ number)) 20))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2420 (message "Expunging deleted messages...%d" number)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2421 (setq messages-tail
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2422 (setcdr messages-tail
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2423 (cons (aref messages number) nil)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2424 (setq rmail-current-message new-message-number
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2425 rmail-total-messages counter
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2426 rmail-message-vector (apply 'vector messages-head)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2427 rmail-deleted-vector (make-string (1+ counter) ?\ )
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2428 rmail-summary-vector (vconcat (nreverse new-summary))
17620
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2429 rmail-msgref-vector (apply 'vector (nreverse new-msgref))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2430 win t)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2431 (message "Expunging deleted messages...done")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2432 (if (not win)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2433 (narrow-to-region (- (buffer-size) omin) (- (buffer-size) omax)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2434 (rmail-show-message
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2435 (if (zerop rmail-current-message) 1 nil))
17011
d6a6cfeb9904 (rmail-file-coding-system): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 16970
diff changeset
2436 (goto-char (+ (point) opoint)))))
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2437
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2438 (defun rmail-expunge ()
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2439 "Erase deleted messages from Rmail file and summary buffer."
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2440 (interactive)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2441 (rmail-only-expunge)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2442 (if (rmail-summary-exists)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2443 (rmail-select-summary
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2444 (rmail-update-summary))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2445
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2446 ;;;; *** Rmail Mailing Commands ***
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2447
16633
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2448 (defun rmail-start-mail (&optional noerase to subject in-reply-to cc
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2449 replybuffer sendactions same-window others)
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2450 (let (yank-action)
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2451 (if replybuffer
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2452 (setq yank-action (list 'insert-buffer replybuffer)))
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2453 (setq others (cons (cons "cc" cc) others))
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2454 (setq others (cons (cons "in-reply-to" in-reply-to) others))
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2455 (if same-window
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2456 (compose-mail to subject others
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2457 noerase nil
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2458 yank-action sendactions)
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2459 (if (and window-system rmail-mail-new-frame)
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2460 (prog1
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2461 (compose-mail to subject others
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2462 noerase 'switch-to-buffer-other-frame
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2463 yank-action sendactions)
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2464 ;; This is not a standard frame parameter;
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2465 ;; nothing except sendmail.el looks at it.
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2466 (modify-frame-parameters (selected-frame)
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2467 '((mail-dedicated-frame . t))))
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2468 (compose-mail to subject others
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2469 noerase 'switch-to-buffer-other-window
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2470 yank-action sendactions)))))
4108
e4fbcd480455 (rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 4071
diff changeset
2471
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2472 (defun rmail-mail ()
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2473 "Send mail in another window.
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2474 While composing the message, use \\[mail-yank-original] to yank the
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2475 original message into it."
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2476 (interactive)
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
2477 (rmail-start-mail nil nil nil nil nil rmail-view-buffer))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2478
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2479 (defun rmail-continue ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2480 "Continue composing outgoing message previously being composed."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2481 (interactive)
4108
e4fbcd480455 (rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 4071
diff changeset
2482 (rmail-start-mail t))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2483
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2484 (defun rmail-reply (just-sender)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2485 "Reply to the current message.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2486 Normally include CC: to all other recipients of original message;
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2487 prefix argument means ignore them. While composing the reply,
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2488 use \\[mail-yank-original] to yank the original message into it."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2489 (interactive "P")
16953
46b39d9f3ad0 (rmail-reply): Copy all the References: headers
Richard M. Stallman <rms@gnu.org>
parents: 16928
diff changeset
2490 (let (from reply-to cc subject date to message-id references
16467
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2491 resent-to resent-cc resent-reply-to
17093
f8584d52dd48 (rmail-view-buffer, rmail-enable-mime, rmail-show-mime-function,
Kenichi Handa <handa@m17n.org>
parents: 17065
diff changeset
2492 (msgnum rmail-current-message))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2493 (save-excursion
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2494 (save-restriction
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2495 (widen)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2496 (goto-char (rmail-msgbeg rmail-current-message))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2497 (forward-line 1)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2498 (if (= (following-char) ?0)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2499 (narrow-to-region
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2500 (progn (forward-line 2)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2501 (point))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2502 (progn (search-forward "\n\n" (rmail-msgend rmail-current-message)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2503 'move)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2504 (point)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2505 (narrow-to-region (point)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2506 (progn (search-forward "\n*** EOOH ***\n")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2507 (beginning-of-line) (point))))
16467
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2508 (setq from (mail-fetch-field "from")
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2509 reply-to (or (mail-fetch-field "reply-to" nil t)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2510 from)
16467
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2511 cc (and (not just-sender)
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2512 (mail-fetch-field "cc" nil t))
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2513 subject (mail-fetch-field "subject")
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2514 date (mail-fetch-field "date")
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2515 to (or (mail-fetch-field "to" nil t) "")
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2516 message-id (mail-fetch-field "message-id")
16953
46b39d9f3ad0 (rmail-reply): Copy all the References: headers
Richard M. Stallman <rms@gnu.org>
parents: 16928
diff changeset
2517 references (mail-fetch-field "references" nil nil t)
46b39d9f3ad0 (rmail-reply): Copy all the References: headers
Richard M. Stallman <rms@gnu.org>
parents: 16928
diff changeset
2518 resent-reply-to (mail-fetch-field "resent-reply-to" nil t)
16467
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2519 resent-cc (and (not just-sender)
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2520 (mail-fetch-field "resent-cc" nil t))
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2521 resent-to (or (mail-fetch-field "resent-to" nil t) "")
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2522 ;;; resent-subject (mail-fetch-field "resent-subject")
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2523 ;;; resent-date (mail-fetch-field "resent-date")
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2524 ;;; resent-message-id (mail-fetch-field "resent-message-id")
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2525 )))
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2526 ;; Merge the resent-to and resent-cc into the to and cc.
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2527 (if (and resent-to (not (equal resent-to "")))
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2528 (if (not (equal to ""))
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2529 (setq to (concat to ", " resent-to))
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2530 (setq to resent-to)))
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2531 (if (and resent-cc (not (equal resent-cc "")))
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2532 (if (not (equal cc ""))
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2533 (setq cc (concat cc ", " resent-cc))
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2534 (setq cc resent-cc)))
446f51ea7cb8 (rmail-reply): Merge resent-to and resent-cc into to and cc.
Richard M. Stallman <rms@gnu.org>
parents: 16452
diff changeset
2535 ;; Add `Re: ' to subject if not there already.
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2536 (and (stringp subject)
10640
937cc7f2a790 (rmail-reply-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 10621
diff changeset
2537 (setq subject
937cc7f2a790 (rmail-reply-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 10621
diff changeset
2538 (concat rmail-reply-prefix
17065
01cba1834368 (rmail-next-same-subject, rmail-reply): Ignore case, to
Karl Heuer <kwzh@gnu.org>
parents: 17011
diff changeset
2539 (if (let ((case-fold-search t))
01cba1834368 (rmail-next-same-subject, rmail-reply): Ignore case, to
Karl Heuer <kwzh@gnu.org>
parents: 17011
diff changeset
2540 (string-match rmail-reply-regexp subject))
10640
937cc7f2a790 (rmail-reply-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 10621
diff changeset
2541 (substring subject (match-end 0))
937cc7f2a790 (rmail-reply-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 10621
diff changeset
2542 subject))))
18091
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2543 (rmail-start-mail
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2544 nil
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2545 ;; Using mail-strip-quoted-names is undesirable with newer mailers
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2546 ;; since they can handle the names unstripped.
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2547 ;; I don't know whether there are other mailers that still
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2548 ;; need the names to be stripped.
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2549 (mail-strip-quoted-names reply-to)
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2550 subject
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2551 (rmail-make-in-reply-to-field from date message-id)
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2552 (if just-sender
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2553 nil
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2554 ;; mail-strip-quoted-names is NOT necessary for rmail-dont-reply-to
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2555 ;; to do its job.
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2556 (let* ((cc-list (rmail-dont-reply-to
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2557 (mail-strip-quoted-names
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2558 (if (null cc) to (concat to ", " cc))))))
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2559 (if (string= cc-list "") nil cc-list)))
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2560 rmail-view-buffer
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2561 (list (list 'rmail-mark-message
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2562 rmail-view-buffer
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2563 (aref rmail-msgref-vector msgnum)
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2564 "answered"))
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2565 nil
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2566 (list (cons "References" (concat (mapconcat 'identity references " ")
1bd633f97c45 (rmail-mmdf-delim1, rmail-mmdf-delim2):
Richard M. Stallman <rms@gnu.org>
parents: 17839
diff changeset
2567 " " message-id))))))
17565
09d1f6578d7f (rmail-reply): Pass Rmail buffer and msgnum
Richard M. Stallman <rms@gnu.org>
parents: 17306
diff changeset
2568
17620
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2569 (defun rmail-mark-message (buffer msgnum-list attribute)
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2570 "Give BUFFER's message number in MSGNUM-LIST the attribute ATTRIBUTE.
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2571 This is use in the send-actions for message buffers.
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2572 MSGNUM-LIST is a list of the form (MSGNUM)
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2573 which is an element of rmail-msgref-vector."
17565
09d1f6578d7f (rmail-reply): Pass Rmail buffer and msgnum
Richard M. Stallman <rms@gnu.org>
parents: 17306
diff changeset
2574 (save-excursion
09d1f6578d7f (rmail-reply): Pass Rmail buffer and msgnum
Richard M. Stallman <rms@gnu.org>
parents: 17306
diff changeset
2575 (set-buffer buffer)
17620
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2576 (if (car msgnum-list)
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2577 (rmail-set-attribute attribute t (car msgnum-list)))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2578
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2579 (defun rmail-make-in-reply-to-field (from date message-id)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2580 (cond ((not from)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2581 (if message-id
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2582 message-id
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2583 nil))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2584 (mail-use-rfc822
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2585 (require 'rfc822)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2586 (let ((tem (car (rfc822-addresses from))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2587 (if message-id
19315
f842aabf9735 (rmail-make-in-reply-to-field): Don't cause an
Richard M. Stallman <rms@gnu.org>
parents: 19031
diff changeset
2588 (if (or (not tem)
f842aabf9735 (rmail-make-in-reply-to-field): Don't cause an
Richard M. Stallman <rms@gnu.org>
parents: 19031
diff changeset
2589 (string-match
f842aabf9735 (rmail-make-in-reply-to-field): Don't cause an
Richard M. Stallman <rms@gnu.org>
parents: 19031
diff changeset
2590 (regexp-quote (if (string-match "@[^@]*\\'" tem)
f842aabf9735 (rmail-make-in-reply-to-field): Don't cause an
Richard M. Stallman <rms@gnu.org>
parents: 19031
diff changeset
2591 (substring tem 0
f842aabf9735 (rmail-make-in-reply-to-field): Don't cause an
Richard M. Stallman <rms@gnu.org>
parents: 19031
diff changeset
2592 (match-beginning 0))
f842aabf9735 (rmail-make-in-reply-to-field): Don't cause an
Richard M. Stallman <rms@gnu.org>
parents: 19031
diff changeset
2593 tem))
f842aabf9735 (rmail-make-in-reply-to-field): Don't cause an
Richard M. Stallman <rms@gnu.org>
parents: 19031
diff changeset
2594 message-id))
f842aabf9735 (rmail-make-in-reply-to-field): Don't cause an
Richard M. Stallman <rms@gnu.org>
parents: 19031
diff changeset
2595 ;; missing From, or Message-ID is sufficiently informative
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2596 message-id
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2597 (concat message-id " (" tem ")"))
5692
bb9b20ea092d (rmail-make-in-reply-to-field): Discard text properties from
Richard M. Stallman <rms@gnu.org>
parents: 5611
diff changeset
2598 ;; Copy TEM, discarding text properties.
bb9b20ea092d (rmail-make-in-reply-to-field): Discard text properties from
Richard M. Stallman <rms@gnu.org>
parents: 5611
diff changeset
2599 (setq tem (copy-sequence tem))
bb9b20ea092d (rmail-make-in-reply-to-field): Discard text properties from
Richard M. Stallman <rms@gnu.org>
parents: 5611
diff changeset
2600 (set-text-properties 0 (length tem) nil tem)
bb9b20ea092d (rmail-make-in-reply-to-field): Discard text properties from
Richard M. Stallman <rms@gnu.org>
parents: 5611
diff changeset
2601 (setq tem (copy-sequence tem))
bb9b20ea092d (rmail-make-in-reply-to-field): Discard text properties from
Richard M. Stallman <rms@gnu.org>
parents: 5611
diff changeset
2602 ;; Use prin1 to fake RFC822 quoting
bb9b20ea092d (rmail-make-in-reply-to-field): Discard text properties from
Richard M. Stallman <rms@gnu.org>
parents: 5611
diff changeset
2603 (let ((field (prin1-to-string tem)))
bb9b20ea092d (rmail-make-in-reply-to-field): Discard text properties from
Richard M. Stallman <rms@gnu.org>
parents: 5611
diff changeset
2604 (if date
bb9b20ea092d (rmail-make-in-reply-to-field): Discard text properties from
Richard M. Stallman <rms@gnu.org>
parents: 5611
diff changeset
2605 (concat field "'s message of " date)
bb9b20ea092d (rmail-make-in-reply-to-field): Discard text properties from
Richard M. Stallman <rms@gnu.org>
parents: 5611
diff changeset
2606 field)))))
20681
4a46ac370fc8 (rmail): Don't bind enable-multibyte-characters;
Richard M. Stallman <rms@gnu.org>
parents: 20662
diff changeset
2607 ((let* ((foo "[^][\000-\037()<>@,;:\\\" ]+")
4a46ac370fc8 (rmail): Don't bind enable-multibyte-characters;
Richard M. Stallman <rms@gnu.org>
parents: 20662
diff changeset
2608 (bar "[^][\000-\037()<>@,;:\\\"]+"))
4a46ac370fc8 (rmail): Don't bind enable-multibyte-characters;
Richard M. Stallman <rms@gnu.org>
parents: 20662
diff changeset
2609 ;; These strings both match all non-ASCII characters.
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2610 (or (string-match (concat "\\`[ \t]*\\(" bar
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2611 "\\)\\(<" foo "@" foo ">\\)?[ \t]*\\'")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2612 ;; "Unix Loser <Foo@bar.edu>" => "Unix Loser"
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2613 from)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2614 (string-match (concat "\\`[ \t]*<" foo "@" foo ">[ \t]*(\\("
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2615 bar "\\))[ \t]*\\'")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2616 ;; "<Bugs@bar.edu>" (Losing Unix) => "Losing Unix"
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2617 from)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2618 (let ((start (match-beginning 1))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2619 (end (match-end 1)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2620 ;; Trim whitespace which above regexp match allows
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2621 (while (and (< start end)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2622 (memq (aref from start) '(?\t ?\ )))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2623 (setq start (1+ start)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2624 (while (and (< start end)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2625 (memq (aref from (1- end)) '(?\t ?\ )))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2626 (setq end (1- end)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2627 (let ((field (substring from start end)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2628 (if date (setq field (concat "message from " field " on " date)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2629 (if message-id
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2630 ;; "<AA259@bar.edu> (message from Unix Loser on 1-Apr-89)"
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2631 (concat message-id " (" field ")")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2632 field))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2633 (t
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2634 ;; If we can't kludge it simply, do it correctly
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2635 (let ((mail-use-rfc822 t))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2636 (rmail-make-in-reply-to-field from date message-id)))))
10970
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
2637
2687
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2638 (defun rmail-forward (resend)
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2639 "Forward the current message to another user.
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2640 With prefix argument, \"resend\" the message instead of forwarding it;
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2641 see the documentation of `rmail-resend'."
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2642 (interactive "P")
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2643 (if resend
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2644 (call-interactively 'rmail-resend)
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2645 (let ((forward-buffer (current-buffer))
9153
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2646 (msgnum rmail-current-message)
2687
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2647 (subject (concat "["
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2648 (let ((from (or (mail-fetch-field "From")
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2649 (mail-fetch-field ">From"))))
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2650 (if from
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2651 (concat (mail-strip-quoted-names from) ": ")
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2652 ""))
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2653 (or (mail-fetch-field "Subject") "")
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2654 "]")))
16633
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2655 (if (rmail-start-mail
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2656 nil nil subject nil nil nil
17565
09d1f6578d7f (rmail-reply): Pass Rmail buffer and msgnum
Richard M. Stallman <rms@gnu.org>
parents: 17306
diff changeset
2657 (list (list 'rmail-mark-message
17620
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2658 forward-buffer
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2659 (aref rmail-msgref-vector msgnum)
17565
09d1f6578d7f (rmail-reply): Pass Rmail buffer and msgnum
Richard M. Stallman <rms@gnu.org>
parents: 17306
diff changeset
2660 "forwarded"))
16633
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2661 ;; If only one window, use it for the mail buffer.
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2662 ;; Otherwise, use another window for the mail buffer
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2663 ;; so that the Rmail buffer remains visible
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2664 ;; and sending the mail will get back to it.
bd4dbc8ca6f7 (rmail-start-mail): Rewrite to use compose-mail.
Richard M. Stallman <rms@gnu.org>
parents: 16467
diff changeset
2665 (and (not rmail-mail-new-frame) (one-window-p t)))
9153
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2666 ;; The mail buffer is now current.
4263
7c7fa71cfd6e (rmail-last-rmail-file): Initialize to a file name.
Richard M. Stallman <rms@gnu.org>
parents: 4108
diff changeset
2667 (save-excursion
4724
04714985ce20 (rmail-forward): Insert the text right after the header separator.
Richard M. Stallman <rms@gnu.org>
parents: 4698
diff changeset
2668 ;; Insert after header separator--before signature if any.
4764
0e239209a6db (rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents: 4724
diff changeset
2669 (goto-char (point-min))
0e239209a6db (rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents: 4724
diff changeset
2670 (search-forward-regexp
8506
07a5f6c2bc9f (rmail-forward): Anchor `mail-header-separator' on both
Richard M. Stallman <rms@gnu.org>
parents: 8447
diff changeset
2671 (concat "^" (regexp-quote mail-header-separator) "$"))
4263
7c7fa71cfd6e (rmail-last-rmail-file): Initialize to a file name.
Richard M. Stallman <rms@gnu.org>
parents: 4108
diff changeset
2672 (forward-line 1)
8875
36c2657d03bb (rmail-forward): Insert separator before and after message.
Richard M. Stallman <rms@gnu.org>
parents: 8701
diff changeset
2673 (insert "------- Start of forwarded message -------\n")
13834
3c51aa417e32 (rmail-forward): Quote lines with `- ' when necessary.
Richard M. Stallman <rms@gnu.org>
parents: 13818
diff changeset
2674 ;; Quote lines with `- ' if they start with `-'.
3c51aa417e32 (rmail-forward): Quote lines with `- ' when necessary.
Richard M. Stallman <rms@gnu.org>
parents: 13818
diff changeset
2675 (let ((beg (point)) end)
14916
9d170829f227 (rmail-forward): Put the "end" line right after the
Richard M. Stallman <rms@gnu.org>
parents: 14898
diff changeset
2676 (setq end (point-marker))
9d170829f227 (rmail-forward): Put the "end" line right after the
Richard M. Stallman <rms@gnu.org>
parents: 14898
diff changeset
2677 (set-marker-insertion-type end t)
13834
3c51aa417e32 (rmail-forward): Quote lines with `- ' when necessary.
Richard M. Stallman <rms@gnu.org>
parents: 13818
diff changeset
2678 (insert-buffer-substring forward-buffer)
3c51aa417e32 (rmail-forward): Quote lines with `- ' when necessary.
Richard M. Stallman <rms@gnu.org>
parents: 13818
diff changeset
2679 (goto-char beg)
17237
d3f5f14d1de4 (rmail-forward): Don't do dash-quoting on the signature.
Richard M. Stallman <rms@gnu.org>
parents: 17197
diff changeset
2680 (while (re-search-forward "^-" end t)
13834
3c51aa417e32 (rmail-forward): Quote lines with `- ' when necessary.
Richard M. Stallman <rms@gnu.org>
parents: 13818
diff changeset
2681 (beginning-of-line)
3c51aa417e32 (rmail-forward): Quote lines with `- ' when necessary.
Richard M. Stallman <rms@gnu.org>
parents: 13818
diff changeset
2682 (insert "- ")
3c51aa417e32 (rmail-forward): Quote lines with `- ' when necessary.
Richard M. Stallman <rms@gnu.org>
parents: 13818
diff changeset
2683 (forward-line 1))
14916
9d170829f227 (rmail-forward): Put the "end" line right after the
Richard M. Stallman <rms@gnu.org>
parents: 14898
diff changeset
2684 (goto-char end)
13724
36e3cc8cb103 (rmail-forward): Delete trailing blank lines.
Karl Heuer <kwzh@gnu.org>
parents: 13572
diff changeset
2685 (skip-chars-backward "\n")
36e3cc8cb103 (rmail-forward): Delete trailing blank lines.
Karl Heuer <kwzh@gnu.org>
parents: 13572
diff changeset
2686 (if (< (point) end)
36e3cc8cb103 (rmail-forward): Delete trailing blank lines.
Karl Heuer <kwzh@gnu.org>
parents: 13572
diff changeset
2687 (forward-char 1))
14916
9d170829f227 (rmail-forward): Put the "end" line right after the
Richard M. Stallman <rms@gnu.org>
parents: 14898
diff changeset
2688 (delete-region (point) end)
9d170829f227 (rmail-forward): Put the "end" line right after the
Richard M. Stallman <rms@gnu.org>
parents: 14898
diff changeset
2689 (set-marker end nil))
8875
36c2657d03bb (rmail-forward): Insert separator before and after message.
Richard M. Stallman <rms@gnu.org>
parents: 8701
diff changeset
2690 (insert "------- End of forwarded message -------\n")
9153
029821174e53 (rmail-forward): Simplify insertion of forwarded msg.
Richard M. Stallman <rms@gnu.org>
parents: 9083
diff changeset
2691 (push-mark))))))
10970
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
2692
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2693 (defun rmail-resend (address &optional from comment mail-alias-file)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2694 "Resend current message to ADDRESSES.
5274
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
2695 ADDRESSES should be a single address, a string consisting of several
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2696 addresses separated by commas, or a list of addresses.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2697
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2698 Optional FROM is the address to resend the message from, and
19031
369a8580b08e (rmail-resend): Use user-mail-address.
Richard M. Stallman <rms@gnu.org>
parents: 18990
diff changeset
2699 defaults from the value of `user-mail-address'.
369a8580b08e (rmail-resend): Use user-mail-address.
Richard M. Stallman <rms@gnu.org>
parents: 18990
diff changeset
2700 Optional COMMENT is a string to insert as a comment in the resent message.
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2701 Optional ALIAS-FILE is alternate aliases file to be used by sendmail,
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2702 typically for purposes of moderating a list."
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2703 (interactive "sResend to: ")
3484
bd26679f0db5 (rmail-resend): Require sendmail and mailalias.
Richard M. Stallman <rms@gnu.org>
parents: 3462
diff changeset
2704 (require 'sendmail)
bd26679f0db5 (rmail-resend): Require sendmail and mailalias.
Richard M. Stallman <rms@gnu.org>
parents: 3462
diff changeset
2705 (require 'mailalias)
19031
369a8580b08e (rmail-resend): Use user-mail-address.
Richard M. Stallman <rms@gnu.org>
parents: 18990
diff changeset
2706 (if (not from) (setq from user-mail-address))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2707 (let ((tembuf (generate-new-buffer " sendmail temp"))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2708 (mail-header-separator "")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2709 (case-fold-search nil)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2710 (mailbuf (current-buffer)))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2711 (unwind-protect
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2712 (save-excursion
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2713 ;;>> Copy message into temp buffer
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2714 (set-buffer tembuf)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2715 (insert-buffer-substring mailbuf)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2716 (goto-char (point-min))
14033
d146539da475 (rmail-retry-failure): Bind inhibit-read-only.
Richard M. Stallman <rms@gnu.org>
parents: 13834
diff changeset
2717 ;; Delete any Sender field, since that's not specifiable.
5274
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
2718 ; Only delete Sender fields in the actual header.
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
2719 (re-search-forward "^$" nil 'move)
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
2720 ; Using "while" here rather than "if" because some buggy mail
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
2721 ; software may have inserted multiple Sender fields.
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
2722 (while (re-search-backward "^Sender:" nil t)
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
2723 (let (beg)
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
2724 (setq beg (point))
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
2725 (forward-line 1)
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
2726 (while (looking-at "[ \t]")
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
2727 (forward-line 1))
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
2728 (delete-region beg (point))))
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
2729 ; Go back to the beginning of the buffer so the Resent- fields
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
2730 ; are inserted there.
89b71a85be3e (rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents: 5192
diff changeset
2731 (goto-char (point-min))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2732 ;;>> Insert resent-from:
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2733 (insert "Resent-From: " from "\n")
4020
a35cd533fda4 (rmail-resend): Use RFC 822 style date in Resent-Date: line.
Richard M. Stallman <rms@gnu.org>
parents: 4010
diff changeset
2734 (insert "Resent-Date: " (mail-rfc822-date) "\n")
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2735 ;;>> Insert resent-to: and bcc if need be.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2736 (let ((before (point)))
4838
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2737 (if mail-self-blind
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2738 (insert "Resent-Bcc: " (user-login-name) "\n"))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2739 (insert "Resent-To: " (if (stringp address)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2740 address
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2741 (mapconcat 'identity address ",\n\t"))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2742 "\n")
11452
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
2743 ;; Expand abbrevs in the recipients.
8545
2aa8cbd91781 (rmail-resend): Preserve point around expand-mail-aliases.
Richard M. Stallman <rms@gnu.org>
parents: 8533
diff changeset
2744 (save-excursion
11452
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
2745 (if (featurep 'mailabbrev)
11533
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
2746 (let ((end (point-marker))
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
2747 (local-abbrev-table mail-abbrevs)
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
2748 (old-syntax-table (syntax-table)))
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
2749 (if (and (not (vectorp mail-abbrevs))
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
2750 (file-exists-p mail-personal-alias-file))
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
2751 (build-mail-abbrevs))
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
2752 (set-syntax-table mail-abbrev-syntax-table)
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
2753 (goto-char before)
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
2754 (while (and (< (point) end)
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
2755 (progn (forward-word 1)
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
2756 (<= (point) end)))
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
2757 (expand-abbrev))
2d1e996c4359 (rmail-resend): Fix abbrev expansion.
Richard M. Stallman <rms@gnu.org>
parents: 11497
diff changeset
2758 (set-syntax-table old-syntax-table))
11452
a24224fc5a92 (rmail-reformat-message): Call `rmail-clear-headers'
Richard M. Stallman <rms@gnu.org>
parents: 11049
diff changeset
2759 (expand-mail-aliases before (point)))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2760 ;;>> Set up comment, if any.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2761 (if (and (sequencep comment) (not (zerop (length comment))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2762 (let ((before (point))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2763 after)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2764 (insert comment)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2765 (or (eolp) (insert "\n"))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2766 (setq after (point))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2767 (goto-char before)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2768 (while (< (point) after)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2769 (insert "Resent-Comment: ")
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2770 (forward-line 1))))
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2771 ;; Don't expand aliases in the destination fields
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2772 ;; of the original message.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2773 (let (mail-aliases)
5470
b8e8802d2216 (rmail-resend): Use send-mail-function.
Richard M. Stallman <rms@gnu.org>
parents: 5466
diff changeset
2774 (funcall send-mail-function)))
2687
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2775 (kill-buffer tembuf))
37cca1d50b6a (rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
2776 (rmail-set-attribute "resent" t rmail-current-message)))
10970
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
2777
1267
1e1a54ebb29b (mail-unsent-separator): Add another alternative.
Richard M. Stallman <rms@gnu.org>
parents: 1165
diff changeset
2778 (defvar mail-unsent-separator
1370
c017b62c8073 (mail-unsent-separator): Allow "original message" as alternative.
Richard M. Stallman <rms@gnu.org>
parents: 1360
diff changeset
2779 (concat "^ *---+ +Unsent message follows +---+ *$\\|"
c017b62c8073 (mail-unsent-separator): Allow "original message" as alternative.
Richard M. Stallman <rms@gnu.org>
parents: 1360
diff changeset
2780 "^ *---+ +Returned message +---+ *$\\|"
10815
52e860d10537 (rmail-retry-failure): Support a new style of failure msg.
Richard M. Stallman <rms@gnu.org>
parents: 10711
diff changeset
2781 "^Start of returned message$\\|"
1372
e839dc00fc2e (mail-unsent-separator): Handle "Message text follows".
Richard M. Stallman <rms@gnu.org>
parents: 1370
diff changeset
2782 "^ *---+ +Original message +---+ *$\\|"
1757
7e85913523ef (mail-unsent-separator): Add `-- begin message --'.
Richard M. Stallman <rms@gnu.org>
parents: 1704
diff changeset
2783 "^ *--+ +begin message +--+ *$\\|"
4838
754b38c0e941 (rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents: 4819
diff changeset
2784 "^ *---+ +Original message follows +---+ *$\\|"
8572
1dd6c880b6ea (rmail-retry-failure, mail-unsent-separator): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8545
diff changeset
2785 "^|? *---+ +Message text follows: +---+ *|?$")
1dd6c880b6ea (rmail-retry-failure, mail-unsent-separator): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8545
diff changeset
2786 "A regexp that matches the separator before the text of a failed message.")
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2787
17197
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2788 (defvar mail-mime-unsent-header "^Content-Type: message/rfc822 *$"
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2789 "A regexp that matches the header of a MIME body part with a failed message.")
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2790
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2791 (defun rmail-retry-failure ()
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2792 "Edit a mail message which is based on the contents of the current message.
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2793 For a message rejected by the mail system, extract the interesting headers and
8572
1dd6c880b6ea (rmail-retry-failure, mail-unsent-separator): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8545
diff changeset
2794 the body of the original message.
17197
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2795 If the failed message is a MIME multipart message, it is searched for a
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2796 body part with a header which matches the variable `mail-mime-unsent-header'.
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2797 Otherwise, the variable `mail-unsent-separator' should match the string that
9010
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2798 delimits the returned original message.
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2799 The variable `rmail-retry-ignored-headers' is a regular expression
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2800 specifying headers which should not be copied into the new message."
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2801 (interactive)
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2802 (require 'mail-utils)
17821
c0422adc1b0e (rmail-retry-failure): Rename local to rmail-this-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 17762
diff changeset
2803 (let ((rmail-this-buffer (current-buffer))
13808
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2804 (msgnum rmail-current-message)
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2805 bounce-start bounce-end bounce-indent resending)
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2806 (save-excursion
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2807 ;; Narrow down to just the quoted original message
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2808 (rmail-beginning-of-message)
17197
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2809 (let* ((case-fold-search t)
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2810 (top (point))
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2811 (content-type
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2812 (save-restriction
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2813 ;; Fetch any content-type header in current message
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2814 (search-forward "\n\n") (narrow-to-region top (point))
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2815 (mail-fetch-field "Content-Type") )) )
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2816 ;; Handle MIME multipart bounce messages
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2817 (if (and content-type
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2818 (string-match
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2819 ";[\n\t ]*boundary=\"?\\([-0-9a-z'()+_,./:=?]+\\)\"?"
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2820 content-type))
10621
027b0964b8a7 (rmail-retry-failure): Handle "Mime-encapsulated messages".
Richard M. Stallman <rms@gnu.org>
parents: 10191
diff changeset
2821 (let ((codestring
17197
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2822 (concat "\n--"
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2823 (substring content-type (match-beginning 1)
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2824 (match-end 1)))))
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2825 (or (re-search-forward mail-mime-unsent-header nil t)
15403
dfcab63fbbd3 (rmail-retry-failure): Nicer error message
Richard M. Stallman <rms@gnu.org>
parents: 15349
diff changeset
2826 (error "Cannot find beginning of header in failed message"))
17197
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2827 (or (search-forward "\n\n" nil t)
10621
027b0964b8a7 (rmail-retry-failure): Handle "Mime-encapsulated messages".
Richard M. Stallman <rms@gnu.org>
parents: 10191
diff changeset
2828 (error "Cannot find end of Mime data in failed message"))
027b0964b8a7 (rmail-retry-failure): Handle "Mime-encapsulated messages".
Richard M. Stallman <rms@gnu.org>
parents: 10191
diff changeset
2829 (setq bounce-start (point))
17197
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2830 (or (search-forward codestring nil t)
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2831 (error "Cannot find end of Mime data in failed message"))
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2832 (setq bounce-end (match-beginning 0))
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2833 ; (or (search-forward "\n\n" nil t)
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2834 ; (error "Cannot find end of header in failed message"))
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2835 )
7689ab3937cc (rmail-retry-failure): Special handling for mime.
Richard M. Stallman <rms@gnu.org>
parents: 17164
diff changeset
2836 ;; non-MIME bounce
10621
027b0964b8a7 (rmail-retry-failure): Handle "Mime-encapsulated messages".
Richard M. Stallman <rms@gnu.org>
parents: 10191
diff changeset
2837 (or (re-search-forward mail-unsent-separator nil t)
027b0964b8a7 (rmail-retry-failure): Handle "Mime-encapsulated messages".
Richard M. Stallman <rms@gnu.org>
parents: 10191
diff changeset
2838 (error "Cannot parse this as a failure message"))
10815
52e860d10537 (rmail-retry-failure): Support a new style of failure msg.
Richard M. Stallman <rms@gnu.org>
parents: 10711
diff changeset
2839 (skip-chars-forward "\n")
52e860d10537 (rmail-retry-failure): Support a new style of failure msg.
Richard M. Stallman <rms@gnu.org>
parents: 10711
diff changeset
2840 ;; Support a style of failure message in which the original
52e860d10537 (rmail-retry-failure): Support a new style of failure msg.
Richard M. Stallman <rms@gnu.org>
parents: 10711
diff changeset
2841 ;; message is indented, and included within lines saying
52e860d10537 (rmail-retry-failure): Support a new style of failure msg.
Richard M. Stallman <rms@gnu.org>
parents: 10711
diff changeset
2842 ;; `Start of returned message' and `End of returned message'.
13572
abbd898a545b (rmail-retry-failure): Add missing colons in regexp.
Karl Heuer <kwzh@gnu.org>
parents: 13477
diff changeset
2843 (if (looking-at " +Received:")
abbd898a545b (rmail-retry-failure): Add missing colons in regexp.
Karl Heuer <kwzh@gnu.org>
parents: 13477
diff changeset
2844 (progn
abbd898a545b (rmail-retry-failure): Add missing colons in regexp.
Karl Heuer <kwzh@gnu.org>
parents: 13477
diff changeset
2845 (setq bounce-start (point))
10815
52e860d10537 (rmail-retry-failure): Support a new style of failure msg.
Richard M. Stallman <rms@gnu.org>
parents: 10711
diff changeset
2846 (skip-chars-forward " ")
13572
abbd898a545b (rmail-retry-failure): Add missing colons in regexp.
Karl Heuer <kwzh@gnu.org>
parents: 13477
diff changeset
2847 (setq bounce-indent (- (current-column)))
abbd898a545b (rmail-retry-failure): Add missing colons in regexp.
Karl Heuer <kwzh@gnu.org>
parents: 13477
diff changeset
2848 (goto-char (point-max))
abbd898a545b (rmail-retry-failure): Add missing colons in regexp.
Karl Heuer <kwzh@gnu.org>
parents: 13477
diff changeset
2849 (re-search-backward "^End of returned message$" nil t)
abbd898a545b (rmail-retry-failure): Add missing colons in regexp.
Karl Heuer <kwzh@gnu.org>
parents: 13477
diff changeset
2850 (setq bounce-end (point)))
abbd898a545b (rmail-retry-failure): Add missing colons in regexp.
Karl Heuer <kwzh@gnu.org>
parents: 13477
diff changeset
2851 ;; One message contained a few random lines before the old
abbd898a545b (rmail-retry-failure): Add missing colons in regexp.
Karl Heuer <kwzh@gnu.org>
parents: 13477
diff changeset
2852 ;; message header. The first line of the message started with
13808
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2853 ;; two hyphens. A blank line followed these random lines.
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2854 ;; The same line beginning with two hyphens was possibly
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2855 ;; marking the end of the message.
13572
abbd898a545b (rmail-retry-failure): Add missing colons in regexp.
Karl Heuer <kwzh@gnu.org>
parents: 13477
diff changeset
2856 (if (looking-at "^--")
13808
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2857 (let ((boundary (buffer-substring-no-properties
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2858 (point)
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2859 (progn (end-of-line) (point)))))
13572
abbd898a545b (rmail-retry-failure): Add missing colons in regexp.
Karl Heuer <kwzh@gnu.org>
parents: 13477
diff changeset
2860 (search-forward "\n\n")
13808
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2861 (skip-chars-forward "\n")
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2862 (setq bounce-start (point))
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2863 (goto-char (point-max))
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2864 (search-backward (concat "\n\n" boundary) bounce-start t)
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2865 (setq bounce-end (point)))
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2866 (setq bounce-start (point)
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2867 bounce-end (point-max)))
13572
abbd898a545b (rmail-retry-failure): Add missing colons in regexp.
Karl Heuer <kwzh@gnu.org>
parents: 13477
diff changeset
2868 (or (search-forward "\n\n" nil t)
13808
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2869 (error "Cannot find end of header in failed message"))
308a47d72b19 (rmail-ignored-headers): Add resent-date, nntp-posting-host.
Karl Heuer <kwzh@gnu.org>
parents: 13724
diff changeset
2870 ))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2871 ;; Start sending a new message; default header fields from the original.
1135
e33f6475229a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1112
diff changeset
2872 ;; Turn off the usual actions for initializing the message body
e33f6475229a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1112
diff changeset
2873 ;; because we want to get only the text from the failure message.
17565
09d1f6578d7f (rmail-reply): Pass Rmail buffer and msgnum
Richard M. Stallman <rms@gnu.org>
parents: 17306
diff changeset
2874 (let (mail-signature mail-setup-hook)
17821
c0422adc1b0e (rmail-retry-failure): Rename local to rmail-this-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 17762
diff changeset
2875 (if (rmail-start-mail nil nil nil nil nil rmail-this-buffer
17565
09d1f6578d7f (rmail-reply): Pass Rmail buffer and msgnum
Richard M. Stallman <rms@gnu.org>
parents: 17306
diff changeset
2876 (list (list 'rmail-mark-message
17821
c0422adc1b0e (rmail-retry-failure): Rename local to rmail-this-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 17762
diff changeset
2877 rmail-this-buffer
17620
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2878 (aref rmail-msgref-vector msgnum)
30a88c9b3505 (rmail-msgref-vector): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17565
diff changeset
2879 "retried")))
1135
e33f6475229a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1112
diff changeset
2880 ;; Insert original text as initial text of new draft message.
14033
d146539da475 (rmail-retry-failure): Bind inhibit-read-only.
Richard M. Stallman <rms@gnu.org>
parents: 13834
diff changeset
2881 ;; Bind inhibit-read-only since the header delimiter
d146539da475 (rmail-retry-failure): Bind inhibit-read-only.
Richard M. Stallman <rms@gnu.org>
parents: 13834
diff changeset
2882 ;; of the previous message was probably read-only.
d146539da475 (rmail-retry-failure): Bind inhibit-read-only.
Richard M. Stallman <rms@gnu.org>
parents: 13834
diff changeset
2883 (let ((inhibit-read-only t))
9010
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2884 (erase-buffer)
17821
c0422adc1b0e (rmail-retry-failure): Rename local to rmail-this-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 17762
diff changeset
2885 (insert-buffer-substring rmail-this-buffer bounce-start bounce-end)
9010
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2886 (goto-char (point-min))
13572
abbd898a545b (rmail-retry-failure): Add missing colons in regexp.
Karl Heuer <kwzh@gnu.org>
parents: 13477
diff changeset
2887 (if bounce-indent
abbd898a545b (rmail-retry-failure): Add missing colons in regexp.
Karl Heuer <kwzh@gnu.org>
parents: 13477
diff changeset
2888 (indent-rigidly (point-min) (point-max) bounce-indent))
9010
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2889 (rmail-clear-headers rmail-retry-ignored-headers)
13572
abbd898a545b (rmail-retry-failure): Add missing colons in regexp.
Karl Heuer <kwzh@gnu.org>
parents: 13477
diff changeset
2890 (rmail-clear-headers "^sender:\\|^from:\\|^return-path:")
1135
e33f6475229a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1112
diff changeset
2891 (goto-char (point-min))
9010
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2892 (save-restriction
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2893 (search-forward "\n\n")
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2894 (forward-line -1)
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2895 (narrow-to-region (point-min) (point))
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2896 (setq resending (mail-fetch-field "resent-to"))
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2897 (if mail-self-blind
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2898 (if resending
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2899 (insert "Resent-Bcc: " (user-login-name) "\n")
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2900 (insert "BCC: " (user-login-name) "\n"))))
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2901 (insert mail-header-separator)
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2902 (mail-position-on-field (if resending "Resent-To" "To") t)
17821
c0422adc1b0e (rmail-retry-failure): Rename local to rmail-this-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 17762
diff changeset
2903 (set-buffer rmail-this-buffer)
9010
9d48b6752dbf (rmail-retry-failure): Copy the whole block of headers from the message
Richard M. Stallman <rms@gnu.org>
parents: 8963
diff changeset
2904 (rmail-beginning-of-message))))))
10970
c71d4c1319e4 (rmail-duplicate-message): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10815
diff changeset
2905
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2906 (defun rmail-summary-exists ()
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2907 "Non-nil iff in an RMAIL buffer and an associated summary buffer exists.
6408
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
2908 In fact, the non-nil value returned is the summary buffer itself."
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2909 (and rmail-summary-buffer (buffer-name rmail-summary-buffer)
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2910 rmail-summary-buffer))
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2911
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2912 (defun rmail-summary-displayed ()
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2913 "t iff in RMAIL buffer and an associated summary buffer is displayed."
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2914 (and rmail-summary-buffer (get-buffer-window rmail-summary-buffer)))
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2915
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
2916 (defcustom rmail-redisplay-summary nil
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2917 "*Non-nil means Rmail should show the summary when it changes.
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
2918 This has an effect only if a summary buffer exists."
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
2919 :type 'boolean
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
2920 :group 'rmail-summary)
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2921
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
2922 (defcustom rmail-summary-window-size nil
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
2923 "*Non-nil means specify the height for an Rmail summary window."
20261
a1ca84bd10fd (rmail-summary-window-size): Allow integer values.
Karl Heuer <kwzh@gnu.org>
parents: 20053
diff changeset
2924 :type '(choice (const :tag "Disabled" nil) integer)
17630
de5770c149d9 Add defgroups, and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17620
diff changeset
2925 :group 'rmail-summary)
6408
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
2926
2076
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2927 ;; Put the summary buffer back on the screen, if user wants that.
5140299129c3 (rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents: 2006
diff changeset
2928 (defun rmail-maybe-display-summary ()
6408
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
2929 (let ((selected (selected-window))
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
2930 window)
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
2931 ;; If requested, make sure the summary is displayed.
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
2932 (and rmail-summary-buffer (buffer-name rmail-summary-buffer)
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
2933 rmail-redisplay-summary
8533
a0af63b5bc45 (rmail-retry-failure): Narrow to just the old header
Richard M. Stallman <rms@gnu.org>
parents: 8506
diff changeset
2934 (if (get-buffer-window rmail-summary-buffer 0)
a0af63b5bc45 (rmail-retry-failure): Narrow to just the old header
Richard M. Stallman <rms@gnu.org>
parents: 8506
diff changeset
2935 ;; It's already in some frame; show that one.
a0af63b5bc45 (rmail-retry-failure): Narrow to just the old header
Richard M. Stallman <rms@gnu.org>
parents: 8506
diff changeset
2936 (let ((frame (window-frame
a0af63b5bc45 (rmail-retry-failure): Narrow to just the old header
Richard M. Stallman <rms@gnu.org>
parents: 8506
diff changeset
2937 (get-buffer-window rmail-summary-buffer 0))))
a0af63b5bc45 (rmail-retry-failure): Narrow to just the old header
Richard M. Stallman <rms@gnu.org>
parents: 8506
diff changeset
2938 (make-frame-visible frame)
a0af63b5bc45 (rmail-retry-failure): Narrow to just the old header
Richard M. Stallman <rms@gnu.org>
parents: 8506
diff changeset
2939 (raise-frame frame))
a0af63b5bc45 (rmail-retry-failure): Narrow to just the old header
Richard M. Stallman <rms@gnu.org>
parents: 8506
diff changeset
2940 (display-buffer rmail-summary-buffer)))
6408
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
2941 ;; If requested, set the height of the summary window.
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
2942 (and rmail-summary-buffer (buffer-name rmail-summary-buffer)
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
2943 rmail-summary-window-size
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
2944 (setq window (get-buffer-window rmail-summary-buffer))
8533
a0af63b5bc45 (rmail-retry-failure): Narrow to just the old header
Richard M. Stallman <rms@gnu.org>
parents: 8506
diff changeset
2945 ;; Don't try to change the size if just one window in frame.
a0af63b5bc45 (rmail-retry-failure): Narrow to just the old header
Richard M. Stallman <rms@gnu.org>
parents: 8506
diff changeset
2946 (not (eq window (frame-root-window (window-frame window))))
6408
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
2947 (unwind-protect
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
2948 (progn
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
2949 (select-window window)
14779
afbd0214f6ec Must fontify only if we're actually showing a message.
Simon Marshall <simon@gnu.org>
parents: 14749
diff changeset
2950 (enlarge-window (- rmail-summary-window-size (window-height))))
6408
185b1fd3a525 (rmail-summary-window-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 6389
diff changeset
2951 (select-window selected)))))
270
f8d0e0ecd474 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
2952
14374
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2953 ;;;; *** Rmail Local Fontification ***
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2954
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2955 (defun rmail-fontify-buffer-function ()
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2956 ;; This function's symbol is bound to font-lock-fontify-buffer-function.
14467
f95ca90841d7 Fix up specialised fontification stuff.
Simon Marshall <simon@gnu.org>
parents: 14374
diff changeset
2957 (make-local-hook 'rmail-show-message-hook)
f95ca90841d7 Fix up specialised fontification stuff.
Simon Marshall <simon@gnu.org>
parents: 14374
diff changeset
2958 (add-hook 'rmail-show-message-hook 'rmail-fontify-message nil t)
14779
afbd0214f6ec Must fontify only if we're actually showing a message.
Simon Marshall <simon@gnu.org>
parents: 14749
diff changeset
2959 ;; If we're already showing a message, fontify it now.
afbd0214f6ec Must fontify only if we're actually showing a message.
Simon Marshall <simon@gnu.org>
parents: 14749
diff changeset
2960 (if rmail-current-message (rmail-fontify-message))
afbd0214f6ec Must fontify only if we're actually showing a message.
Simon Marshall <simon@gnu.org>
parents: 14749
diff changeset
2961 ;; Prevent Font Lock mode from kicking in.
14467
f95ca90841d7 Fix up specialised fontification stuff.
Simon Marshall <simon@gnu.org>
parents: 14374
diff changeset
2962 (setq font-lock-fontified t))
14374
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2963
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2964 (defun rmail-unfontify-buffer-function ()
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2965 ;; This function's symbol is bound to font-lock-fontify-unbuffer-function.
14467
f95ca90841d7 Fix up specialised fontification stuff.
Simon Marshall <simon@gnu.org>
parents: 14374
diff changeset
2966 (let ((modified (buffer-modified-p))
f95ca90841d7 Fix up specialised fontification stuff.
Simon Marshall <simon@gnu.org>
parents: 14374
diff changeset
2967 (buffer-undo-list t) (inhibit-read-only t)
f95ca90841d7 Fix up specialised fontification stuff.
Simon Marshall <simon@gnu.org>
parents: 14374
diff changeset
2968 before-change-functions after-change-functions
f95ca90841d7 Fix up specialised fontification stuff.
Simon Marshall <simon@gnu.org>
parents: 14374
diff changeset
2969 buffer-file-name buffer-file-truename)
f95ca90841d7 Fix up specialised fontification stuff.
Simon Marshall <simon@gnu.org>
parents: 14374
diff changeset
2970 (save-restriction
f95ca90841d7 Fix up specialised fontification stuff.
Simon Marshall <simon@gnu.org>
parents: 14374
diff changeset
2971 (widen)
f95ca90841d7 Fix up specialised fontification stuff.
Simon Marshall <simon@gnu.org>
parents: 14374
diff changeset
2972 (remove-hook 'rmail-show-message-hook 'rmail-fontify-message t)
f95ca90841d7 Fix up specialised fontification stuff.
Simon Marshall <simon@gnu.org>
parents: 14374
diff changeset
2973 (remove-text-properties (point-min) (point-max) '(rmail-fontified nil))
14898
467e9d219590 (rmail-fontify-message, rmail-unfontify-buffer-function):
Richard M. Stallman <rms@gnu.org>
parents: 14779
diff changeset
2974 (font-lock-default-unfontify-buffer)
467e9d219590 (rmail-fontify-message, rmail-unfontify-buffer-function):
Richard M. Stallman <rms@gnu.org>
parents: 14779
diff changeset
2975 (and (not modified) (buffer-modified-p) (set-buffer-modified-p nil)))))
14374
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2976
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2977 (defun rmail-fontify-message ()
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2978 ;; Fontify the current message if it is not already fontified.
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2979 (if (text-property-any (point-min) (point-max) 'rmail-fontified nil)
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2980 (let ((modified (buffer-modified-p))
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2981 (buffer-undo-list t) (inhibit-read-only t)
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2982 before-change-functions after-change-functions
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2983 buffer-file-name buffer-file-truename)
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2984 (save-excursion
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2985 (save-match-data
e2423983be05 Support for local fontification.
Simon Marshall <simon@gnu.org>
parents: 14370
diff changeset
2986 (add-text-properties (point-min) (point-max) '(rmail-fontified t))
14898
467e9d219590 (rmail-fontify-message, rmail-unfontify-buffer-function):
Richard M. Stallman <rms@gnu.org>
parents: 14779
diff changeset
2987 (font-lock-fontify-region (point-min) (point-max))
467e9d219590 (rmail-fontify-message, rmail-unfontify-buffer-function):
Richard M. Stallman <rms@gnu.org>
parents: 14779
diff changeset
2988 (and (not modified) (buffer-modified-p) (set-buffer-modified-p nil)))))))
14749
4fa605bc770a (unforward-rmail-message): Add autoload declaration.
Richard M. Stallman <rms@gnu.org>
parents: 14747
diff changeset
2989
20757
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
2990 ;;; Speedbar support for RMAIL files.
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
2991 (eval-when-compile (require 'speedbspec))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
2992
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
2993 (defvar rmail-speedbar-last-user nil
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
2994 "The last user to be displayed in the speedbar.")
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
2995
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
2996 (defvar rmail-speedbar-menu-items
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
2997 '(["Browse Item On Line" speedbar-edit-line t]
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
2998 ["Move message to folder" rmail-move-message-to-folder-on-line
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
2999 (save-excursion (beginning-of-line)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3000 (looking-at "<M> "))])
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3001 "Additional menu-items to add to speedbar frame.")
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3002
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3003 (defun rmail-speedbar-buttons (buffer)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3004 "Create buttons for BUFFER containing rmail messages.
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3005 Click on the address under Reply to: to reply to this person.
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3006 Under Folders: Click a name to read it, or on the <M> to move the
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3007 current message into that RMAIL folder."
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3008 (let ((from nil))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3009 (save-excursion
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3010 (set-buffer buffer)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3011 (goto-char (point-min))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3012 (if (not (re-search-forward "^Reply-To: " nil t))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3013 (if (not (re-search-forward "^From:? " nil t))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3014 (setq from t)))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3015 (if from
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3016 nil
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3017 (setq from (buffer-substring (point) (save-excursion
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3018 (end-of-line)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3019 (point))))))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3020 (goto-char (point-min))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3021 (if (and (looking-at "Reply to:")
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3022 (equal from rmail-speedbar-last-user))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3023 nil
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3024 (setq rmail-speedbar-last-user from)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3025 (erase-buffer)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3026 (insert "Reply To:\n")
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3027 (if (stringp from)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3028 (speedbar-insert-button from 'speedbar-directory-face 'highlight
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3029 'rmail-speedbar-button 'rmail-reply))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3030 (insert "Folders:\n")
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3031 (let* ((case-fold-search nil)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3032 (df (directory-files (save-excursion (set-buffer buffer)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3033 default-directory)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3034 nil "^[A-Z0-9]+\\(\\.[A-Z0-9]+\\)?$")))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3035 (while df
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3036 (speedbar-insert-button "<M>" 'speedbar-button-face 'highlight
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3037 'rmail-speedbar-move-message (car df))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3038 (speedbar-insert-button (car df) 'speedbar-file-face 'highlight
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3039 'rmail-speedbar-find-file nil t)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3040 (setq df (cdr df)))))))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3041
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3042 (defun rmail-speedbar-button (text token indent)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3043 "Execute an rmail command specified by TEXT.
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3044 The command used is TOKEN. INDENT is not used."
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3045 (speedbar-with-attached-buffer
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3046 (funcall token t)))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3047
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3048 (defun rmail-speedbar-find-file (text token indent)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3049 "Load in the rmail file TEXT.
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3050 TOKEN and INDENT are not used."
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3051 (speedbar-with-attached-buffer
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3052 (message "Loading in RMAIL file %s..." text)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3053 (find-file text)))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3054
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3055 (defun rmail-move-message-to-folder-on-line ()
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3056 "If the current line is a folder, move current message to it."
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3057 (interactive)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3058 (save-excursion
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3059 (beginning-of-line)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3060 (if (re-search-forward "<M> " (save-excursion (end-of-line) (point)) t)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3061 (progn
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3062 (forward-char -2)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3063 (speedbar-do-function-pointer)))))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3064
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3065 (defun rmail-speedbar-move-message (text token indent)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3066 "From button TEXT, copy current message to the rmail file specified by TOKEN.
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3067 TEXT and INDENT are not used."
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3068 (speedbar-with-attached-buffer
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3069 (message "Moving message to %s" token)
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3070 (rmail-output-to-rmail-file token)))
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3071
f900cfe382e4 Added speedbar support for RMAIL files.
Eric M. Ludlam <zappo@gnu.org>
parents: 20681
diff changeset
3072
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 474
diff changeset
3073 (provide 'rmail)
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 474
diff changeset
3074
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 621
diff changeset
3075 ;;; rmail.el ends here