annotate lisp/mh-e/mh-print.el @ 86433:62788290378a

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Sun, 25 Nov 2007 03:48:41 +0000
parents 800dd75c042b
children 3c2488d0ebd9 f55f9811f5d7
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
75347
e3694f1cb928 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 68465
diff changeset
3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007 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
78231
800dd75c042b Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
14 ;; the Free Software Foundation; either version 3, or (at your option)
56676
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
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
33 (require 'mh-e)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
34 (require 'mh-scan)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
35
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
36 (require 'ps-print)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
37
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
38 (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
39 "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
40
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
41 Valid values are:
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
42
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
43 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
44 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
45 black-white - Print colors on black/white printer.
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
46 See also `ps-black-white-faces'.
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
47
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
48 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
49 from `ps-print-color-p'.")
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
50
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
51 (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
52 "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
53
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
54 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
55 `ps-spool-buffer-with-faces'.")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
56
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
57 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
58 (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
59 "Print RANGE\\<mh-folder-mode-map>.
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
60
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
61 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
62 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
63
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
64 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
65 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
66 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
67 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
68 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
69 first.
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
70
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
71 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
72 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
73 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
74 `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
75 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
76 \\[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
77 (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
78 (mh-ps-print-range range nil))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
79
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
80 (defun mh-ps-print-range (range file)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
81 "Print RANGE to FILE.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
82
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
83 This is the function that actually does the work.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
84 If FILE is nil, then the messages are spooled to the printer."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
85 (mh-iterate-on-range msg range
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
86 (unwind-protect
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
87 (mh-ps-spool-msg msg))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
88 (mh-notate msg mh-note-printed mh-cmd-note))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
89 (ps-despool file))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
90
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
91 (defun mh-ps-spool-msg (msg)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
92 "Spool MSG."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
93 (let* ((folder mh-current-folder)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
94 (buffer (mh-in-show-buffer (mh-show-buffer)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
95 (if (not (equal (mh-msg-filename msg folder)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
96 buffer-file-name))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
97 (get-buffer-create mh-temp-buffer)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
98 (unwind-protect
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
99 (save-excursion
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
100 (if buffer
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
101 (let ((mh-show-buffer buffer))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
102 (mh-display-msg msg folder)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
103 (mh-ps-spool-buffer (if buffer buffer mh-show-buffer)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
104 (if buffer
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
105 (kill-buffer buffer)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
106
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
107 (defun mh-ps-spool-buffer (buffer)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
108 "Spool BUFFER."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
109 (save-excursion
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
110 (set-buffer buffer)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
111 (let ((ps-print-color-p mh-ps-print-color-option)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
112 (ps-left-header
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
113 (list
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
114 (concat "(" (mh-get-header-field "Subject:") ")")
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
115 (concat "(" (mh-get-header-field "From:") ")")))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
116 (ps-right-header
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
117 (list
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
118 "/pagenumberstring load"
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
119 (concat "(" (mh-get-header-field "Date:") ")"))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
120 (funcall mh-ps-print-func))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
121
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
122 ;;;###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
123 (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
124 "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
125
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
126 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
127 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
128
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
129 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
130 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
131 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
132 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
133 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
134 first.
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
135
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
136 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
137 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
138 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
139 `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
140 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
141 \\[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
142 (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
143 (mh-ps-print-range range file))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
144
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
145 (defun mh-ps-print-preprint (prefix-arg)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
146 "Provide a better default file name for `ps-print-preprint'.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
147 Pass along the PREFIX-ARG to it."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
148 (let ((buffer-file-name (format "mh-%s" (substring (buffer-name) 1))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
149 (ps-print-preprint prefix-arg)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
150
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
151 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
152 (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
153 "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
154
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
155 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
156 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
157 (interactive)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
158 (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
159 (progn
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
160 (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
161 (message "Printing without faces"))
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-with-faces)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
163 (message "Printing with faces")))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
164
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
165 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
166 (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
167 "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
168
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
169 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
170 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
171 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
172 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
173 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
174 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
175 `ps-print-color-p'."
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
176 (interactive)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
177 (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
178 (progn
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
179 (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
180 (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
181 (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
182 (progn
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
183 (setq mh-ps-print-color-option t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
184 (message "Colors will be printed"))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
185 (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
186 (message "Colors will not be printed"))))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
187
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67313
diff changeset
188 ;; Old non-PS based printing
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
189 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
190 (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
191 "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
192
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
193 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
194 `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
195 option `mh-lpr-command-format').
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
196
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
197 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
198 RANGE is read in interactive use.
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
199
67246
bce5c0d2041c * mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents: 66615
diff changeset
200 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
201 (interactive (list (mh-interactive-range "Print")))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
202 (message "Printing...")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
203 (let (msgs)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
204 ;; 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
205 (mh-iterate-on-range msg range
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
206 (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
207 (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
208 (push msg msgs))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
209 (setq msgs (nreverse msgs))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
210 ;; 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
211 (if (> (length msgs) 1)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
212 (let* ((msgs-string
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
213 (mapconcat 'identity (mh-list-to-string
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
214 (mh-coalesce-msg-list msgs)) " "))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
215 (lpr-command
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
216 (format mh-lpr-command-format
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
217 (cond ((listp range)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
218 (format "Folder: %s, Messages: %s"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
219 mh-current-folder msgs-string))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
220 ((symbolp range)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
221 (format "Folder: %s, Sequence: %s"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
222 mh-current-folder range)))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
223 (scan-command
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
224 (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
225 (if mh-print-background-flag
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
226 (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
227 (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
228 ;; Print the messages
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
229 (dolist (msg msgs)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
230 (let* ((mhl-command (format "%s %s %s"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
231 (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
232 (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
233 (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
234 "")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
235 (mh-msg-filename msg)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
236 (lpr-command
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
237 (format mh-lpr-command-format
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
238 (format "%s/%s" mh-current-folder msg)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
239 (print-command
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
240 (format "%s | %s" mhl-command lpr-command)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
241 (if mh-print-background-flag
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
242 (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
243 (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
244 (message "Printing...done"))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
245
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
246 (provide 'mh-print)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
247
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67313
diff changeset
248 ;; Local Variables:
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67313
diff changeset
249 ;; indent-tabs-mode: nil
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67313
diff changeset
250 ;; sentence-end-double-space: nil
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67313
diff changeset
251 ;; End:
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
252
56677
5aafbbdd005f Add arch taglines
Miles Bader <miles@gnu.org>
parents: 56676
diff changeset
253 ;; 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
254 ;;; mh-print.el ends here