1 |
;;; mh-funcs.el --- MH-E functions not everyone will use right away |
;;; mh-funcs.el --- MH-E functions not everyone will use right away |
2 |
|
|
3 |
;; Copyright (C) 1993, 1995, 2001, 02, 2003 Free Software Foundation, Inc. |
;; Copyright (C) 1993, 1995, 2001, 02, 03, 2004 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Author: Bill Wohler <wohler@newt.com> |
;; Author: Bill Wohler <wohler@newt.com> |
6 |
;; Maintainer: Bill Wohler <wohler@newt.com> |
;; Maintainer: Bill Wohler <wohler@newt.com> |
34 |
|
|
35 |
;;; Code: |
;;; Code: |
36 |
|
|
37 |
|
(eval-when-compile (require 'mh-acros)) |
38 |
|
(mh-require-cl) |
39 |
(require 'mh-e) |
(require 'mh-e) |
40 |
|
|
41 |
;;; Customization |
;;; Customization |
47 |
MH profile. |
MH profile. |
48 |
For example, '(\"-nolimit\" \"-textfield\" \"subject\") is a useful setting.") |
For example, '(\"-nolimit\" \"-textfield\" \"subject\") is a useful setting.") |
49 |
|
|
50 |
|
;;; Scan Line Formats |
51 |
|
|
52 |
(defvar mh-note-copied "C" |
(defvar mh-note-copied "C" |
53 |
"String whose first character is used to notate copied messages.") |
"Copied messages are marked by this character.") |
54 |
|
|
55 |
(defvar mh-note-printed "P" |
(defvar mh-note-printed "P" |
56 |
"String whose first character is used to notate printed messages.") |
"Messages that have been printed are marked by this character.") |
57 |
|
|
58 |
;;; Functions |
;;; Functions |
59 |
|
|
237 |
(mh-recenter 0))) |
(mh-recenter 0))) |
238 |
|
|
239 |
;;;###mh-autoload |
;;;###mh-autoload |
|
(defun mh-print-msg (range) |
|
|
"Print RANGE on printer. |
|
|
|
|
|
Check the documentation of `mh-interactive-range' to see how RANGE is read in |
|
|
interactive use. |
|
|
|
|
|
The variable `mh-lpr-command-format' is used to generate the print command. |
|
|
The messages are formatted by mhl. See the variable `mhl-formfile'." |
|
|
(interactive (list (mh-interactive-range "Print"))) |
|
|
(message "Printing...") |
|
|
(let (msgs) |
|
|
;; Gather message numbers and add them to "printed" sequence. |
|
|
(mh-iterate-on-range msg range |
|
|
(mh-add-msgs-to-seq msg 'printed t) |
|
|
(mh-notate nil mh-note-printed mh-cmd-note) |
|
|
(push msg msgs)) |
|
|
(setq msgs (nreverse msgs)) |
|
|
;; Print scan listing if we have more than one message. |
|
|
(if (> (length msgs) 1) |
|
|
(let* ((msgs-string |
|
|
(mapconcat 'identity (mh-list-to-string |
|
|
(mh-coalesce-msg-list msgs)) " ")) |
|
|
(lpr-command |
|
|
(format mh-lpr-command-format |
|
|
(cond ((listp range) |
|
|
(format "Folder: %s, Messages: %s" |
|
|
mh-current-folder msgs-string)) |
|
|
((symbolp range) |
|
|
(format "Folder: %s, Sequence: %s" |
|
|
mh-current-folder range))))) |
|
|
(scan-command |
|
|
(format "scan %s | %s" msgs-string lpr-command))) |
|
|
(if mh-print-background-flag |
|
|
(mh-exec-cmd-daemon shell-file-name nil "-c" scan-command) |
|
|
(call-process shell-file-name nil nil nil "-c" scan-command)))) |
|
|
;; Print the messages |
|
|
(dolist (msg msgs) |
|
|
(let* ((mhl-command (format "%s %s %s" |
|
|
(expand-file-name "mhl" mh-lib-progs) |
|
|
(if mhl-formfile |
|
|
(format " -form %s" mhl-formfile) |
|
|
"") |
|
|
(mh-msg-filename msg))) |
|
|
(lpr-command |
|
|
(format mh-lpr-command-format |
|
|
(format "%s/%s" mh-current-folder msg))) |
|
|
(print-command |
|
|
(format "%s | %s" mhl-command lpr-command))) |
|
|
(if mh-print-background-flag |
|
|
(mh-exec-cmd-daemon shell-file-name nil "-c" print-command) |
|
|
(call-process shell-file-name nil nil nil "-c" print-command))))) |
|
|
(message "Printing...done")) |
|
|
|
|
|
;;;###mh-autoload |
|
240 |
(defun mh-sort-folder (&optional extra-args) |
(defun mh-sort-folder (&optional extra-args) |
241 |
"Sort the messages in the current folder by date. |
"Sort the messages in the current folder by date. |
242 |
Calls the MH program sortm to do the work. |
Calls the MH program sortm to do the work. |
257 |
(mh-index-data (mh-index-insert-folder-headers))))) |
(mh-index-data (mh-index-insert-folder-headers))))) |
258 |
|
|
259 |
;;;###mh-autoload |
;;;###mh-autoload |
260 |
(defun mh-undo-folder (&rest ignore) |
(defun mh-undo-folder () |
261 |
"Undo all pending deletes and refiles in current folder. |
"Undo all pending deletes and refiles in current folder." |
|
Argument IGNORE is deprecated." |
|
262 |
(interactive) |
(interactive) |
263 |
(cond ((or mh-do-not-confirm-flag |
(cond ((or mh-do-not-confirm-flag |
264 |
(yes-or-no-p "Undo all commands in folder? ")) |
(yes-or-no-p "Undo all commands in folder? ")) |
269 |
(with-mh-folder-updating (nil) |
(with-mh-folder-updating (nil) |
270 |
(mh-remove-all-notation))) |
(mh-remove-all-notation))) |
271 |
(t |
(t |
272 |
(message "Commands not undone.") |
(message "Commands not undone")))) |
|
;; Remove by 2003-06-30 if nothing seems amiss. XXX |
|
|
;; (sit-for 2) |
|
|
))) |
|
273 |
|
|
274 |
;;;###mh-autoload |
;;;###mh-autoload |
275 |
(defun mh-store-msg (directory) |
(defun mh-store-msg (directory) |
359 |
|
|
360 |
;;;###mh-autoload |
;;;###mh-autoload |
361 |
(defun mh-help () |
(defun mh-help () |
362 |
"Display cheat sheet for the MH-Folder commands in minibuffer." |
"Display cheat sheet for the MH-E commands." |
363 |
(interactive) |
(interactive) |
364 |
(mh-ephem-message |
(with-electric-help |
365 |
(substitute-command-keys |
(function |
366 |
(mapconcat 'identity (cdr (assoc nil mh-help-messages)) "")))) |
(lambda () |
367 |
|
(insert |
368 |
|
(substitute-command-keys |
369 |
|
(mapconcat 'identity (cdr (assoc nil mh-help-messages)) "")))) |
370 |
|
mh-help-buffer))) |
371 |
|
|
372 |
;;;###mh-autoload |
;;;###mh-autoload |
373 |
(defun mh-prefix-help () |
(defun mh-prefix-help () |
380 |
;; from the recent keys. |
;; from the recent keys. |
381 |
(let* ((keys (recent-keys)) |
(let* ((keys (recent-keys)) |
382 |
(prefix-char (elt keys (- (length keys) 2)))) |
(prefix-char (elt keys (- (length keys) 2)))) |
383 |
(mh-ephem-message |
(with-electric-help |
384 |
(substitute-command-keys |
(function |
385 |
(mapconcat 'identity (cdr (assoc prefix-char mh-help-messages)) ""))))) |
(lambda () |
386 |
|
(insert |
387 |
|
(substitute-command-keys |
388 |
|
(mapconcat 'identity |
389 |
|
(cdr (assoc prefix-char mh-help-messages)) ""))))) |
390 |
|
mh-help-buffer))) |
391 |
|
|
392 |
(provide 'mh-funcs) |
(provide 'mh-funcs) |
393 |
|
|