annotate lisp/mh-e/mh-print.el @ 68080:f9bd25bc28cc

*** empty log message ***
author Alex Schroeder <alex@gnu.org>
date Sat, 07 Jan 2006 02:51:45 +0000
parents 6b063593fdad
children 03bac2d0a4aa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
1 ;;; mh-print.el --- MH-E printing support
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
2
65980
4520ae2624f2 * mh-init.el (mh-image-load-path): New function that adds the path to
Bill Wohler <wohler@newt.com>
parents: 65609
diff changeset
3 ;; Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
4
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
5 ;; Author: Jeffrey C Honig <jch@honig.net>
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
6 ;; Maintainer: Bill Wohler <wohler@newt.com>
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
7 ;; Keywords: mail
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
8 ;; See: mh-e.el
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
9
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
11
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
15 ;; any later version.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
16
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
20 ;; GNU General Public License for more details.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
21
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62847
diff changeset
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62847
diff changeset
25 ;; Boston, MA 02110-1301, USA.
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
26
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
27 ;;; Commentary:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
28
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
29 ;;; Change Log:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
30
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
31 ;;; Code:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
32
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
33 (eval-when-compile (require 'mh-acros))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
34 (mh-require-cl)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
35 (require 'ps-print)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
36 (require 'mh-utils)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
37 (require 'mh-funcs)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
38 (eval-when-compile (require 'mh-seq))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
39
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
40 (defvar mh-ps-print-color-option ps-print-color-p
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
41 "Specify how buffer's text color is printed.
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
42
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
43 Valid values are:
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
44
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
45 nil - Do not print colors.
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
46 t - Print colors.
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
47 black-white - Print colors on black/white printer.
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
48 See also `ps-black-white-faces'.
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
49
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
50 Any other value is treated as t. This variable is initialized
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
51 from `ps-print-color-p'.")
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
52
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
53 (defvar mh-ps-print-func 'ps-spool-buffer-with-faces
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
54 "Function to use to spool a buffer.
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
55
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
56 Sensible choices are the functions `ps-spool-buffer' and
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
57 `ps-spool-buffer-with-faces'.")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
58
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
59 (defun mh-ps-spool-buffer (buffer)
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
60 "Spool BUFFER."
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
61 (save-excursion
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
62 (set-buffer buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
63 (let ((ps-print-color-p mh-ps-print-color-option)
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
64 (ps-left-header
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
65 (list
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
66 (concat "(" (mh-get-header-field "Subject:") ")")
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
67 (concat "(" (mh-get-header-field "From:") ")")))
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
68 (ps-right-header
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
69 (list
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
70 "/pagenumberstring load"
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
71 (concat "(" (mh-get-header-field "Date:") ")"))))
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
72 (funcall mh-ps-print-func))))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
73
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
74 (defun mh-ps-spool-msg (msg)
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
75 "Spool MSG."
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
76 (let* ((folder mh-current-folder)
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
77 (buffer (mh-in-show-buffer (mh-show-buffer)
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
78 (if (not (equal (mh-msg-filename msg folder)
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
79 buffer-file-name))
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
80 (get-buffer-create mh-temp-buffer)))))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
81 (unwind-protect
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
82 (save-excursion
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
83 (if buffer
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
84 (let ((mh-show-buffer buffer))
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
85 (mh-display-msg msg folder)))
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
86 (mh-ps-spool-buffer (if buffer buffer mh-show-buffer)))
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
87 (if buffer
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
88 (kill-buffer buffer)))))
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
89
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
90 (defun mh-ps-print-range (range file)
67313
2ae99b10dd40 * mh-comp.el (mh-forward): Went over all uses of the word "RANGE" in
Bill Wohler <wohler@newt.com>
parents: 67246
diff changeset
91 "Print RANGE to FILE.
2ae99b10dd40 * mh-comp.el (mh-forward): Went over all uses of the word "RANGE" in
Bill Wohler <wohler@newt.com>
parents: 67246
diff changeset
92
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
93 This is the function that actually does the work.
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
94 If FILE is nil, then the messages are spooled to the printer."
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
95 (mh-iterate-on-range msg range
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
96 (unwind-protect
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
97 (mh-ps-spool-msg msg))
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
98 (mh-notate msg mh-note-printed mh-cmd-note))
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
99 (ps-despool file))
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
100
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
101 (defun mh-ps-print-preprint (prefix-arg)
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
102 "Provide a better default file name for `ps-print-preprint'.
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
103 Pass along the PREFIX-ARG to it."
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
104 (let ((buffer-file-name (format "mh-%s" (substring (buffer-name) 1))))
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
105 (ps-print-preprint prefix-arg)))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
106
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
107 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
108 (defun mh-ps-print-msg (range)
67313
2ae99b10dd40 * mh-comp.el (mh-forward): Went over all uses of the word "RANGE" in
Bill Wohler <wohler@newt.com>
parents: 67246
diff changeset
109 "Print RANGE\\<mh-folder-mode-map>.
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
110
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
111 Check the documentation of `mh-interactive-range' to see how RANGE is
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
112 read in interactive use.
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
113
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
114 This command will print inline text attachments but will not decrypt
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
115 messages. However, when a message is displayed in an MH-Show buffer,
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
116 then that buffer is used verbatim for printing with the caveat that
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
117 only text attachments, if opened inline, are printed. Therefore,
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
118 encrypted messages can be printed by showing and decrypting them
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
119 first.
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
120
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
121 MH-E uses the \"ps-print\" package to do the printing, so you can
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
122 customize the printing further by going to the `ps-print'
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
123 customization group. This command does not use the options
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
124 `mh-lpr-command-format' or `mh-print-background-flag'. See also the
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
125 commands \\[mh-ps-print-toggle-color] and
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
126 \\[mh-ps-print-toggle-faces]."
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
127 (interactive (list (mh-interactive-range "Print")))
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
128 (mh-ps-print-range range nil))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
129
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
130 ;;;###mh-autoload
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
131 (defun mh-ps-print-msg-file (range file)
67313
2ae99b10dd40 * mh-comp.el (mh-forward): Went over all uses of the word "RANGE" in
Bill Wohler <wohler@newt.com>
parents: 67246
diff changeset
132 "Print RANGE to FILE\\<mh-folder-mode-map>.
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
133
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
134 Check the documentation of `mh-interactive-range' to see how RANGE is
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
135 read in interactive use.
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
136
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
137 This command will print inline text attachments but will not decrypt
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
138 messages. However, when a message is displayed in an MH-Show buffer,
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
139 then that buffer is used verbatim for printing with the caveat that
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
140 only text attachments, if opened inline, are printed. Therefore,
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
141 encrypted messages can be printed by showing and decrypting them
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
142 first.
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
143
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
144 MH-E uses the \"ps-print\" package to do the printing, so you can
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
145 customize the printing further by going to the `ps-print'
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
146 customization group. This command does not use the options
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
147 `mh-lpr-command-format' or `mh-print-background-flag'. See also the
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
148 commands \\[mh-ps-print-toggle-color] and
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
149 \\[mh-ps-print-toggle-faces]."
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
150 (interactive (list (mh-interactive-range "Print") (mh-ps-print-preprint 1)))
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
151 (mh-ps-print-range range file))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
152
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
153 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
154 (defun mh-ps-print-toggle-faces ()
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
155 "Toggle whether printing is done with faces or not.
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
156
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
157 When faces are enabled, the printed message will look very
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
158 similar to the message in the MH-Show buffer."
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
159 (interactive)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
160 (if (eq mh-ps-print-func 'ps-spool-buffer-with-faces)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
161 (progn
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
162 (setq mh-ps-print-func 'ps-spool-buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
163 (message "Printing without faces"))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
164 (setq mh-ps-print-func 'ps-spool-buffer-with-faces)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
165 (message "Printing with faces")))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
166
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
167 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
168 (defun mh-ps-print-toggle-color ()
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
169 "Toggle whether color is used in printing messages.
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
170
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
171 Colors are emulated on black-and-white printers with shades of
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
172 gray. This might produce illegible output, even if your screen
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
173 colors only use shades of gray. If this is the case, try using
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
174 this command to toggle between color, no color, and a black and
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
175 white representation of the colors and see which works best. You
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
176 change this setting permanently by customizing the option
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
177 `ps-print-color-p'."
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
178 (interactive)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
179 (if (eq mh-ps-print-color-option nil)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
180 (progn
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
181 (setq mh-ps-print-color-option 'black-white)
66615
8a6d017601ce (mh-ps-spool-buffer, mh-ps-spool-a-msg)
Bill Wohler <wohler@newt.com>
parents: 65980
diff changeset
182 (message "Colors will be printed as black & white"))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
183 (if (eq mh-ps-print-color-option 'black-white)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
184 (progn
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
185 (setq mh-ps-print-color-option t)
66615
8a6d017601ce (mh-ps-spool-buffer, mh-ps-spool-a-msg)
Bill Wohler <wohler@newt.com>
parents: 65980
diff changeset
186 (message "Colors will be printed"))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
187 (setq mh-ps-print-color-option nil)
66615
8a6d017601ce (mh-ps-spool-buffer, mh-ps-spool-a-msg)
Bill Wohler <wohler@newt.com>
parents: 65980
diff changeset
188 (message "Colors will not be printed"))))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
189
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67313
diff changeset
190 ;; Old non-PS based printing
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
191 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
192 (defun mh-print-msg (range)
67313
2ae99b10dd40 * mh-comp.el (mh-forward): Went over all uses of the word "RANGE" in
Bill Wohler <wohler@newt.com>
parents: 67246
diff changeset
193 "Print RANGE the old fashioned way\\<mh-folder-mode-map>.
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
194
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
195 The message is formatted with \"mhl\" (see option
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
196 `mh-mhl-format-file') and printed with the \"lpr\" command (see
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
197 option `mh-lpr-command-format').
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
198
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
199 Check the documentation of `mh-interactive-range' to see how
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
200 RANGE is read in interactive use.
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
201
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
202 Consider using \\[mh-ps-print-msg] instead."
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
203 (interactive (list (mh-interactive-range "Print")))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
204 (message "Printing...")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
205 (let (msgs)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
206 ;; Gather message numbers and add them to "printed" sequence.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
207 (mh-iterate-on-range msg range
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
208 (mh-add-msgs-to-seq msg 'printed t)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
209 (mh-notate nil mh-note-printed mh-cmd-note)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
210 (push msg msgs))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
211 (setq msgs (nreverse msgs))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
212 ;; Print scan listing if we have more than one message.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
213 (if (> (length msgs) 1)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
214 (let* ((msgs-string
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
215 (mapconcat 'identity (mh-list-to-string
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
216 (mh-coalesce-msg-list msgs)) " "))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
217 (lpr-command
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
218 (format mh-lpr-command-format
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
219 (cond ((listp range)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
220 (format "Folder: %s, Messages: %s"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
221 mh-current-folder msgs-string))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
222 ((symbolp range)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
223 (format "Folder: %s, Sequence: %s"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
224 mh-current-folder range)))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
225 (scan-command
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
226 (format "scan %s | %s" msgs-string lpr-command)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
227 (if mh-print-background-flag
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
228 (mh-exec-cmd-daemon shell-file-name nil "-c" scan-command)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
229 (call-process shell-file-name nil nil nil "-c" scan-command))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
230 ;; Print the messages
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
231 (dolist (msg msgs)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
232 (let* ((mhl-command (format "%s %s %s"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
233 (expand-file-name "mhl" mh-lib-progs)
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
234 (if mh-mhl-format-file
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
235 (format " -form %s" mh-mhl-format-file)
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
236 "")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
237 (mh-msg-filename msg)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
238 (lpr-command
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
239 (format mh-lpr-command-format
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
240 (format "%s/%s" mh-current-folder msg)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
241 (print-command
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
242 (format "%s | %s" mhl-command lpr-command)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
243 (if mh-print-background-flag
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
244 (mh-exec-cmd-daemon shell-file-name nil "-c" print-command)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
245 (call-process shell-file-name nil nil nil "-c" print-command)))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
246 (message "Printing...done"))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
247
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
248 (provide 'mh-print)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
249
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67313
diff changeset
250 ;; Local Variables:
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67313
diff changeset
251 ;; indent-tabs-mode: nil
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67313
diff changeset
252 ;; sentence-end-double-space: nil
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67313
diff changeset
253 ;; End:
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
254
56677
5aafbbdd005f Add arch taglines
Miles Bader <miles@gnu.org>
parents: 56676
diff changeset
255 ;; arch-tag: 8d84d50b-2a49-4d0d-b51e-ba9c9b6fc679
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
256 ;;; mh-print.el ends here