annotate lisp/mh-e/mh-utils.el @ 134:34a5b81f86ba r20-2b1

Import from CVS: tag r20-2b1
author cvs
date Mon, 13 Aug 2007 09:30:11 +0200
parents 131b0175ea99
children
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-utils.el --- mh-e code needed for both sending and reading
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Time-stamp: <95/10/22 17:58:16 gildea>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Copyright (C) 1993, 1995 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; This file is part of mh-e, part of GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; You should have received a copy of the GNU General Public License
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
19 ;; along with XEmacs; see the file COPYING. If not, write to the
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
20 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
21 ;; Boston, MA 02111-1307, USA.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
22
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
23 ;;; Synched up with: FSF 19.34.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; Internal support for mh-e package.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; Change Log:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
31 ;; $Id: mh-utils.el,v 1.2 1997/04/19 23:21:01 steve Exp $
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;; Set for local environment:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;;; mh-progs and mh-lib used to be set in paths.el, which tried to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;;; figure out at build time which of several possible directories MH
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;;; was installed into. But if you installed MH after building Emacs,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;;; this would almost certainly be wrong, so now we do it at run time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (defvar mh-progs nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 "Directory containing MH commands, such as inc, repl, and rmm.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (defvar mh-lib nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 "Directory containing the MH library.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 This directory contains, among other things,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 the mhl program and the components file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (put 'mh-progs 'risky-local-variable t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (put 'mh-lib 'risky-local-variable t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;;; User preferences:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
56 (defgroup mh-buffer nil
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
57 "Layout of MH-E buffers"
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
58 :prefix "mh-"
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
59 :group 'mh)
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
60
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
61
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
62 (defcustom mh-auto-folder-collect t
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 "*Whether to start collecting MH folder names immediately in the background.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 Non-nil means start a background process collecting the names of all
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
65 folders as soon as mh-e is loaded."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
66 :type 'boolean
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
67 :group 'mh)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
69 (defcustom mh-recursive-folders nil
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
70 "*If non-nil, then commands which operate on folders do so recursively."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
71 :type 'boolean
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
72 :group 'mh)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
74 (defcustom mh-clean-message-header nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 "*Non-nil means clean headers of messages that are displayed or inserted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 The variables `mh-visible-headers' and `mh-invisible-headers' control what
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
77 is removed."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
78 :type 'boolean
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
79 :group 'mh-buffer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
81 (defcustom mh-visible-headers nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 "*If non-nil, contains a regexp specifying the headers to keep when cleaning.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 Only used if `mh-clean-message-header' is non-nil. Setting this variable
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
84 overrides `mh-invisible-headers'."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
85 :type '(choice (const nil) regexp)
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
86 :group 'mh-buffer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (defvar mh-invisible-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 "^Received: \\|^Message-Id: \\|^Remailed-\\|^Via: \\|^Mail-from: \\|^Return-Path: \\|^Delivery-Date: \\|^In-Reply-To: \\|^Resent-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 "Regexp matching lines in a message header that are not to be shown.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 If `mh-visible-headers' is non-nil, it is used instead to specify what
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 to keep.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
94 (defcustom mh-bury-show-buffer t
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
95 "*Non-nil means that the displayed show buffer for a folder is buried."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
96 :type 'boolean
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
97 :group 'mh-buffer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
99 (defcustom mh-summary-height 4
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
100 "*Number of lines in MH-Folder window (including the mode line)."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
101 :type 'integer
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
102 :group 'mh-buffer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (defvar mh-msg-number-regexp "^ *\\([0-9]+\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 "Regexp to find the number of a message in a scan line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 The message's number must be surrounded with \\( \\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (defvar mh-msg-search-regexp "^[^0-9]*%d[^0-9]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 "Format string containing a regexp matching the scan listing for a message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 The desired message's number will be an argument to format.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
112 (defcustom mhl-formfile nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 "*Name of format file to be used by mhl to show and print messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 A value of T means use the default format file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 Nil means don't use mhl to format messages when showing; mhl is still used,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 with the default format file, to format messages when printing them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 The format used should specify a non-zero value for overflowoffset so
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
118 the message continues to conform to RFC 822 and mh-e can parse the headers."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
119 :type '(choice (const nil) (const t) string)
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 70
diff changeset
120 :group 'mh)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (put 'mhl-formfile 'info-file "mh-e")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (defvar mh-default-folder-for-message-function nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 "Function to select a default folder for refiling or Fcc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 If set to a function, that function is called with no arguments by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 `\\[mh-refile-msg]' and `\\[mh-to-fcc]' to get a default when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 prompting the user for a folder. The function is called from within a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 save-excursion, with point at the start of the message. It should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 return the folder to offer as the refile or Fcc folder, as a string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 with a leading `+' sign. It can also return an empty string to use no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 default, or NIL to calculate the default the usual way.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 NOTE: This variable is not an ordinary hook;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 It may not be a list of functions.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (defvar mh-find-path-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 "Invoked by mh-find-path while reading the user's MH profile.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (defvar mh-folder-list-change-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 "Invoked whenever the cached folder list `mh-folder-list' is changed.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (defvar mh-show-buffer-mode-line-buffer-id "{show-%s} %d"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 "Format string to produce `mode-line-buffer-identification' for show buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 First argument is folder name. Second is message number.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (defvar mh-cmd-note 4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 "Offset to insert notation.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (defvar mh-note-seq "%"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 "String whose first character is used to notate messages in a sequence.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ;;; Internal bookkeeping variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 ;; The value of `mh-folder-list-change-hook' is called whenever
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ;; mh-folder-list variable is set.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (defvar mh-folder-list nil) ;List of folder names for completion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ;; Cached value of the `Path:' component in the user's MH profile.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (defvar mh-user-path nil) ;User's mail folder directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ;; An mh-draft-folder of NIL means do not use a draft folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ;; Cached value of the `Draft-Folder:' component in the user's MH profile.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (defvar mh-draft-folder nil) ;Name of folder containing draft messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ;; Cached value of the `Unseen-Sequence:' component in the user's MH profile.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (defvar mh-unseen-seq nil) ;Name of the Unseen sequence.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 ;; Cached value of the `Previous-Sequence:' component in the user's MH profile.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (defvar mh-previous-seq nil) ;Name of the Previous sequence.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 ;; Cached value of the `Inbox:' component in the user's MH profile,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 ;; or "+inbox" if no such component.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (defvar mh-inbox nil) ;Name of the Inbox folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (defconst mh-temp-buffer " *mh-temp*") ;Name of mh-e scratch buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (defvar mh-previous-window-config nil) ;Window configuration before mh-e command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ;;; Internal variables local to a folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (defvar mh-current-folder nil) ;Name of current folder, a string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (defvar mh-show-buffer nil) ;Buffer that displays message for this folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (defvar mh-folder-filename nil) ;Full path of directory for this folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (defvar mh-msg-count nil) ;Number of msgs in buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (defvar mh-showing nil) ;If non-nil, show the message in a separate window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ;;; This holds a documentation string used by describe-mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (defun mh-showing ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 "When moving to a new message in the Folder window,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 also show it in a separate Show window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (defvar mh-seq-list nil) ;The sequences of this folder. An alist of (seq . msgs).
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-seen-list nil) ;List of displayed messages to be removed from the Unseen sequence.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 ;; If non-nil, show buffer contains message with all headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 ;; If nil, show buffer contains message processed normally.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (defvar mh-showing-with-headers nil) ;Showing message with headers or normally.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 ;;; mh-e macros
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (defmacro with-mh-folder-updating (save-modification-flag-p &rest body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 ;; Format is (with-mh-folder-updating (SAVE-MODIFICATION-FLAG-P) &body BODY).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 ;; Execute BODY, which can modify the folder buffer without having to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 ;; worry about file locking or the read-only flag, and return its result.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 ;; If SAVE-MODIFICATION-FLAG-P is non-nil, the buffer's modification
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 ;; flag is unchanged, otherwise it is cleared.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (setq save-modification-flag-p (car save-modification-flag-p)) ; CL style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (` (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (let ((mh-folder-updating-mod-flag (buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (buffer-file-name nil)) ;don't let the buffer get locked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (,@ body))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (mh-set-folder-modified-p mh-folder-updating-mod-flag)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (,@ (if (not save-modification-flag-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 '((mh-set-folder-modified-p nil)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (put 'with-mh-folder-updating 'lisp-indent-hook 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (defmacro mh-in-show-buffer (show-buffer &rest body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ;; Format is (mh-in-show-buffer (SHOW-BUFFER) &body BODY).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ;; Display buffer SHOW-BUFFER in other window and execute BODY in it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 ;; Stronger than save-excursion, weaker than save-window-excursion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (setq show-buffer (car show-buffer)) ; CL style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (` (let ((mh-in-show-buffer-saved-window (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (switch-to-buffer-other-window (, show-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (if mh-bury-show-buffer (bury-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (,@ body))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (select-window mh-in-show-buffer-saved-window)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (put 'mh-in-show-buffer 'lisp-indent-hook 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (defmacro mh-make-seq (name msgs) (list 'cons name msgs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (defmacro mh-seq-name (pair) (list 'car pair))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (defmacro mh-seq-msgs (pair) (list 'cdr pair))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 ;;; 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
250 (put 'mh-show-mode 'mode-class 'special)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (defun mh-show-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 "Major mode for showing messages in mh-e.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 The value of mh-show-mode-hook is called when a new message is displayed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (kill-all-local-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (setq major-mode 'mh-show-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (mh-set-mode-name "MH-Show")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (run-hooks 'mh-show-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (defun mh-maybe-show (&optional msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 ;; If in showing mode, then display the message pointed to by the cursor.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (if mh-showing (mh-show msg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (defun mh-show (&optional message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 "Show MESSAGE (default: message at cursor).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 Force a two-window display with the folder window on top (size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 mh-summary-height) and the show buffer below it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 If the message is already visible, display the start of the message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 Display of the message is controlled by setting the variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 `mh-clean-message-header' and `mhl-formfile'. The default behavior is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 to scroll uninteresting headers off the top of the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 Type \"\\[mh-header-display]\" to see the message with all its headers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (and mh-showing-with-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (or mhl-formfile mh-clean-message-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (mh-invalidate-show-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (mh-show-msg message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (defun mh-show-msg (msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (if (not msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (setq msg (mh-get-msg-num t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (setq mh-showing t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (let ((folder mh-current-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (clean-message-header mh-clean-message-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (show-window (get-buffer-window mh-show-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (if (not (eql (next-window (minibuffer-window)) (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (delete-other-windows)) ; force ourself to the top window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (mh-in-show-buffer (mh-show-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (if (and show-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (equal (mh-msg-filename msg folder) buffer-file-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (progn ;just back up to start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (if (not clean-message-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (mh-start-of-uncleaned-message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (mh-display-msg msg folder))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (if (not (= (1+ (window-height)) (screen-height))) ;not horizontally split
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (shrink-window (- (window-height) mh-summary-height)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (mh-recenter nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (if (not (memq msg mh-seen-list)) (setq mh-seen-list (cons msg mh-seen-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (run-hooks 'mh-show-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (defun mh-display-msg (msg-num folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 ;; Display message NUMBER of FOLDER.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 ;; Sets the current buffer to the show buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (set-buffer folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 ;; Bind variables in folder buffer in case they are local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (let ((formfile mhl-formfile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (clean-message-header mh-clean-message-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (invisible-headers mh-invisible-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (visible-headers mh-visible-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (msg-filename (mh-msg-filename msg-num))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (show-buffer mh-show-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (if (not (file-exists-p msg-filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (error "Message %d does not exist" msg-num))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (set-buffer show-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (cond ((not (equal msg-filename buffer-file-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (mh-unvisit-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 ;; Changing contents, so this hook needs to be reinitialized.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 ;; pgp.el uses this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (if (boundp 'write-contents-hooks) ;Emacs 19
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
326 (kill-local-variable 'write-contents-hooks))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (if formfile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (if (stringp formfile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (list "-form" formfile))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 msg-filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (insert-file-contents msg-filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (cond (clean-message-header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (mh-clean-msg-header (point-min)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 invisible-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 visible-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (goto-char (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (mh-start-of-uncleaned-message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 ;; the parts of visiting we want to do (no locking)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (or (eq buffer-undo-list t) ;don't save undo info for prev msgs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (setq buffer-undo-list nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (set-buffer-auto-saved)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 ;; the parts of set-visited-file-name we want to do (no locking)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (setq buffer-file-name msg-filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (setq buffer-backed-up nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (auto-save-mode 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (set-mark nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (mh-show-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (setq mode-line-buffer-identification
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (list (format mh-show-buffer-mode-line-buffer-id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 folder msg-num)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (set-buffer folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (setq mh-showing-with-headers nil)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (defun mh-start-of-uncleaned-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 ;; position uninteresting headers off the top of the window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 "^To:\\|^Cc:\\|^From:\\|^Subject:\\|^Date:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (mh-recenter 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (defun mh-invalidate-show-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 ;; Invalidate the show buffer so we must update it to use it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (if (get-buffer mh-show-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (set-buffer mh-show-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (mh-unvisit-file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (defun mh-unvisit-file ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 ;; Separate current buffer from the message file it was visiting.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (or (not (buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (null buffer-file-name) ;we've been here before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (yes-or-no-p (format "Message %s modified; flush changes? "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (file-name-nondirectory buffer-file-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (error "Flushing changes not confirmed"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (clear-visited-file-modtime)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (unlock-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (setq buffer-file-name nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (defun mh-get-msg-num (error-if-no-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 ;; Return the message number of the displayed message. If the argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 ;; ERROR-IF-NO-MESSAGE is non-nil, then complain if the cursor is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 ;; pointing to a message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (cond ((looking-at mh-msg-number-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (string-to-int (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (match-end 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (error-if-no-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (error "Cursor not pointing to message"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (t nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (defun mh-msg-filename (msg &optional folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 ;; Return the file name of MESSAGE in FOLDER (default current folder).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (expand-file-name (int-to-string msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (if folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (mh-expand-file-name folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 mh-folder-filename)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (defun mh-clean-msg-header (start invisible-headers visible-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 ;; Flush extraneous lines in a message header, from the given POINT to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 ;; end of the message header. If VISIBLE-HEADERS is non-nil, it contains a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 ;; regular expression specifying the lines to display, otherwise
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 ;; INVISIBLE-HEADERS contains a regular expression specifying lines to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 ;; delete from the header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (if (search-forward "\n\n" nil 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (backward-char 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (narrow-to-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (if visible-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (while (< (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (cond ((looking-at visible-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (while (looking-at "[ \t]") (forward-line 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (mh-delete-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (while (looking-at "[ \t]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (mh-delete-line 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (while (re-search-forward invisible-headers nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (mh-delete-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (while (looking-at "[ \t]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (mh-delete-line 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (unlock-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (defun mh-recenter (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 ;; Like recenter but with two improvements: nil arg means recenter,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 ;; and only does anything if the current buffer is in the selected
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 ;; window. (Commands like save-some-buffers can make this false.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (if (eql (get-buffer-window (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (recenter (if arg arg '(t)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (defun mh-delete-line (lines)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 ;; Delete version of kill-line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (delete-region (point) (progn (forward-line lines) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (defun mh-notate (msg notation offset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 ;; Marks MESSAGE with the character NOTATION at position OFFSET.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 ;; Null MESSAGE means the message that the cursor points to.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (if (or (null msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (mh-goto-msg msg t t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (with-mh-folder-updating (t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (forward-char offset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (delete-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (insert notation)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (defun mh-find-msg-get-num (step)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 ;; Return the message number of the message on the current scan line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 ;; or one nearby. Jumps over non-message lines, such as inc errors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 ;; STEP tells whether to search forward or backward if we have to search.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (or (mh-get-msg-num nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (let ((msg-num nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (nreverses 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (while (and (not msg-num)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (< nreverses 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (cond ((eobp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (setq step -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (setq nreverses (1+ nreverses)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 ((bobp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (setq step 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (setq nreverses (1+ nreverses))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (forward-line step)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (setq msg-num (mh-get-msg-num nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 msg-num)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (defun mh-goto-msg (number &optional no-error-if-no-message dont-show)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 "Position the cursor at message NUMBER.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 Optional non-nil second argument means return nil instead of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 signaling an error if message does not exist; in this case,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 the cursor is positioned near where the message would have been.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 Non-nil third argument means not to show the message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (interactive "NGo to message: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (setq number (prefix-numeric-value number)) ;Emacs 19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 ;; This basic routine tries to be as fast as possible,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 ;; using a binary search and minimal regexps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (let ((cur-msg (mh-find-msg-get-num -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (jump-size mh-msg-count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (while (and (> jump-size 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 cur-msg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 (not (eq cur-msg number)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (cond ((< cur-msg number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (setq jump-size (min (- number cur-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (ash (1+ jump-size) -1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (forward-line jump-size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (setq cur-msg (mh-find-msg-get-num 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (setq jump-size (min (- cur-msg number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (ash (1+ jump-size) -1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (forward-line (- jump-size))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (setq cur-msg (mh-find-msg-get-num -1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (if (eq cur-msg number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (or dont-show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (mh-maybe-show number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (if (not no-error-if-no-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 (error "No message %d" number)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (defun mh-msg-search-pat (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 ;; Return a search pattern for message N in the scan listing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (format mh-msg-search-regexp n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (defun mh-get-profile-field (field)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 ;; Find and return the value of FIELD in the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 ;; Returns NIL if the field is not in the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (cond ((not (re-search-forward (format "^%s" field) nil t)) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 ((looking-at "[\t ]*$") nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (re-search-forward "[\t ]*\\([^\t \n].*\\)$" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (let ((start (match-beginning 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (buffer-substring start (point)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
538 (defvar mail-user-agent 'mh-e-user-agent) ;from reporter.el 3.2
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (defun mh-find-path ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 ;; Set mh-progs and mh-lib.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 ;; (This step is necessary if MH was installed after this Emacs was dumped.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 ;; From profile file, set mh-user-path, mh-draft-folder,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 ;; mh-unseen-seq, mh-previous-seq, mh-inbox.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (mh-find-progs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 ;; Be sure profile is fully expanded before switching buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (let ((profile (expand-file-name (or (getenv "MH") "~/.mh_profile"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (set-buffer (get-buffer-create mh-temp-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (setq buffer-offer-save nil) ;for people who set default to t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (condition-case err
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (insert-file-contents profile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (file-error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (mh-install profile err)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (setq mh-user-path (mh-get-profile-field "Path:"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (if (not mh-user-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (setq mh-user-path "Mail"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (setq mh-user-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (expand-file-name mh-user-path (expand-file-name "~"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (setq mh-draft-folder (mh-get-profile-field "Draft-Folder:"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (if mh-draft-folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (if (not (mh-folder-name-p mh-draft-folder))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (setq mh-draft-folder (format "+%s" mh-draft-folder)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (if (not (file-exists-p (mh-expand-file-name mh-draft-folder)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (error "Draft folder \"%s\" not found. Create it and try again."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (mh-expand-file-name mh-draft-folder)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (setq mh-inbox (mh-get-profile-field "Inbox:"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (cond ((not mh-inbox)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (setq mh-inbox "+inbox"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 ((not (mh-folder-name-p mh-inbox))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (setq mh-inbox (format "+%s" mh-inbox))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (setq mh-unseen-seq (mh-get-profile-field "Unseen-Sequence:"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (if mh-unseen-seq
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (setq mh-unseen-seq (intern mh-unseen-seq))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (setq mh-unseen-seq 'unseen)) ;old MH default?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (setq mh-previous-seq (mh-get-profile-field "Previous-Sequence:"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (if mh-previous-seq
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (setq mh-previous-seq (intern mh-previous-seq)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
582 (setq mail-user-agent 'mh-e-user-agent)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (run-hooks 'mh-find-path-hook))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (defun mh-find-progs ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (or (file-exists-p (expand-file-name "inc" mh-progs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (setq mh-progs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (or (mh-path-search exec-path "inc")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (mh-path-search '("/usr/local/bin/mh/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 "/usr/local/mh/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 "/usr/bin/mh/" ;Ultrix 4.2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 "/usr/new/mh/" ;Ultrix <4.2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 "/usr/contrib/mh/bin/" ;BSDI
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 "/usr/local/bin/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 "inc")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 mh-progs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 "/usr/local/bin/")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (or (file-exists-p (expand-file-name "mhl" mh-lib))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (setq mh-lib
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (or (mh-path-search '("/usr/local/lib/mh/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 "/usr/local/mh/lib/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 "/usr/local/bin/mh/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 "/usr/lib/mh/" ;Ultrix 4.2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 "/usr/new/lib/mh/" ;Ultrix <4.2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 "/usr/contrib/mh/lib/" ;BSDI
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 "mhl")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (mh-path-search exec-path "mhl") ;unlikely
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 mh-lib
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 "/usr/local/lib/mh/"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (defun mh-path-search (path file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 ;; Search PATH, a list of directory names, for FILE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 ;; Returns the element of PATH that contains FILE, or nil if not found.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (while (and path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (not (file-exists-p (expand-file-name file (car path)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (setq path (cdr path)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (car path))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (defvar mh-no-install nil) ;do not run install-mh
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (defun mh-install (profile error-val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 ;; Called to do error recovery if we fail to read the profile file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 ;; If possible, initialize the MH environment.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (if (or (getenv "MH")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (file-exists-p profile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 mh-no-install)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (signal (car error-val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (list (format "Cannot read MH profile \"%s\"" profile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (car (cdr (cdr error-val))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 ;; The "install-mh" command will output a short note which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 ;; mh-exec-cmd will display to the user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 ;; The MH 5 version of install-mh might try prompt the user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 ;; for information, which would fail here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (mh-exec-cmd (expand-file-name "install-mh" mh-lib) "-auto")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 ;; now try again to read the profile file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (condition-case err
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (insert-file-contents profile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (file-error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 (signal (car err) ;re-signal with more specific msg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (list (format "Cannot read MH profile \"%s\"" profile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 (car (cdr (cdr err))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (defun mh-set-folder-modified-p (flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 ;; Mark current folder as modified or unmodified according to FLAG.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 (set-buffer-modified-p flag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (defun mh-find-seq (name) (assoc name mh-seq-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (defun mh-seq-to-msgs (seq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 ;; Return a list of the messages in SEQUENCE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (mh-seq-msgs (mh-find-seq seq)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (defun mh-add-msgs-to-seq (msgs seq &optional internal-flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 ;; Add MESSAGE(s) to the SEQUENCE. If optional FLAG is non-nil, do not mark
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 ;; the message in the scan listing or inform MH of the addition.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 (let ((entry (mh-find-seq seq)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (if (and msgs (atom msgs)) (setq msgs (list msgs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 (if (null entry)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (setq mh-seq-list (cons (mh-make-seq seq msgs) mh-seq-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (if msgs (setcdr entry (append msgs (mh-seq-msgs entry)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (cond ((not internal-flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (mh-add-to-sequence seq msgs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (mh-notate-seq seq mh-note-seq (1+ mh-cmd-note))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (autoload 'mh-add-to-sequence "mh-seq")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (autoload 'mh-notate-seq "mh-seq")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (autoload 'mh-read-seq-default "mh-seq")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 (autoload 'mh-map-to-seq-msgs "mh-seq")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 (defun mh-set-mode-name (mode-name-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 ;; Set the mode-name and ensure that the mode line is updated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (setq mode-name mode-name-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 ;; Force redisplay of all buffers' mode lines to be considered.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 (save-excursion (set-buffer (other-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 (set-buffer-modified-p (buffer-modified-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 (defun mh-prompt-for-folder (prompt default can-create)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 ;; Prompt for a folder name with PROMPT. Returns the folder's name as a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 ;; string. DEFAULT is used if the folder exists and the user types return.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 ;; If the CAN-CREATE flag is t, then a non-existent folder is made.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 (if (null default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 (setq default ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 (let* ((prompt (format "%s folder%s" prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 (if (equal "" default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 "? "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 (format " [%s]? " default))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 read-name folder-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (if (null mh-folder-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 (mh-set-folder-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (while (and (setq read-name (completing-read prompt mh-folder-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 nil nil "+"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 (equal read-name "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 (equal default "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 (cond ((or (equal read-name "") (equal read-name "+"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (setq read-name default))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 ((not (mh-folder-name-p read-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (setq read-name (format "+%s" read-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 (setq folder-name read-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 (cond ((and (> (length folder-name) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (eql (aref folder-name (1- (length folder-name))) ?/))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 (setq folder-name (substring folder-name 0 -1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 (let ((new-file-p (not (file-exists-p (mh-expand-file-name folder-name)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 (cond ((and new-file-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 (y-or-n-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (format "Folder %s does not exist. Create it? " folder-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (message "Creating %s" folder-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (call-process "mkdir" nil nil nil (mh-expand-file-name folder-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (message "Creating %s...done" folder-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (setq mh-folder-list (cons (list read-name) mh-folder-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (run-hooks 'mh-folder-list-change-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 (new-file-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 (error "Folder %s is not created" folder-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 ((not (file-directory-p (mh-expand-file-name folder-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (error "\"%s\" is not a directory"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 (mh-expand-file-name folder-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 ((and (null (assoc read-name mh-folder-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 (null (assoc (concat read-name "/") mh-folder-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 (setq mh-folder-list (cons (list read-name) mh-folder-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 (run-hooks 'mh-folder-list-change-hook))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 folder-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 (defvar mh-make-folder-list-process nil) ;The background process collecting the folder list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 (defvar mh-folder-list-temp nil) ;mh-folder-list as it is being built.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 (defvar mh-folder-list-partial-line "") ;Start of last incomplete line from folder process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 (defun mh-set-folder-list ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 ;; Sets mh-folder-list correctly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 ;; A useful function for the command line or for when you need to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 ;; sync by hand. Format is in a form suitable for completing read.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 (message "Collecting folder names...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 (if (not mh-make-folder-list-process)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 (mh-make-folder-list-background))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (while (eq (process-status mh-make-folder-list-process) 'run)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (accept-process-output mh-make-folder-list-process))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 (setq mh-folder-list mh-folder-list-temp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (run-hooks 'mh-folder-list-change-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 (setq mh-folder-list-temp nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 (delete-process mh-make-folder-list-process)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 (setq mh-make-folder-list-process nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 (message "Collecting folder names...done"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (defun mh-make-folder-list-background ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 ;; Start a background process to compute a list of the user's folders.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 ;; Call mh-set-folder-list to wait for the result.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 ((not mh-make-folder-list-process)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 (mh-find-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 (let ((process-connection-type nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 (setq mh-make-folder-list-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 (start-process "folders" nil (expand-file-name "folders" mh-progs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 "-fast"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (if mh-recursive-folders
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 "-recurse"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 "-norecurse")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (set-process-filter mh-make-folder-list-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 'mh-make-folder-list-filter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (process-kill-without-query mh-make-folder-list-process)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 (defun mh-make-folder-list-filter (process output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 ;; parse output from "folders -fast"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (let ((position 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 line-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 new-folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 (prevailing-match-data (match-data)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 ;; make sure got complete line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 (while (setq line-end (string-match "\n" output position))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 (setq new-folder (format "+%s%s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 mh-folder-list-partial-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 (substring output position line-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 (setq mh-folder-list-partial-line "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 ;; is new folder a subfolder of previous?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 (if (and mh-folder-list-temp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (string-match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 (regexp-quote
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 (concat (car (car mh-folder-list-temp)) "/"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 new-folder))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 ;; append slash to parent folder for better completion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 ;; (undone by mh-prompt-for-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (setq mh-folder-list-temp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 (list new-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 (list (concat (car (car mh-folder-list-temp)) "/"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 (cdr mh-folder-list-temp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 (setq mh-folder-list-temp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 (cons (list new-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 mh-folder-list-temp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (setq position (1+ line-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 (store-match-data prevailing-match-data))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (setq mh-folder-list-partial-line (substring output position))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 (defun mh-folder-name-p (name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 ;; Return non-NIL if NAME is possibly the name of a folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 ;; A name (a string or symbol) can be a folder name if it begins with "+".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 (if (symbolp name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 (eql (aref (symbol-name name) 0) ?+)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 (and (> (length name) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 (eql (aref name 0) ?+))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 ;;; Issue commands to MH.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 (defun mh-exec-cmd (command &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 ;; Execute mh-command COMMAND with ARGS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 ;; The side effects are what is desired.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 ;; Any output is assumed to be an error and is shown to the user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 ;; The output is not read or parsed by mh-e.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 (set-buffer (get-buffer-create mh-temp-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 (apply 'call-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 (expand-file-name command mh-progs) nil t nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 (mh-list-to-string args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 (if (> (buffer-size) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 (switch-to-buffer-other-window mh-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 (sit-for 5)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 (defun mh-exec-cmd-error (env command &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 ;; In environment ENV, execute mh-command COMMAND with args ARGS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 ;; ENV is nil or a string of space-separated "var=value" elements.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 ;; Signals an error if process does not complete successfully.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 (set-buffer (get-buffer-create mh-temp-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 (let ((status
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 (if env
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 ;; the shell hacks necessary here shows just how broken Unix is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 (apply 'call-process "/bin/sh" nil t nil "-c"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (format "%s %s ${1+\"$@\"}"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 env
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (expand-file-name command mh-progs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 (mh-list-to-string args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 (apply 'call-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 (expand-file-name command mh-progs) nil t nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 (mh-list-to-string args)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 (mh-handle-process-error command status))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 (defun mh-exec-cmd-daemon (command &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 ;; Execute MH command COMMAND with ARGS in the background.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 ;; Any output from command is displayed in an asynchronous pop-up window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 (set-buffer (get-buffer-create mh-temp-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (erase-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (let* ((process-connection-type nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (process (apply 'start-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 command nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 (expand-file-name command mh-progs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (mh-list-to-string args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 (set-process-filter process 'mh-process-daemon)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (defun mh-process-daemon (process output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 ;; Process daemon that puts output into a temporary buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 (set-buffer (get-buffer-create mh-temp-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 (insert-before-markers output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 (display-buffer mh-temp-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (defun mh-exec-cmd-quiet (raise-error command &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 ;; Args are RAISE-ERROR, COMMANDS, ARGS....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 ;; Execute MH command COMMAND with ARGS. ARGS is a list of strings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 ;; Return at start of mh-temp buffer, where output can be parsed and used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 ;; Returns value of call-process, which is 0 for success,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 ;; unless RAISE-ERROR is non-nil, in which case an error is signaled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 ;; if call-process returns non-0.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 (set-buffer (get-buffer-create mh-temp-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 (let ((value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 (apply 'call-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (expand-file-name command mh-progs) nil t nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (if raise-error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 (mh-handle-process-error command value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 value)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 (defun mh-exec-cmd-output (command display &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 ;; Execute MH command COMMAND with DISPLAY flag and ARGS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 ;; Put the output into buffer after point. Set mark after inserted text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 ;; Output is expected to be shown to user, not parsed by mh-e.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (push-mark (point) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (apply 'call-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 (expand-file-name command mh-progs) nil t display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (mh-list-to-string args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 (exchange-point-and-mark))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 (defun mh-exec-lib-cmd-output (command &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 ;; Execute MH library command COMMAND with ARGS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 ;; Put the output into buffer after point. Set mark after inserted text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 (apply 'mh-exec-cmd-output (expand-file-name command mh-lib) nil args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 (defun mh-handle-process-error (command status)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 ;; Raise error if COMMAND returned non-0 STATUS, otherwise return STATUS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 ;; STATUS is return value from call-process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 ;; Program output is in current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 ;; If output is too long to include in error message, display the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (cond ((eql status 0) ;success
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 status)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 ((stringp status) ;kill string
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
920 (error "%s: %s" command status))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 (t ;exit code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 ((= (buffer-size) 0) ;program produced no error message
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
924 (error "%s: exit code %d" command status))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 ;; will error message fit on one line?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 (goto-line 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 (if (and (< (buffer-size) (screen-width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 (eobp))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
930 (error "%s"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
931 (buffer-substring 1 (progn (goto-char 1)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 (display-buffer (current-buffer))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
935 (error "%s failed with status %d. See error message in other window."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
936 command status)))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 (defun mh-expand-file-name (filename &optional default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 ;; Just like `expand-file-name', but also handles MH folder names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 ;; Assumes that any filename that starts with '+' is a folder name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 (if (mh-folder-name-p filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (expand-file-name (substring filename 1) mh-user-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 (expand-file-name filename default)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (defun mh-list-to-string (l)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 ;; Flattens the list L and makes every element of the new list into a string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 (nreverse (mh-list-to-string-1 l)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 (defun mh-list-to-string-1 (l)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 (let ((new-list nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (while l
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 (cond ((null (car l)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 ((symbolp (car l))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 (setq new-list (cons (symbol-name (car l)) new-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 ((numberp (car l))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 (setq new-list (cons (int-to-string (car l)) new-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 ((equal (car l) ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 ((stringp (car l)) (setq new-list (cons (car l) new-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 ((listp (car l))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 (setq new-list (nconc (mh-list-to-string-1 (car l))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 new-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 (t (error "Bad element in mh-list-to-string: %s" (car l))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 (setq l (cdr l)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 new-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 (provide 'mh-utils)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 (and (not noninteractive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 mh-auto-folder-collect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (let ((mh-no-install t)) ;only get folders if MH installed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 (condition-case err
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (mh-make-folder-list-background)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (file-error)))) ;so don't complain if not installed
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-utils.el ends here