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