annotate lisp/mh-e/mh-e.el @ 159:3bb7ccffb0c0 r20-3b6

Import from CVS: tag r20-3b6
author cvs
date Mon, 13 Aug 2007 09:41:43 +0200
parents 34a5b81f86ba
children 5a88923fcbfe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; mh-e.el --- GNU Emacs interface to the MH mail system
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;; Copyright (C) 1985,86,87,88,90,92,93,94,95 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 (defconst mh-e-time-stamp "Time-stamp: <95/10/30 19:14:06 gildea>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 (defconst mh-e-version "5.0.2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 "Version numbers of this version of mh-e.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; Maintainer: Stephen Gildea <gildea@lcs.mit.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; Version: 5.0.2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; Keywords: mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; Bug-reports: include `M-x mh-version' output in any correspondence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; This file is part of mh-e, part of GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; along with GNU Emacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;; HOW TO USE:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;; M-x mh-rmail to read mail. Type C-h m there for a list of commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;; C-u M-x mh-rmail to visit any folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;; M-x mh-smail to send mail. From within the mail reader, "m" works, too.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;;; MH (Message Handler) is a powerful mail reader. The MH newsgroup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;;; is comp.mail.mh; the mailing list is mh-users@ics.uci.edu (send to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;;; mh-users-request to be added). See the monthly Frequently Asked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;;; Questions posting there for information on getting MH and mh-e.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;;; mh-e is an Emacs interface to the MH mail system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;;; The mailing list mh-e@x.org is for discussion of mh-e and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;;; announcements of new versions. Send a "subscribe" message to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;;; mh-e-request@x.org to be added. Do not report bugs here; mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;;; them directly to the author (see top of mh-e.el source).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;;; Include the output of M-x mh-version in any bug report.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;;; mh-e works with GNU Emacs 18 or 19, and MH 6.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;;; NB. MH must have been compiled with the MHE compiler flag or several
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;;; features necessary for mh-e will be missing from MH commands, specifically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;;; the -build switch to repl and forw.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;;; Your .emacs might benefit from these bindings:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;;; (global-set-key "\C-cr" 'mh-rmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;;; (global-set-key "\C-xm" 'mh-smail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;;; (global-set-key "\C-x4m" 'mh-smail-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ;;; Change Log:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;;; Original version for Gosling emacs by Brian Reid, Stanford, 1982.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;;; Modified by James Larus, BBN, July 1984 and UCB, 1984 & 1985.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;;; Rewritten for GNU Emacs, James Larus 1985. larus@ginger.berkeley.edu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 ;;; Modified by Stephen Gildea 1988. gildea@lcs.mit.edu
159
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 134
diff changeset
66 (defconst mh-e-RCS-id "$Id: mh-e.el,v 1.3 1997/06/11 19:25:57 steve Exp $")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (provide 'mh-e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (require 'mh-utils)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 ;;; Hooks:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
76 (defgroup mh nil
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
77 "Emacs interface to the MH mail system"
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
78 :group 'mail)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
80 (defgroup mh-hook nil
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
81 "Hooks to mh-e mode"
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
82 :prefix "mh-"
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
83 :group 'mh)
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
84
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
86 (defcustom mh-folder-mode-hook nil
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
87 "Invoked in MH-Folder mode on a new folder."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
88 :type 'hook
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
89 :group 'mh-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
91 (defcustom mh-inc-folder-hook nil
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
92 "Invoked by \\<mh-folder-mode-map>`\\[mh-inc-folder]' after incorporating mail into a folder."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
93 :type 'hook
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
94 :group 'mh-hook)
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
95
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
96 (defcustom mh-show-hook nil
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
97 "Invoked after \\<mh-folder-mode-map>`\\[mh-show]' shows a message."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
98 :type 'hook
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
99 :group 'mh-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
101 (defcustom mh-show-mode-hook nil
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
102 "Invoked in MH-Show mode on each message."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
103 :type 'hook
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
104 :group 'mh-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
106 (defcustom mh-delete-msg-hook nil
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
107 "Invoked after marking each message for deletion."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
108 :type 'hook
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
109 :group 'mh-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
111 (defcustom mh-refile-msg-hook nil
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
112 "Invoked after marking each message for refiling."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
113 :type 'hook
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
114 :group 'mh-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
116 (defcustom mh-before-quit-hook nil
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
117 "Invoked by \\<mh-folder-mode-map>`\\[mh-quit]' before quitting mh-e. See also mh-quit-hook."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
118 :type 'hook
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
119 :group 'mh-hook)
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
120
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
121 (defcustom mh-quit-hook nil
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
122 "Invoked after \\<mh-folder-mode-map>`\\[mh-quit]' quits mh-e. See also mh-before-quit-hook."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
123 :type 'hook
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
124 :group 'mh-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 ;;; Personal preferences:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
130 (defcustom mh-lpr-command-format "lpr -J '%s'"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 "*Format for Unix command that prints a message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 The string should be a Unix command line, with the string '%s' where
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 the job's name (folder and message number) should appear. The formatted
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
134 message text is piped to this command when you type \\<mh-folder-mode-map>`\\[mh-print-msg]'."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
135 :type 'string
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
136 :group 'mh)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
138 (defcustom mh-scan-prog "scan"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 "*Program to run to generate one-line-per-message listing of a folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 Normally \"scan\" or a file name linked to scan. This file is searched
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 for relative to the mh-progs directory unless it is an absolute pathname.
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
142 Automatically becomes buffer-local when set in any fashion."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
143 :type 'string
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
144 :group 'mh)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (make-variable-buffer-local 'mh-scan-prog)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
147 (defcustom mh-inc-prog "inc"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 "*Program to run to incorporate new mail into a folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 Normally \"inc\". This file is searched for relative to
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
150 the mh-progs directory unless it is an absolute pathname."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
151 :type 'string
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
152 :group 'mh)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153
159
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 134
diff changeset
154 (defcustom mh-folder-coding-system 'ctext
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 134
diff changeset
155 "*Coding-system to decode folder."
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 134
diff changeset
156 :type 'coding-system
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 134
diff changeset
157 :group 'mh)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 134
diff changeset
158 (make-variable-buffer-local 'mh-folder-coding-system)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 134
diff changeset
159
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
160 (defcustom mh-print-background nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 "*Print messages in the background if non-nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 WARNING: do not delete the messages until printing is finished;
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
163 otherwise, your output may be truncated."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
164 :type 'boolean
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
165 :group 'mh)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
167 (defcustom mh-recenter-summary-p nil
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
168 "*Recenter summary window when the show window is toggled off if non-nil."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
169 :type 'boolean
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
170 :group 'mh)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
172 (defcustom mh-do-not-confirm nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 "*Non-nil means do not prompt for confirmation before some mh-e commands.
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
174 Affects non-recoverable commands such as mh-kill-folder and mh-undo-folder."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
175 :type 'boolean
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
176 :group 'mh)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
178 (defcustom mh-store-default-directory nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 "*Last directory used by \\[mh-store-msg]; default for next store.
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
180 A directory name string, or nil to use current directory."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
181 :type '(choice (const :tag "Current" nil)
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
182 directory)
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
183 :group 'mh)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 ;;; Parameterize mh-e to work with different scan formats. The defaults work
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ;;; with the standard MH scan listings, in which the first 4 characters on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ;;; the line are the message number, followed by two places for notations.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (defvar mh-good-msg-regexp "^....[^D^]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 "Regexp specifiying the scan lines that are 'good' messages.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (defvar mh-deleted-msg-regexp "^....D"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 "Regexp matching scan lines of deleted messages.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (defvar mh-refiled-msg-regexp "^....\\^"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 "Regexp matching scan lines of refiled messages.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (defvar mh-valid-scan-line "^ *[0-9]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 "Regexp matching scan lines for messages (not error messages).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (defvar mh-cur-scan-msg-regexp "^....\\+"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 "Regexp matching scan line for the cur message.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (defvar mh-note-deleted "D"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 "String whose first character is used to notate deleted messages.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (defvar mh-note-refiled "^"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 "String whose first character is used to notate refiled messages.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (defvar mh-note-cur "+"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 "String whose first character is used to notate the current message.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (defvar mh-partial-folder-mode-line-annotation "select"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 "Annotation when displaying part of a folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 The string is displayed after the folder's name. NIL for no annotation.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ;;; Internal variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (defvar mh-last-destination nil) ;Destination of last refile or write command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (defvar mh-folder-mode-map (make-keymap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 "Keymap for MH folders.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (defvar mh-delete-list nil) ;List of msg numbers to delete.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (defvar mh-refile-list nil) ;List of folder names in mh-seq-list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (defvar mh-next-direction 'forward) ;Direction to move to next message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (defvar mh-narrowed-to-seq nil) ;Sequence display is narrowed to or nil if not narrowed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (defvar mh-first-msg-num nil) ;Number of first msg in buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (defvar mh-last-msg-num nil) ;Number of last msg in buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (defvar mh-mode-line-annotation nil) ;Indiction this is not the full folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 ;;; Macros and generic functions:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (defun mh-mapc (func list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (while list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (funcall func (car list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (setq list (cdr list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ;;; Entry points:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (defun mh-rmail (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 "Inc(orporate) new mail with MH, or, with arg, scan an MH mail folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 This function is an entry point to mh-e, the Emacs front end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 to the MH mail system."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (mh-find-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (if arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (call-interactively 'mh-visit-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (mh-inc-folder)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 ;;; mh-smail and mh-smail-other-window have been moved to the new file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 ;;; mh-comp.el, but Emacs 18 still looks for them here, so provide a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ;;; definition here, too, for a while.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (defun mh-smail ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 "Compose and send mail with the MH mail system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 This function is an entry point to mh-e, the Emacs front end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 to the MH mail system."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (mh-find-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (require 'mh-comp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (call-interactively 'mh-send))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (defun mh-smail-other-window ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 "Compose and send mail in other window with the MH mail system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 This function is an entry point to mh-e, the Emacs front end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 to the MH mail system."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (mh-find-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (require 'mh-comp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (call-interactively 'mh-send-other-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 ;;; User executable mh-e commands:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (defun mh-delete-msg (msg-or-seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 "Mark the specified MESSAGE(s) for subsequent deletion and move to the next.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 Default is the displayed message. If optional prefix argument is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 given then prompt for the message sequence."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (interactive (list (if current-prefix-arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (mh-read-seq-default "Delete" t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (mh-get-msg-num t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (mh-delete-msg-no-motion msg-or-seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (mh-next-msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (defun mh-delete-msg-no-motion (msg-or-seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 "Mark the specified MESSAGE(s) for subsequent deletion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 Default is the displayed message. If optional prefix argument is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 provided, then prompt for the message sequence."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (interactive (list (if current-prefix-arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (mh-read-seq-default "Delete" t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (mh-get-msg-num t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (if (numberp msg-or-seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (mh-delete-a-msg msg-or-seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (mh-map-to-seq-msgs 'mh-delete-a-msg msg-or-seq)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (defun mh-execute-commands ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 "Process outstanding delete and refile requests."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (if mh-narrowed-to-seq (mh-widen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (mh-process-commands mh-current-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (mh-set-scan-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (mh-goto-cur-msg) ; after mh-set-scan-mode for efficiency
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (mh-make-folder-mode-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 t) ; return t for [local-]write-file-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (defun mh-first-msg ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 "Move to the first message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (while (and (not (eobp)) (not (looking-at mh-valid-scan-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (forward-line 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (defun mh-header-display ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 "Show the current message with all its headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 Displays headers that might have been suppressed by setting the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 variables `mh-clean-message-header' or `mhl-formfile', or by the fallback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 behavior of scrolling uninteresting headers off the top of the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 Type \"\\[mh-show]\" to show the message normally again."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (and (not mh-showing-with-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (or mhl-formfile mh-clean-message-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (mh-invalidate-show-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (let ((mhl-formfile nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (mh-clean-message-header nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (mh-show-msg nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (mh-in-show-buffer (mh-show-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (mh-recenter 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (setq mh-showing-with-headers t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (defun mh-inc-folder (&optional maildrop-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 "Inc(orporate)s new mail into the Inbox folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 Optional prefix argument specifies an alternate maildrop from the default.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 If the prefix argument is given, incorporates mail into the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 folder, otherwise uses the folder named by `mh-inbox'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 Runs `mh-inc-folder-hook' after incorporating new mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 Do not call this function from outside mh-e; use \\[mh-rmail] instead."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (interactive (list (if current-prefix-arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (read-file-name "inc mail from file: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 mh-user-path)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (let ((config (current-window-configuration)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (if (not maildrop-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (cond ((not (get-buffer mh-inbox))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (mh-make-folder mh-inbox)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (setq mh-previous-window-config config))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 ((not (eq (current-buffer) (get-buffer mh-inbox)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (switch-to-buffer mh-inbox)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (setq mh-previous-window-config config)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (mh-get-new-mail maildrop-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (run-hooks 'mh-inc-folder-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (defun mh-last-msg ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 "Move to the last message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (while (and (not (bobp)) (looking-at "^$"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (forward-line -1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (defun mh-next-undeleted-msg (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 "Move to the NTH next undeleted message in window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (setq mh-next-direction 'forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (cond ((re-search-forward mh-good-msg-regexp nil 0 arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (mh-maybe-show))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (if (get-buffer mh-show-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (delete-windows-on mh-show-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (defun mh-refile-msg (msg-or-seq folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 "Refile MESSAGE(s) (default: displayed message) into FOLDER.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 If optional prefix argument provided, then prompt for message sequence."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (list (if current-prefix-arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (mh-read-seq-default "Refile" t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (mh-get-msg-num t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (intern
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (mh-prompt-for-folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 "Destination"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (or (and mh-default-folder-for-message-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (let ((refile-file (mh-msg-filename (mh-get-msg-num t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (set-buffer (get-buffer-create mh-temp-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (insert-file-contents refile-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (let ((buffer-file-name refile-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (funcall mh-default-folder-for-message-function)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (and (eq 'refile (car mh-last-destination))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (symbol-name (cdr mh-last-destination)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (setq mh-last-destination (cons 'refile folder))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (if (numberp msg-or-seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (mh-refile-a-msg msg-or-seq folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (mh-map-to-seq-msgs 'mh-refile-a-msg msg-or-seq folder))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (mh-next-msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (defun mh-refile-or-write-again (message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 "Re-execute the last refile or write command on the given MESSAGE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 Default is the displayed message. Use the same folder or file as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 previous refile or write command."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (interactive (list (mh-get-msg-num t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (if (null mh-last-destination)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (error "No previous refile or write"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (cond ((eq (car mh-last-destination) 'refile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (mh-refile-a-msg message (cdr mh-last-destination))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (message "Destination folder: %s" (cdr mh-last-destination)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (apply 'mh-write-msg-to-file message (cdr mh-last-destination))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (message "Destination: %s" (cdr mh-last-destination))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (mh-next-msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (defun mh-quit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 "Quit the current mh-e folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 Start by running mh-before-quit-hook. Restore the previous window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 configuration, if one exists. Finish by running mh-quit-hook."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (run-hooks 'mh-before-quit-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (mh-update-sequences)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (mh-invalidate-show-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (bury-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (if (get-buffer mh-show-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (bury-buffer mh-show-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (if mh-previous-window-config
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (set-window-configuration mh-previous-window-config))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (run-hooks 'mh-quit-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (defun mh-page-msg (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 "Page the displayed message forwards.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 Scrolls ARG lines or a full screen if no argument is supplied."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (scroll-other-window arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (defun mh-previous-page (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 "Page the displayed message backwards.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 Scrolls ARG lines or a full screen if no argument is supplied."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (mh-in-show-buffer (mh-show-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (scroll-down arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (defun mh-previous-undeleted-msg (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 "Move to the NTH previous undeleted message in window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (setq mh-next-direction 'backward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (cond ((re-search-backward mh-good-msg-regexp nil 0 arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (mh-maybe-show))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (if (get-buffer mh-show-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (delete-windows-on mh-show-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (defun mh-rescan-folder (&optional range)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 "Rescan a folder after optionally processing the outstanding commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 If optional prefix argument is provided, prompt for the range of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 messages to display. Otherwise show the entire folder."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (interactive (list (if current-prefix-arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (mh-read-msg-range "Range to scan [all]? ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (setq mh-next-direction 'forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (mh-scan-folder mh-current-folder (or range "all")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (defun mh-write-msg-to-file (msg file no-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 "Append MESSAGE to the end of a FILE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 If NO-HEADERS (prefix argument) is provided, write only the message body.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 Otherwise send the entire message including the headers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 (list (mh-get-msg-num t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (let ((default-dir (if (eq 'write (car mh-last-destination))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (file-name-directory (car (cdr mh-last-destination)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 default-directory)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (read-file-name (format "Save message%s in file: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (if current-prefix-arg " body" ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 default-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (if (eq 'write (car mh-last-destination))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (car (cdr mh-last-destination))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (expand-file-name "mail.out" default-dir))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 current-prefix-arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (let ((msg-file-to-output (mh-msg-filename msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (output-file (mh-expand-file-name file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (setq mh-last-destination (list 'write file (if no-headers 'no-headers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (set-buffer (get-buffer-create mh-temp-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (insert-file-contents msg-file-to-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (if no-headers (search-forward "\n\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (append-to-file (point) (point-max) output-file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (defun mh-toggle-showing ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 "Toggle the scanning mode/showing mode of displaying messages."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (if mh-showing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (mh-set-scan-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (mh-show)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (defun mh-undo (msg-or-seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 "Undo the pending deletion or refile of the specified MESSAGE(s).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 Default is the displayed message. If optional prefix argument is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 provided, then prompt for the message sequence."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (interactive (list (if current-prefix-arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (mh-read-seq-default "Undo" t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (mh-get-msg-num t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (cond ((numberp msg-or-seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 (let ((original-position (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (while (not (or (looking-at mh-deleted-msg-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (looking-at mh-refiled-msg-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (and (eq mh-next-direction 'forward) (bobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (and (eq mh-next-direction 'backward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (save-excursion (forward-line) (eobp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (forward-line (if (eq mh-next-direction 'forward) -1 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (if (or (looking-at mh-deleted-msg-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (looking-at mh-refiled-msg-regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (mh-undo-msg (mh-get-msg-num t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (mh-maybe-show))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (goto-char original-position)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (error "Nothing to undo"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (mh-map-to-seq-msgs 'mh-undo-msg msg-or-seq)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 ;; update the mh-refile-list so mh-outstanding-commands-p will work
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (mh-mapc (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (lambda (elt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (if (not (mh-seq-to-msgs elt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (setq mh-refile-list (delq elt mh-refile-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 mh-refile-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (if (not (mh-outstanding-commands-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (mh-set-folder-modified-p nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (defun mh-version ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 "Display version information about mh-e and the MH mail handling system."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (mh-find-progs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (set-buffer (get-buffer-create mh-temp-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (insert " mh-e info:\n\nversion: " mh-e-version "\n" mh-e-time-stamp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 "\nEmacs: " emacs-version " on " (symbol-name system-type) " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (call-process "uname" nil t nil "-a")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (file-error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (insert "\n\n MH info:\n\n" (expand-file-name "inc" mh-progs) ":\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (let ((help-start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (condition-case err-data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (mh-exec-cmd-output "inc" nil "-help")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (file-error (insert (mapconcat 'concat (cdr err-data) ": "))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (goto-char help-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (search-forward "version: " nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (delete-region help-start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (goto-char (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (display-buffer mh-temp-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (defun mh-visit-folder (folder &optional range)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 "Visit FOLDER and display RANGE of messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 Do not call this function from outside mh-e; see \\[mh-rmail] instead."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (interactive (list (mh-prompt-for-folder "Visit" mh-inbox t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (mh-read-msg-range "Range [all]? ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (let ((config (current-window-configuration)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (mh-scan-folder folder (or range "all"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (setq mh-previous-window-config config))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (defun mh-compat-quit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 "The \"b\" key is obsolescent; will assume you want \"\\[mh-quit]\" ..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 ;; Was going to make it run mh-burst-digest, but got complaint that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 ;; 'b' should mean 'back', as it does in info, less, and rn.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 ;; This is a temporary compatibility function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (message "%s" (documentation this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 (sit-for 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (call-interactively 'mh-quit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (defun mh-update-sequences ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 "Update MH's Unseen sequence and current folder and message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 Flush mh-e's state out to MH. The message at the cursor becomes current."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 ;; mh-update-sequences is the opposite of mh-read-folder-sequences,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 ;; which updates mh-e's state from MH.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (let ((folder-set (mh-update-unseen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (new-cur (mh-get-msg-num nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (if new-cur
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (let ((seq-entry (mh-find-seq 'cur)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (mh-remove-cur-notation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (setcdr seq-entry (list new-cur)) ;delete-seq-locally, add-msgs-to-seq
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (mh-define-sequence 'cur (list new-cur))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (if (looking-at mh-good-msg-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (mh-notate nil mh-note-cur mh-cmd-note)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (or folder-set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (mh-exec-cmd-quiet t "folder" mh-current-folder "-fast"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 ;;; Support routines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 (defun mh-delete-a-msg (msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 ;; Delete the MESSAGE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (mh-goto-msg msg nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (if (looking-at mh-refiled-msg-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 (error "Message %d is refiled. Undo refile before deleting." msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (if (looking-at mh-deleted-msg-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (mh-set-folder-modified-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (setq mh-delete-list (cons msg mh-delete-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (mh-add-msgs-to-seq msg 'deleted t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (mh-notate msg mh-note-deleted mh-cmd-note)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 (run-hooks 'mh-delete-msg-hook))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 (defun mh-refile-a-msg (msg destination)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 ;; Refile MESSAGE in FOLDER. FOLDER is a symbol, not a string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (mh-goto-msg msg nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 (cond ((looking-at mh-deleted-msg-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (error "Message %d is deleted. Undo delete before moving." msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 ((looking-at mh-refiled-msg-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (if (y-or-n-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (format "Message %d already refiled. Copy to %s as well? "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 msg destination))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 (mh-exec-cmd "refile" (mh-get-msg-num t) "-link"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 "-src" mh-current-folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (symbol-name destination))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 (message "Message not copied.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (mh-set-folder-modified-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (if (not (memq destination mh-refile-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (setq mh-refile-list (cons destination mh-refile-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (if (not (memq msg (mh-seq-to-msgs destination)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 (mh-add-msgs-to-seq msg destination t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (mh-notate msg mh-note-refiled mh-cmd-note)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (run-hooks 'mh-refile-msg-hook)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (defun mh-next-msg ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 ;; Move backward or forward to the next undeleted message in the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 (if (eq mh-next-direction 'forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (mh-next-undeleted-msg 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (mh-previous-undeleted-msg 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 (defun mh-set-scan-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 ;; Display the scan listing buffer, but do not show a message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 (if (get-buffer mh-show-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 (delete-windows-on mh-show-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 (setq mh-showing nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 (set-buffer-modified-p (buffer-modified-p)) ;force mode line update
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (if mh-recenter-summary-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 (mh-recenter nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 (defun mh-undo-msg (msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 ;; Undo the deletion or refile of one MESSAGE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 (cond ((memq msg mh-delete-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (setq mh-delete-list (delq msg mh-delete-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (mh-delete-msg-from-seq msg 'deleted t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (mh-mapc (function (lambda (dest)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 (mh-delete-msg-from-seq msg dest t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 mh-refile-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 (mh-notate msg ? mh-cmd-note))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 ;;; The folder data abstraction.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (defun mh-make-folder (name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 ;; Create and initialize a new mail folder called NAME and make it the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 ;; current folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 (switch-to-buffer name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (setq buffer-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (mh-folder-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (mh-set-folder-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (setq buffer-file-name mh-folder-filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (mh-make-folder-mode-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 ;;; Ensure new buffers won't get this mode if default-major-mode is nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (put 'mh-folder-mode 'mode-class 'special)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 (defun mh-folder-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 "Major mh-e mode for \"editing\" an MH folder scan listing.\\<mh-folder-mode-map>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 You can show the message the cursor is pointing to, and step through the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 messages. Messages can be marked for deletion or refiling into another
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 folder; these commands are executed all at once with a separate command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 A prefix argument (\\[universal-argument]) to delete, refile, list, or undo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 applies the action to a message sequence.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 Here is a list of the standard keys for mh-e commands, grouped by function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 This list is purposefully not customized; mh-e has a long history, and many
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 alternate key bindings as a result. This list is to encourage users to use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 standard keys so the other keys can perhaps someday be put to new uses.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 t toggle show or scan-only mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 RET show message, or back to top if already showing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 SPC page message forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 DEL page message back
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 n next message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 p previous message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 g go to message by number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 d mark for deletion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 o, ^ mark for output (refile) to another folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 ? show folder of pending refile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 u undo delete or refile marking
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 x execute marked deletes and refiles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 i incorporate new mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 m mail a new message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 r reply to a message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 f forward a message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 q quit mh-e
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 M-f visit new folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 M-r rescan this folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 Here are all the commands with their current binding, listed in key order:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 \\{mh-folder-mode-map}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 Variables controlling mh-e operation are (defaults in parentheses):
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 mh-recursive-folders (nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 Non-nil means commands which operate on folders do so recursively.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 mh-bury-show-buffer (t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 Non-nil means that the buffer used to display message is buried.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 It will never be offered as the default other buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 mh-clean-message-header (nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 Non-nil means remove header lines matching the regular expression
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 specified in mh-invisible-headers from messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 mh-visible-headers (nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 If non-nil, it contains a regexp specifying the headers that are shown in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 a message if mh-clean-message-header is non-nil. Setting this variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 overrides mh-invisible-headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 mh-do-not-confirm (nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 Non-nil means do not prompt for confirmation before executing some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 non-recoverable commands such as mh-kill-folder and mh-undo-folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 mhl-formfile (nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 Name of format file to be used by mhl to show messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 A value of T means use the default format file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 Nil means don't use mhl to format messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 mh-lpr-command-format (\"lpr -p -J '%s'\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 Format for command used to print a message on a system printer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 mh-scan-prog (\"scan\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 Program to run to generate one-line-per-message listing of a folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 Normally \"scan\" or a file name linked to scan. This file is searched
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 for relative to the mh-progs directory unless it is an absolute pathname.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 Automatically becomes buffer-local when set in any fashion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 mh-print-background (nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 Print messages in the background if non-nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 WARNING: do not delete the messages until printing is finished;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 otherwise, your output may be truncated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 mh-recenter-summary-p (nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 If non-nil, then the scan listing is recentered when the window displaying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 a messages is toggled off.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 mh-summary-height (4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 Number of lines in the summary window including the mode line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 The value of mh-folder-mode-hook is called when a new folder is set up."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 (kill-all-local-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 (use-local-map mh-folder-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 (setq major-mode 'mh-folder-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (mh-set-mode-name "MH-Folder")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 (mh-make-local-vars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 'mh-current-folder (buffer-name) ; Name of folder, a string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 'mh-show-buffer (format "show-%s" (buffer-name)) ; Buffer that displays msgs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 'mh-folder-filename ; e.g. "/usr/foobar/Mail/inbox/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 (file-name-as-directory (mh-expand-file-name (buffer-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 'mh-showing nil ; Show message also?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 'mh-delete-list nil ; List of msgs nums to delete
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 'mh-refile-list nil ; List of folder names in mh-seq-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 'mh-seq-list nil ; Alist of (seq . msgs) nums
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 'mh-seen-list nil ; List of displayed messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 'mh-next-direction 'forward ; Direction to move to next message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 'mh-narrowed-to-seq nil ; Sequence display is narrowed to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 'mh-first-msg-num nil ; Number of first msg in buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 'mh-last-msg-num nil ; Number of last msg in buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 'mh-msg-count nil ; Number of msgs in buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 'mh-mode-line-annotation nil ; Indiction this is not the full folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 'mh-previous-window-config nil) ; Previous window configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 (setq truncate-lines t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 (auto-save-mode -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 (setq buffer-offer-save t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 ;; XEmacs change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 (if (featurep 'scrollbar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 (set-specifier scrollbar-height (cons (current-buffer) 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (if (boundp 'local-write-file-hooks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 (setq local-write-file-hooks '(mh-execute-commands)) ;Emacs 19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (make-local-variable 'write-file-hooks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 (setq write-file-hooks '(mh-execute-commands))) ;Emacs 18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 (make-local-variable 'revert-buffer-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 (setq revert-buffer-function 'mh-undo-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 (or (assq 'mh-showing minor-mode-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 (setq minor-mode-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 (cons '(mh-showing " Show") minor-mode-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 (run-hooks 'mh-folder-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 (defun mh-make-local-vars (&rest pairs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 ;; Take VARIABLE-VALUE pairs and make local variables initialized to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 ;; value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 (while pairs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (make-variable-buffer-local (car pairs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (set (car pairs) (car (cdr pairs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (setq pairs (cdr (cdr pairs)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (defun mh-scan-folder (folder range)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 ;; Scan the FOLDER over the RANGE. Return in the folder's buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 (cond ((null (get-buffer folder))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (mh-make-folder folder))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 (mh-process-or-undo-commands folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 (switch-to-buffer folder)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 (mh-regenerate-headers range)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 (cond ((zerop (buffer-size))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 (if (equal range "all")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (message "Folder %s is empty" folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 (message "No messages in %s, range %s" folder range))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 (sit-for 5)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 (mh-goto-cur-msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 (defun mh-regenerate-headers (range &optional update)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 ;; scan folder over range RANGE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 ;; If UPDATE, append the scan lines, otherwise replace.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 (let ((folder mh-current-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 scan-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (message "Scanning %s..." folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 (with-mh-folder-updating (nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 (if update
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 (erase-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 (setq scan-start (point))
159
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 134
diff changeset
893 (let ((coding-system-for-read mh-folder-coding-system))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 134
diff changeset
894 (mh-exec-cmd-output mh-scan-prog nil
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 134
diff changeset
895 "-noclear" "-noheader"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 134
diff changeset
896 "-width" (window-width)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents: 134
diff changeset
897 folder range))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (goto-char scan-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (cond ((looking-at "scan: no messages in")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (keep-lines mh-valid-scan-line)) ; Flush random scan lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 ((looking-at "scan: ")) ; Keep error messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 (keep-lines mh-valid-scan-line))) ; Flush random scan lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (setq mh-seq-list (mh-read-folder-sequences folder nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 (mh-notate-user-sequences)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 (or update
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 (setq mh-mode-line-annotation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 (if (equal range "all")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 mh-partial-folder-mode-line-annotation)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 (mh-make-folder-mode-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 (message "Scanning %s...done" folder)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (defun mh-get-new-mail (maildrop-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 ;; Read new mail from a maildrop into the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 ;; Return in the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 (let ((point-before-inc (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 (folder mh-current-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 (new-mail-p nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 (with-mh-folder-updating (t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (message (if maildrop-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 (format "inc %s -file %s..." folder maildrop-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 (format "inc %s..." folder)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 (setq mh-next-direction 'forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 (let ((start-of-inc (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 (if maildrop-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 ;; I think MH 5 used "-ms-file" instead of "-file",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 ;; which would make inc'ing from maildrops fail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 (mh-exec-cmd-output mh-inc-prog nil folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 "-file" (expand-file-name maildrop-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 "-width" (window-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 "-truncate")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 (mh-exec-cmd-output mh-inc-prog nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 "-width" (window-width)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (if maildrop-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 (format "inc %s -file %s...done" folder maildrop-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (format "inc %s...done" folder)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 (goto-char start-of-inc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 (cond ((save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (re-search-forward "^inc: no mail" nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 (message "No new mail%s%s" (if maildrop-name " in " "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 (if maildrop-name maildrop-name "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 ((re-search-forward "^inc:" nil t) ; Error messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (error "inc error"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 (mh-remove-cur-notation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 (setq new-mail-p t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 (keep-lines mh-valid-scan-line) ; Flush random scan lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 (setq mh-seq-list (mh-read-folder-sequences folder t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (mh-notate-user-sequences)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 (if new-mail-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 (mh-make-folder-mode-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 (mh-goto-cur-msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 (goto-char point-before-inc))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 (defun mh-make-folder-mode-line (&optional ignored)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 ;; Set the fields of the mode line for a folder buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 ;; The optional argument is now obsolete. It used to be used to pass
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 ;; in what is now stored in the buffer-local variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 ;; mh-mode-line-annotation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 (mh-first-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 (setq mh-first-msg-num (mh-get-msg-num nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 (mh-last-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 (setq mh-last-msg-num (mh-get-msg-num nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 (setq mh-msg-count (count-lines (point-min) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (setq mode-line-buffer-identification
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 (list (format "{%%b%s} %d msg%s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (if mh-mode-line-annotation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (format "/%s" mh-mode-line-annotation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 mh-msg-count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 (if (zerop mh-msg-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 "s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 (if (> mh-msg-count 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 (format "s (%d-%d)" mh-first-msg-num
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 mh-last-msg-num)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (format " (%d)" mh-first-msg-num))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 (defun mh-unmark-all-headers (remove-all-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 ;; Remove all '+' flags from the headers, and if called with a non-nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 ;; argument, remove all 'D', '^' and '%' flags too.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 ;; Optimized for speed (i.e., no regular expressions).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 (let ((case-fold-search nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 (last-line (1- (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 char)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 (mh-first-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 (while (<= (point) last-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 (forward-char mh-cmd-note)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 (setq char (following-char))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 (if (or (and remove-all-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (or (eql char (aref mh-note-deleted 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 (eql char (aref mh-note-refiled 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 (eql char (aref mh-note-cur 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 (delete-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 (insert " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 (if remove-all-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 (if (eql (following-char) (aref mh-note-seq 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 (delete-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 (insert " ")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 (forward-line)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 (defun mh-remove-cur-notation ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 ;; Remove old cur notation (cf mh-goto-cur-msg code).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (let ((cur-msg (car (mh-seq-to-msgs 'cur))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 (and cur-msg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 (mh-goto-msg cur-msg t t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 (looking-at mh-cur-scan-msg-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 (mh-notate nil ? mh-cmd-note)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 (defun mh-goto-cur-msg ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 ;; Position the cursor at the current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 (let ((cur-msg (car (mh-seq-to-msgs 'cur))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 (cond ((and cur-msg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (mh-goto-msg cur-msg t t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 (mh-notate nil mh-note-cur mh-cmd-note)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 (mh-recenter 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 (mh-maybe-show cur-msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 (mh-last-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 (message "No current message")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 (defun mh-process-or-undo-commands (folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 ;; If FOLDER has outstanding commands, then either process or discard them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 ;; Called by functions like mh-sort-folder, so also invalidate show buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 (set-buffer folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 (if (mh-outstanding-commands-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 (if (or mh-do-not-confirm
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 (y-or-n-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 "Process outstanding deletes and refiles (or lose them)? "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 (mh-process-commands folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 (mh-undo-folder)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (mh-update-unseen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 (mh-invalidate-show-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 (defun mh-process-commands (folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 ;; Process outstanding commands for the folder FOLDER.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 (message "Processing deletes and refiles for %s..." folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 (set-buffer folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 (with-mh-folder-updating (nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 ;; Update the unseen sequence if it exists
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 (mh-update-unseen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 ;; Then refile messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 (mh-mapc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 (lambda (dest)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 (let ((msgs (mh-seq-to-msgs dest)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 (cond (msgs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 (apply 'mh-exec-cmd "refile"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 "-src" folder (symbol-name dest)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 (mh-coalesce-msg-list msgs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 (mh-delete-scan-msgs msgs))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 mh-refile-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 (setq mh-refile-list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 ;; Now delete messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 (cond (mh-delete-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 (apply 'mh-exec-cmd "rmm" folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 (mh-coalesce-msg-list mh-delete-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 (mh-delete-scan-msgs mh-delete-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 (setq mh-delete-list nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 ;; Don't need to remove sequences since delete and refile do so.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 ;; Mark cur message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 (if (> (buffer-size) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (mh-define-sequence 'cur (list (or (mh-get-msg-num nil) "last"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 (and (buffer-file-name (get-buffer mh-show-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 (not (file-exists-p (buffer-file-name (get-buffer mh-show-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 ;; If "inc" were to put a new msg in this file,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 ;; we would not notice, so mark it invalid now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 (mh-invalidate-show-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 (setq mh-seq-list (mh-read-folder-sequences mh-current-folder nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 (mh-unmark-all-headers t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 (mh-notate-user-sequences)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 (message "Processing deletes and refiles for %s...done" folder)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 (defun mh-update-unseen ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 ;; Flush updates to the Unseen sequence out to MH.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 ;; Return non-NIL iff set the MH folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 (if mh-seen-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 (let* ((unseen-seq (mh-find-seq mh-unseen-seq))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 (unseen-msgs (mh-seq-msgs unseen-seq)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 (if unseen-msgs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 (mh-undefine-sequence mh-unseen-seq mh-seen-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 (while mh-seen-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 (setq unseen-msgs (delq (car mh-seen-list) unseen-msgs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 (setq mh-seen-list (cdr mh-seen-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 (setcdr unseen-seq unseen-msgs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 t) ;since we set the folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 (setq mh-seen-list nil)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 (defun mh-delete-scan-msgs (msgs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 ;; Delete the scan listing lines for each of the msgs in the LIST.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 (while msgs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 (if (mh-goto-msg (car msgs) t t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 (mh-delete-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 (setq msgs (cdr msgs)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 (defun mh-outstanding-commands-p ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 ;; Returns non-nil if there are outstanding deletes or refiles.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 (or mh-delete-list mh-refile-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 (defun mh-coalesce-msg-list (messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 ;; Give a list of MESSAGES, return a list of message number ranges.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 ;; Sort of the opposite of mh-read-msg-list, which expands ranges.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 ;; Message lists passed to MH programs go through this so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 ;; command line arguments won't exceed system limits.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 (let ((msgs (sort (copy-sequence messages) 'mh-greaterp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 (range-high nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 (prev -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 (ranges nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 (while prev
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 (if range-high
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 (if (or (not (numberp prev))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 (not (eql (car msgs) (1- prev))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 (progn ;non-sequential, flush old range
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 (if (eql prev range-high)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 (setq ranges (cons range-high ranges))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 (setq ranges (cons (format "%s-%s" prev range-high) ranges)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 (setq range-high nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 (or range-high
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 (setq range-high (car msgs))) ;start new or first range
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 (setq prev (car msgs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 (setq msgs (cdr msgs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 ranges))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 (defun mh-greaterp (msg1 msg2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 ;; Sort two message indicators. Strings are "smaller" than numbers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 ;; Legal values are things like "cur", "last", 1, and 1820.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 (if (numberp msg1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 (if (numberp msg2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 (> msg1 msg2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 (if (numberp msg2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 (string-lessp msg2 msg1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 ;;; Basic sequence handling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 (defun mh-delete-seq-locally (seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 ;; Remove mh-e's record of SEQUENCE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 (let ((entry (mh-find-seq seq)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 (setq mh-seq-list (delq entry mh-seq-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 (defun mh-read-folder-sequences (folder save-refiles)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 ;; Read and return the predefined sequences for a FOLDER.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 ;; If SAVE-REFILES is non-nil, then keep the sequences
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 ;; that note messages to be refiled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 (let ((seqs ()))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 (cond (save-refiles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 (mh-mapc (function (lambda (seq) ; Save the refiling sequences
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 (if (mh-folder-name-p (mh-seq-name seq))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 (setq seqs (cons seq seqs)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 mh-seq-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 (if (eq 0 (mh-exec-cmd-quiet nil "mark" folder "-list"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 ;; look for name in line of form "cur: 4" or "myseq (private): 23"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 (while (re-search-forward "^[^: ]+" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 (setq seqs (cons (mh-make-seq (intern (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 (mh-read-msg-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 seqs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 (delete-region (point-min) (point))))) ; avoid race with mh-process-daemon
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 seqs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 (defun mh-read-msg-list ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 ;; Return a list of message numbers from the current point to the end of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 ;; the line. Expands ranges into set of individual numbers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 (let ((msgs ())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 (end-of-line (save-excursion (end-of-line) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 num)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 (while (re-search-forward "[0-9]+" end-of-line t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 (setq num (string-to-int (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 (cond ((looking-at "-") ; Message range
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 (re-search-forward "[0-9]+" end-of-line t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 (let ((num2 (string-to-int (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 (if (< num2 num)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 (error "Bad message range: %d-%d" num num2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 (while (<= num num2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 (setq msgs (cons num msgs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 (setq num (1+ num)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 ((not (zerop num)) ;"pick" outputs "0" to mean no match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 (setq msgs (cons num msgs)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 msgs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 (defun mh-notate-user-sequences ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 ;; Mark the scan listing of all messages in user-defined sequences.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 (let ((seqs mh-seq-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 (while seqs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 (setq name (mh-seq-name (car seqs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 (if (not (mh-internal-seq name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 (mh-notate-seq name mh-note-seq (1+ mh-cmd-note)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 (setq seqs (cdr seqs)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 (defun mh-internal-seq (name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 ;; Return non-NIL if NAME is the name of an internal mh-e sequence.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 (or (memq name '(answered cur deleted forwarded printed))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 (eq name mh-unseen-seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 (eq name mh-previous-seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 (mh-folder-name-p name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 (defun mh-delete-msg-from-seq (message sequence &optional internal-flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 "Delete MESSAGE from SEQUENCE. MESSAGE defaults to displayed message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 From Lisp, optional third arg INTERNAL-FLAG non-nil means do not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 inform MH of the change."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 (interactive (list (mh-get-msg-num t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 (mh-read-seq-default "Delete from" t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 (let ((entry (mh-find-seq sequence)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 (cond (entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 (mh-notate-if-in-one-seq message ? (1+ mh-cmd-note) sequence)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 (if (not internal-flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 (mh-undefine-sequence sequence (list message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 (setcdr entry (delq message (mh-seq-msgs entry)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 (defun mh-undefine-sequence (seq msgs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 ;; Remove from the SEQUENCE the list of MSGS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 (mh-exec-cmd "mark" mh-current-folder "-delete"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 "-sequence" (symbol-name seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 (mh-coalesce-msg-list msgs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 (defun mh-define-sequence (seq msgs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 ;; Define the SEQUENCE to contain the list of MSGS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 ;; Do not mark pseudo-sequences or empty sequences.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 ;; Signals an error if SEQUENCE is an illegal name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 (if (and msgs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 (not (mh-folder-name-p seq)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 (mh-exec-cmd-error nil "mark" mh-current-folder "-add" "-zero"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 "-sequence" (symbol-name seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 (mh-coalesce-msg-list msgs)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 (defun mh-map-over-seqs (func seq-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 ;; Apply the FUNCTION to each element in the list of SEQUENCES,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 ;; passing the sequence name and the list of messages as arguments.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 (while seq-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 (funcall func (mh-seq-name (car seq-list)) (mh-seq-msgs (car seq-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 (setq seq-list (cdr seq-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 (defun mh-notate-if-in-one-seq (msg notation offset seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 ;; If the MESSAGE is in only the SEQUENCE, then mark the scan listing of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 ;; message with the CHARACTER at the given OFFSET from the beginning of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 ;; listing line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 (let ((in-seqs (mh-seq-containing-msg msg nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 (if (and (eq seq (car in-seqs)) (null (cdr in-seqs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 (mh-notate msg notation offset))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 (defun mh-seq-containing-msg (msg &optional include-internal-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 ;; Return a list of the sequences containing MESSAGE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 ;; If INCLUDE-INTERNAL-P non-nil, include mh-e internal sequences in list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 (let ((l mh-seq-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 (seqs ()))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 (while l
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 (and (memq msg (mh-seq-msgs (car l)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 (or include-internal-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 (not (mh-internal-seq (mh-seq-name (car l)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 (setq seqs (cons (mh-seq-name (car l)) seqs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 (setq l (cdr l)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 seqs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 ;;; User prompting commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 (defun mh-read-msg-range (prompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 ;; Read a list of blank-separated items.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 (let* ((buf (read-string prompt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 (buf-size (length buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 (start 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 (input ()))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 (while (< start buf-size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 (let ((next (read-from-string buf start buf-size)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 (setq input (cons (car next) input))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 (setq start (cdr next))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 (nreverse input)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 ;;; Build the folder-mode keymap:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 (suppress-keymap mh-folder-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 (define-key mh-folder-mode-map "q" 'mh-quit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 (define-key mh-folder-mode-map "b" 'mh-compat-quit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 (define-key mh-folder-mode-map "?" 'mh-msg-is-in-seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 (define-key mh-folder-mode-map "%" 'mh-put-msg-in-seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 (define-key mh-folder-mode-map "|" 'mh-pipe-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 (define-key mh-folder-mode-map "\ea" 'mh-edit-again)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 (define-key mh-folder-mode-map "\e%" 'mh-delete-msg-from-seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 (define-key mh-folder-mode-map "\e#" 'mh-delete-seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 (define-key mh-folder-mode-map "\C-xn" 'mh-narrow-to-seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 (define-key mh-folder-mode-map "\C-xw" 'mh-widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 (define-key mh-folder-mode-map "\eb" 'mh-burst-digest)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 (define-key mh-folder-mode-map "\eu" 'mh-undo-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 (define-key mh-folder-mode-map "\e " 'mh-page-digest)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 (define-key mh-folder-mode-map "\e\177" 'mh-page-digest-backwards)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 (define-key mh-folder-mode-map "\ed" 'mh-redistribute)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 (define-key mh-folder-mode-map "\ee" 'mh-extract-rejected-mail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 (define-key mh-folder-mode-map "\ef" 'mh-visit-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 (define-key mh-folder-mode-map "\ek" 'mh-kill-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 (define-key mh-folder-mode-map "\el" 'mh-list-folders)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 (define-key mh-folder-mode-map "\en" 'mh-store-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 (define-key mh-folder-mode-map "\ep" 'mh-pack-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 (define-key mh-folder-mode-map "\eq" 'mh-list-sequences)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 (define-key mh-folder-mode-map "\es" 'mh-search-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 (define-key mh-folder-mode-map "\er" 'mh-rescan-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 (define-key mh-folder-mode-map "l" 'mh-print-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 (define-key mh-folder-mode-map "t" 'mh-toggle-showing)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 (define-key mh-folder-mode-map "c" 'mh-copy-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 (define-key mh-folder-mode-map "i" 'mh-inc-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 (define-key mh-folder-mode-map "x" 'mh-execute-commands)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 (define-key mh-folder-mode-map "e" 'mh-execute-commands)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 (define-key mh-folder-mode-map "f" 'mh-forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 (define-key mh-folder-mode-map "m" 'mh-send)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 (define-key mh-folder-mode-map "s" 'mh-send)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 (define-key mh-folder-mode-map "r" 'mh-reply)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 (define-key mh-folder-mode-map "a" 'mh-reply)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 (define-key mh-folder-mode-map "j" 'mh-goto-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 (define-key mh-folder-mode-map "g" 'mh-goto-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 (define-key mh-folder-mode-map "\e<" 'mh-first-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 (define-key mh-folder-mode-map "\e>" 'mh-last-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 (define-key mh-folder-mode-map "\177" 'mh-previous-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 (define-key mh-folder-mode-map " " 'mh-page-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 (define-key mh-folder-mode-map "\r" 'mh-show)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 (define-key mh-folder-mode-map "." 'mh-show)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 (define-key mh-folder-mode-map "," 'mh-header-display)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 (define-key mh-folder-mode-map "u" 'mh-undo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 (define-key mh-folder-mode-map "d" 'mh-delete-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 (define-key mh-folder-mode-map "\C-d" 'mh-delete-msg-no-motion)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 (define-key mh-folder-mode-map "p" 'mh-previous-undeleted-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 (define-key mh-folder-mode-map "n" 'mh-next-undeleted-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 (define-key mh-folder-mode-map "o" 'mh-refile-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 (define-key mh-folder-mode-map "^" 'mh-refile-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 (define-key mh-folder-mode-map "\C-o" 'mh-write-msg-to-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 (define-key mh-folder-mode-map ">" 'mh-write-msg-to-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 (define-key mh-folder-mode-map "!" 'mh-refile-or-write-again)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 ;; "C-c /" prefix is used in mh-folder-mode by pgp.el and mailcrypt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 ;;;autoload the other mh-e parts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 ;;; mh-comp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 (autoload 'mh-smail "mh-comp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 "Compose and send mail with the MH mail system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 This function is an entry point to mh-e, the Emacs front end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 to the MH mail system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 See documentation of `\\[mh-send]' for more details on composing mail." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 (autoload 'mh-smail-other-window "mh-comp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 "Compose and send mail in other window with the MH mail system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 This function is an entry point to mh-e, the Emacs front end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 to the MH mail system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 See documentation of `\\[mh-send]' for more details on composing mail." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 (autoload 'mh-edit-again "mh-comp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 "Clean-up a draft or a message previously sent and make it resendable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 Default is the current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 The variable mh-new-draft-cleaned-headers specifies the headers to remove.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 See also documentation for `\\[mh-send]' function." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 (autoload 'mh-extract-rejected-mail "mh-comp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 "Extract a letter returned by the mail system and make it resendable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 Default is the current message. The variable mh-new-draft-cleaned-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 gives the headers to clean out of the original message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 See also documentation for `\\[mh-send]' function." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 (autoload 'mh-forward "mh-comp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 "Forward a message or message sequence. Defaults to displayed message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 If optional prefix argument provided, then prompt for the message sequence.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 See also documentation for `\\[mh-send]' function." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 (autoload 'mh-redistribute "mh-comp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 "Redistribute a letter.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 Depending on how your copy of MH was compiled, you may need to change the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 setting of the variable mh-redist-full-contents. See its documentation." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 (autoload 'mh-reply "mh-comp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 "Reply to a MESSAGE (default: displayed message).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 If optional prefix argument INCLUDEP provided, then include the message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 in the reply using filter mhl.reply in your MH directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 Prompts for type of addresses to reply to:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 from sender only,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 to sender and primary recipients,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 cc/all sender and all recipients.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 If the file named by `mh-repl-formfile' exists, it is used as a skeleton
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 for the reply. See also documentation for `\\[mh-send]' function." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 (autoload 'mh-send "mh-comp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 "Compose and send a letter.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 The file named by `mh-comp-formfile' will be used as the form.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 Do not call this function from outside mh-e; use \\[mh-smail] instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 The letter is composed in mh-letter-mode; see its documentation for more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 details. If `mh-compose-letter-function' is defined, it is called on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 draft and passed three arguments: to, subject, and cc." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 (autoload 'mh-send-other-window "mh-comp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 "Compose and send a letter in another window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 Do not call this function from outside mh-e;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 use \\[mh-smail-other-window] instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 See also documentation for `\\[mh-send]' function." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 (autoload 'mh-letter-mode "mh-comp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 "Mode for composing letters in mh-e.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 For more details, type \\[describe-mode] while in MH-Letter mode." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 ;;; mh-funcs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 (autoload 'mh-burst-digest "mh-funcs"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 "Burst apart the current message, which should be a digest.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 The message is replaced by its table of contents and the messages from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 digest are inserted into the folder after that message." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 (autoload 'mh-copy-msg "mh-funcs"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 "Copy to another FOLDER the specified MESSAGE(s) without deleting them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 Default is the displayed message. If optional prefix argument is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 provided, then prompt for the message sequence." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 (autoload 'mh-kill-folder "mh-funcs"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 "Remove the current folder." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 (autoload 'mh-list-folders "mh-funcs"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 "List mail folders." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 (autoload 'mh-pack-folder "mh-funcs"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 "Renumber the messages of a folder to be 1..n.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 First, offer to execute any outstanding commands for the current folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 If optional prefix argument provided, prompt for the range of messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 to display after packing. Otherwise, show the entire folder." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 (autoload 'mh-pipe-msg "mh-funcs"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 "Pipe the current message through the given shell COMMAND.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 If INCLUDE-HEADERS (prefix argument) is provided, send the entire message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 Otherwise just send the message's body without the headers." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 (autoload 'mh-page-digest "mh-funcs"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 "Advance displayed message to next digested message." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 (autoload 'mh-page-digest-backwards "mh-funcs"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 "Back up displayed message to previous digested message." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 (autoload 'mh-print-msg "mh-funcs"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 "Print MESSAGE(s) (default: displayed message) on printer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 If optional prefix argument provided, then prompt for the message sequence.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 The variable mh-lpr-command-format is used to generate the print command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 The messages are formatted by mhl. See the variable mhl-formfile." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 (autoload 'mh-sort-folder "mh-funcs"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 "Sort the messages in the current folder by date.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 Calls the MH program sortm to do the work.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 The arguments in the list mh-sortm-args are passed to sortm
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 if this function is passed an argument." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 (autoload 'mh-undo-folder "mh-funcs"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 "Undo all commands in current folder." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 (autoload 'mh-store-msg "mh-funcs"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 "Store the file(s) contained in the current message into DIRECTORY.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 The message can contain a shar file or uuencoded file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 Default directory is the last directory used, or initially the value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 mh-store-default-directory or the current directory." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 (autoload 'mh-store-buffer "mh-funcs"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 "Store the file(s) contained in the current buffer into DIRECTORY.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 The buffer can contain a shar file or uuencoded file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 Default directory is the last directory used, or initially the value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 `mh-store-default-directory' or the current directory." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 ;;; mh-pick
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 (autoload 'mh-search-folder "mh-pick"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 "Search FOLDER for messages matching a pattern.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 Add the messages found to the sequence named `search'." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 ;;; mh-seq
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 (autoload 'mh-delete-seq "mh-seq"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 "Delete the SEQUENCE." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 (autoload 'mh-list-sequences "mh-seq"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 "List the sequences defined in FOLDER." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 (autoload 'mh-msg-is-in-seq "mh-seq"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 "Display the sequences that contain MESSAGE (default: displayed message)." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 (autoload 'mh-narrow-to-seq "mh-seq"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 "Restrict display of this folder to just messages in SEQUENCE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 Use \\[mh-widen] to undo this command." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 (autoload 'mh-put-msg-in-seq "mh-seq"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 "Add MESSAGE(s) (default: displayed message) to SEQUENCE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 If optional prefix argument provided, then prompt for the message sequence." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 (autoload 'mh-widen "mh-seq"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 "Remove restrictions from current folder, thereby showing all messages." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536 (autoload 'mh-rename-seq "mh-seq"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 "Rename SEQUENCE to have NEW-NAME." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 ;;; mh-e.el ends here