comparison lisp/vm/vm-save.el @ 108:360340f9fd5f r20-1b6

Import from CVS: tag r20-1b6
author cvs
date Mon, 13 Aug 2007 09:18:39 +0200
parents a145efe76779
children 8619ce7e4c50
comparison
equal deleted inserted replaced
107:523141596bda 108:360340f9fd5f
494 (vm-display buffer t '(vm-pipe-message-to-command) 494 (vm-display buffer t '(vm-pipe-message-to-command)
495 '(vm-pipe-message-to-command)) 495 '(vm-pipe-message-to-command))
496 (vm-display nil nil '(vm-pipe-message-to-command) 496 (vm-display nil nil '(vm-pipe-message-to-command)
497 '(vm-pipe-message-to-command))))) 497 '(vm-pipe-message-to-command)))))
498 498
499 (defun vm-print-message () 499 (defun vm-print-message (count)
500 "Print the current message." 500 "Print the current message
501 (interactive) 501 Prefix arg N means print the current message and the next N - 1 messages.
502 (vm-pipe-message-to-command 502 Prefix arg -N means print the current message and the previous N - 1 messages.
503 (mapconcat (function identity) 503
504 (nconc (list vm-print-command) vm-print-command-switches) 504 The variables `vm-print-command' controls what command is run to
505 " ") 505 print the message, and `vm-print-command-switches' is a list of switches
506 '(64))) 506 to pass to the command.
507 507
508 When invoked on marked messages (via vm-next-command-uses-marks),
509 each marked message is printed, one message per vm-print-command invocation.
510
511 Output, if any, is displayed. The message is not altered."
512 (interactive "p")
513 (vm-follow-summary-cursor)
514 (vm-select-folder-buffer)
515 (vm-check-for-killed-summary)
516 (vm-error-if-folder-empty)
517 (let ((buffer (get-buffer-create "*Shell Command Output*"))
518 (command (mapconcat (function identity)
519 (nconc (list vm-print-command)
520 vm-print-command-switches)
521 " "))
522 (m nil)
523 (pop-up-windows (and pop-up-windows (eq vm-mutable-windows t)))
524 (mlist (vm-select-marked-or-prefixed-messages count)))
525 (set-buffer buffer)
526 (erase-buffer)
527 (while mlist
528 (setq m (vm-real-message-of (car mlist)))
529 (set-buffer (vm-buffer-of m))
530 (if (and vm-display-using-mime (vectorp (vm-mm-layout m)))
531 (let ((work-buffer nil))
532 (unwind-protect
533 (progn
534 (setq work-buffer (generate-new-buffer "*vm-work*"))
535 (set-buffer work-buffer)
536 (vm-insert-region-from-buffer
537 (vm-buffer-of m) (vm-vheaders-of m) (vm-text-of m))
538 (vm-decode-mime-encoded-words)
539 (goto-char (point-max))
540 (let ((vm-auto-displayed-mime-content-types
541 '("text" "multipart"))
542 (vm-mime-internal-content-types
543 '("text" "multipart"))
544 (vm-mime-external-content-types-alist nil))
545 (vm-decode-mime-layout (vm-mm-layout m)))
546 (let ((pop-up-windows (and pop-up-windows
547 (eq vm-mutable-windows t))))
548 (call-process-region (point-min) (point-max)
549 (or shell-file-name "sh")
550 nil buffer nil
551 shell-command-switch command)))
552 (and work-buffer (kill-buffer work-buffer))))
553 (save-restriction
554 (widen)
555 (narrow-to-region (vm-vheaders-of m) (vm-text-end-of m))
556 (let ((pop-up-windows (and pop-up-windows
557 (eq vm-mutable-windows t))))
558 (call-process-region (point-min) (point-max)
559 (or shell-file-name "sh")
560 nil buffer nil
561 shell-command-switch command))))
562 (setq mlist (cdr mlist)))
563 (set-buffer buffer)
564 (if (not (zerop (buffer-size)))
565 (vm-display buffer t '(vm-pipe-message-to-command)
566 '(vm-pipe-message-to-command))
567 (vm-display nil nil '(vm-pipe-message-to-command)
568 '(vm-pipe-message-to-command)))))