Mercurial > emacs
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 |
rev | line source |
---|---|
56676 | 1 ;;; mh-print.el --- MH-E printing support |
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 | 4 |
5 ;; Author: Jeffrey C Honig <jch@honig.net> | |
6 ;; Maintainer: Bill Wohler <wohler@newt.com> | |
7 ;; Keywords: mail | |
8 ;; See: mh-e.el | |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
56676 | 26 |
27 ;;; Commentary: | |
28 | |
29 ;;; Change Log: | |
30 | |
31 ;;; Code: | |
32 | |
33 (eval-when-compile (require 'mh-acros)) | |
34 (mh-require-cl) | |
35 (require 'ps-print) | |
36 (require 'mh-utils) | |
37 (require 'mh-funcs) | |
38 (eval-when-compile (require 'mh-seq)) | |
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 | 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 | 52 |
53 (defvar mh-ps-print-func 'ps-spool-buffer-with-faces | |
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 | 56 Sensible choices are the functions `ps-spool-buffer' and |
57 `ps-spool-buffer-with-faces'.") | |
58 | |
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 | 61 (save-excursion |
62 (set-buffer buffer) | |
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 | 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 | 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 | 106 |
107 ;;;###mh-autoload | |
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 | 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 | 129 |
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 | 152 |
153 ;;;###mh-autoload | |
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 | 159 (interactive) |
160 (if (eq mh-ps-print-func 'ps-spool-buffer-with-faces) | |
161 (progn | |
162 (setq mh-ps-print-func 'ps-spool-buffer) | |
163 (message "Printing without faces")) | |
164 (setq mh-ps-print-func 'ps-spool-buffer-with-faces) | |
165 (message "Printing with faces"))) | |
166 | |
167 ;;;###mh-autoload | |
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 | 178 (interactive) |
179 (if (eq mh-ps-print-color-option nil) | |
180 (progn | |
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 | 183 (if (eq mh-ps-print-color-option 'black-white) |
184 (progn | |
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 | 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 | 189 |
67681 | 190 ;; Old non-PS based printing |
56676 | 191 ;;;###mh-autoload |
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 | 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 | 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 | 203 (interactive (list (mh-interactive-range "Print"))) |
204 (message "Printing...") | |
205 (let (msgs) | |
206 ;; Gather message numbers and add them to "printed" sequence. | |
207 (mh-iterate-on-range msg range | |
208 (mh-add-msgs-to-seq msg 'printed t) | |
209 (mh-notate nil mh-note-printed mh-cmd-note) | |
210 (push msg msgs)) | |
211 (setq msgs (nreverse msgs)) | |
212 ;; Print scan listing if we have more than one message. | |
213 (if (> (length msgs) 1) | |
214 (let* ((msgs-string | |
215 (mapconcat 'identity (mh-list-to-string | |
216 (mh-coalesce-msg-list msgs)) " ")) | |
217 (lpr-command | |
218 (format mh-lpr-command-format | |
219 (cond ((listp range) | |
220 (format "Folder: %s, Messages: %s" | |
221 mh-current-folder msgs-string)) | |
222 ((symbolp range) | |
223 (format "Folder: %s, Sequence: %s" | |
224 mh-current-folder range))))) | |
225 (scan-command | |
226 (format "scan %s | %s" msgs-string lpr-command))) | |
227 (if mh-print-background-flag | |
228 (mh-exec-cmd-daemon shell-file-name nil "-c" scan-command) | |
229 (call-process shell-file-name nil nil nil "-c" scan-command)))) | |
230 ;; Print the messages | |
231 (dolist (msg msgs) | |
232 (let* ((mhl-command (format "%s %s %s" | |
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 | 236 "") |
237 (mh-msg-filename msg))) | |
238 (lpr-command | |
239 (format mh-lpr-command-format | |
240 (format "%s/%s" mh-current-folder msg))) | |
241 (print-command | |
242 (format "%s | %s" mhl-command lpr-command))) | |
243 (if mh-print-background-flag | |
244 (mh-exec-cmd-daemon shell-file-name nil "-c" print-command) | |
245 (call-process shell-file-name nil nil nil "-c" print-command))))) | |
246 (message "Printing...done")) | |
247 | |
248 (provide 'mh-print) | |
249 | |
67681 | 250 ;; Local Variables: |
251 ;; indent-tabs-mode: nil | |
252 ;; sentence-end-double-space: nil | |
253 ;; End: | |
56676 | 254 |
56677 | 255 ;; arch-tag: 8d84d50b-2a49-4d0d-b51e-ba9c9b6fc679 |
56676 | 256 ;;; mh-print.el ends here |