Mercurial > emacs
comparison lisp/mh-e/mh-funcs.el @ 89966:d8411455de48
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-32
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-486
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-487
Tweak permissions
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-488
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-489
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-490
Update from CVS: man/fixit.texi (Spelling): Fix typo.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-491
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-494
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-495
Update from CVS: Add missing lisp/mh-e files
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-496
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-499
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-500
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-513
Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 27 Aug 2004 07:00:34 +0000 |
parents | 97905c4f1a42 e9a6cbc8ca5e |
children | f042e7c0fe20 |
comparison
equal
deleted
inserted
replaced
89965:5e9097d1ad99 | 89966:d8411455de48 |
---|---|
1 ;;; mh-funcs.el --- MH-E functions not everyone will use right away | 1 ;;; mh-funcs.el --- MH-E functions not everyone will use right away |
2 | 2 |
3 ;; Copyright (C) 1993, 1995, 2001, 02, 2003 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1993, 1995, 2001, 02, 03, 2004 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Bill Wohler <wohler@newt.com> | 5 ;; Author: Bill Wohler <wohler@newt.com> |
6 ;; Maintainer: Bill Wohler <wohler@newt.com> | 6 ;; Maintainer: Bill Wohler <wohler@newt.com> |
7 ;; Keywords: mail | 7 ;; Keywords: mail |
8 ;; See: mh-e.el | 8 ;; See: mh-e.el |
32 | 32 |
33 ;;; Change Log: | 33 ;;; Change Log: |
34 | 34 |
35 ;;; Code: | 35 ;;; Code: |
36 | 36 |
37 (eval-when-compile (require 'mh-acros)) | |
38 (mh-require-cl) | |
37 (require 'mh-e) | 39 (require 'mh-e) |
38 | 40 |
39 ;;; Customization | 41 ;;; Customization |
40 | 42 |
41 (defvar mh-sortm-args nil | 43 (defvar mh-sortm-args nil |
43 The arguments are passed to sortm if \\[mh-sort-folder] is given a | 45 The arguments are passed to sortm if \\[mh-sort-folder] is given a |
44 prefix argument. Normally default arguments to sortm are specified in the | 46 prefix argument. Normally default arguments to sortm are specified in the |
45 MH profile. | 47 MH profile. |
46 For example, '(\"-nolimit\" \"-textfield\" \"subject\") is a useful setting.") | 48 For example, '(\"-nolimit\" \"-textfield\" \"subject\") is a useful setting.") |
47 | 49 |
50 ;;; Scan Line Formats | |
51 | |
48 (defvar mh-note-copied "C" | 52 (defvar mh-note-copied "C" |
49 "String whose first character is used to notate copied messages.") | 53 "Copied messages are marked by this character.") |
50 | 54 |
51 (defvar mh-note-printed "P" | 55 (defvar mh-note-printed "P" |
52 "String whose first character is used to notate printed messages.") | 56 "Messages that have been printed are marked by this character.") |
53 | 57 |
54 ;;; Functions | 58 ;;; Functions |
55 | 59 |
56 ;;;###mh-autoload | 60 ;;;###mh-autoload |
57 (defun mh-burst-digest () | 61 (defun mh-burst-digest () |
231 (if (search-backward "\n\n" nil t) | 235 (if (search-backward "\n\n" nil t) |
232 (forward-line 2)) | 236 (forward-line 2)) |
233 (mh-recenter 0))) | 237 (mh-recenter 0))) |
234 | 238 |
235 ;;;###mh-autoload | 239 ;;;###mh-autoload |
236 (defun mh-print-msg (range) | |
237 "Print RANGE on printer. | |
238 | |
239 Check the documentation of `mh-interactive-range' to see how RANGE is read in | |
240 interactive use. | |
241 | |
242 The variable `mh-lpr-command-format' is used to generate the print command. | |
243 The messages are formatted by mhl. See the variable `mhl-formfile'." | |
244 (interactive (list (mh-interactive-range "Print"))) | |
245 (message "Printing...") | |
246 (let (msgs) | |
247 ;; Gather message numbers and add them to "printed" sequence. | |
248 (mh-iterate-on-range msg range | |
249 (mh-add-msgs-to-seq msg 'printed t) | |
250 (mh-notate nil mh-note-printed mh-cmd-note) | |
251 (push msg msgs)) | |
252 (setq msgs (nreverse msgs)) | |
253 ;; Print scan listing if we have more than one message. | |
254 (if (> (length msgs) 1) | |
255 (let* ((msgs-string | |
256 (mapconcat 'identity (mh-list-to-string | |
257 (mh-coalesce-msg-list msgs)) " ")) | |
258 (lpr-command | |
259 (format mh-lpr-command-format | |
260 (cond ((listp range) | |
261 (format "Folder: %s, Messages: %s" | |
262 mh-current-folder msgs-string)) | |
263 ((symbolp range) | |
264 (format "Folder: %s, Sequence: %s" | |
265 mh-current-folder range))))) | |
266 (scan-command | |
267 (format "scan %s | %s" msgs-string lpr-command))) | |
268 (if mh-print-background-flag | |
269 (mh-exec-cmd-daemon shell-file-name nil "-c" scan-command) | |
270 (call-process shell-file-name nil nil nil "-c" scan-command)))) | |
271 ;; Print the messages | |
272 (dolist (msg msgs) | |
273 (let* ((mhl-command (format "%s %s %s" | |
274 (expand-file-name "mhl" mh-lib-progs) | |
275 (if mhl-formfile | |
276 (format " -form %s" mhl-formfile) | |
277 "") | |
278 (mh-msg-filename msg))) | |
279 (lpr-command | |
280 (format mh-lpr-command-format | |
281 (format "%s/%s" mh-current-folder msg))) | |
282 (print-command | |
283 (format "%s | %s" mhl-command lpr-command))) | |
284 (if mh-print-background-flag | |
285 (mh-exec-cmd-daemon shell-file-name nil "-c" print-command) | |
286 (call-process shell-file-name nil nil nil "-c" print-command))))) | |
287 (message "Printing...done")) | |
288 | |
289 ;;;###mh-autoload | |
290 (defun mh-sort-folder (&optional extra-args) | 240 (defun mh-sort-folder (&optional extra-args) |
291 "Sort the messages in the current folder by date. | 241 "Sort the messages in the current folder by date. |
292 Calls the MH program sortm to do the work. | 242 Calls the MH program sortm to do the work. |
293 The arguments in the list `mh-sortm-args' are passed to sortm if the optional | 243 The arguments in the list `mh-sortm-args' are passed to sortm if the optional |
294 argument EXTRA-ARGS is given." | 244 argument EXTRA-ARGS is given." |
305 (mh-scan-folder mh-current-folder "all") | 255 (mh-scan-folder mh-current-folder "all") |
306 (cond (threaded-flag (mh-toggle-threads)) | 256 (cond (threaded-flag (mh-toggle-threads)) |
307 (mh-index-data (mh-index-insert-folder-headers))))) | 257 (mh-index-data (mh-index-insert-folder-headers))))) |
308 | 258 |
309 ;;;###mh-autoload | 259 ;;;###mh-autoload |
310 (defun mh-undo-folder (&rest ignore) | 260 (defun mh-undo-folder () |
311 "Undo all pending deletes and refiles in current folder. | 261 "Undo all pending deletes and refiles in current folder." |
312 Argument IGNORE is deprecated." | |
313 (interactive) | 262 (interactive) |
314 (cond ((or mh-do-not-confirm-flag | 263 (cond ((or mh-do-not-confirm-flag |
315 (yes-or-no-p "Undo all commands in folder? ")) | 264 (yes-or-no-p "Undo all commands in folder? ")) |
316 (setq mh-delete-list nil | 265 (setq mh-delete-list nil |
317 mh-refile-list nil | 266 mh-refile-list nil |
318 mh-seq-list nil | 267 mh-seq-list nil |
319 mh-next-direction 'forward) | 268 mh-next-direction 'forward) |
320 (with-mh-folder-updating (nil) | 269 (with-mh-folder-updating (nil) |
321 (mh-remove-all-notation))) | 270 (mh-remove-all-notation))) |
322 (t | 271 (t |
323 (message "Commands not undone.") | 272 (message "Commands not undone")))) |
324 ;; Remove by 2003-06-30 if nothing seems amiss. XXX | |
325 ;; (sit-for 2) | |
326 ))) | |
327 | 273 |
328 ;;;###mh-autoload | 274 ;;;###mh-autoload |
329 (defun mh-store-msg (directory) | 275 (defun mh-store-msg (directory) |
330 "Store the file(s) contained in the current message into DIRECTORY. | 276 "Store the file(s) contained in the current message into DIRECTORY. |
331 The message can contain a shar file or uuencoded file. | 277 The message can contain a shar file or uuencoded file. |
411 (sit-for 5) | 357 (sit-for 5) |
412 (message "")) | 358 (message "")) |
413 | 359 |
414 ;;;###mh-autoload | 360 ;;;###mh-autoload |
415 (defun mh-help () | 361 (defun mh-help () |
416 "Display cheat sheet for the MH-Folder commands in minibuffer." | 362 "Display cheat sheet for the MH-E commands." |
417 (interactive) | 363 (interactive) |
418 (mh-ephem-message | 364 (with-electric-help |
419 (substitute-command-keys | 365 (function |
420 (mapconcat 'identity (cdr (assoc nil mh-help-messages)) "")))) | 366 (lambda () |
367 (insert | |
368 (substitute-command-keys | |
369 (mapconcat 'identity (cdr (assoc nil mh-help-messages)) "")))) | |
370 mh-help-buffer))) | |
421 | 371 |
422 ;;;###mh-autoload | 372 ;;;###mh-autoload |
423 (defun mh-prefix-help () | 373 (defun mh-prefix-help () |
424 "Display cheat sheet for the commands of the current prefix in minibuffer." | 374 "Display cheat sheet for the commands of the current prefix in minibuffer." |
425 (interactive) | 375 (interactive) |
428 ;; last keystroke is length-1 and thus the second to last keystroke is at | 378 ;; last keystroke is length-1 and thus the second to last keystroke is at |
429 ;; length-2. We use that information to obtain a suitable prefix character | 379 ;; length-2. We use that information to obtain a suitable prefix character |
430 ;; from the recent keys. | 380 ;; from the recent keys. |
431 (let* ((keys (recent-keys)) | 381 (let* ((keys (recent-keys)) |
432 (prefix-char (elt keys (- (length keys) 2)))) | 382 (prefix-char (elt keys (- (length keys) 2)))) |
433 (mh-ephem-message | 383 (with-electric-help |
434 (substitute-command-keys | 384 (function |
435 (mapconcat 'identity (cdr (assoc prefix-char mh-help-messages)) ""))))) | 385 (lambda () |
386 (insert | |
387 (substitute-command-keys | |
388 (mapconcat 'identity | |
389 (cdr (assoc prefix-char mh-help-messages)) ""))))) | |
390 mh-help-buffer))) | |
436 | 391 |
437 (provide 'mh-funcs) | 392 (provide 'mh-funcs) |
438 | 393 |
439 ;;; Local Variables: | 394 ;;; Local Variables: |
440 ;;; indent-tabs-mode: nil | 395 ;;; indent-tabs-mode: nil |