Function: mh-print-msg

mh-print-msg is an autoloaded, interactive and byte-compiled function defined in mh-print.el.gz.

Signature

(mh-print-msg RANGE)

Documentation

Print RANGE the old fashioned way.

The message is formatted with "mhl" (see option mh-mhl-format-file) and printed with the "lpr" command (see option mh-lpr-command-format).

Check the documentation of mh-interactive-range to see how RANGE is read in interactive use.

Consider using P p (mh-ps-print-msg) instead.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-print.el.gz
;; Old non-PS based printing
;;;###mh-autoload
(defun mh-print-msg (range)
  "Print RANGE the old fashioned way\\<mh-folder-mode-map>.

The message is formatted with \"mhl\" (see option
`mh-mhl-format-file') and printed with the \"lpr\" command (see
option `mh-lpr-command-format').

Check the documentation of `mh-interactive-range' to see how
RANGE is read in interactive use.

Consider using \\[mh-ps-print-msg] instead."
  (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 mh-mhl-format-file
                                      (format " -form %s" mh-mhl-format-file)
                                    "")
                                  (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"))