Mercurial > emacs
annotate lisp/mh-e/mh-print.el @ 67470:98e70ddf4e0e
*** empty log message ***
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 10 Dec 2005 11:30:33 +0000 |
parents | 2ae99b10dd40 |
children | 3a8785724cca |
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 |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
50 Any other value is treated as t. This variable is initialized from |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
51 `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 |
111 Check the documentation of `mh-interactive-range' to see how RANGE is read in | |
67246
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
112 interactive use. |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
113 |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
114 This command will print inline text attachments but will not decrypt messages. |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
115 However, when a message is displayed in an MH-Show buffer, then that buffer is |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
116 used verbatim for printing with the caveat that only text attachments, if |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
117 opened inline, are printed. Therefore, encrypted messages can be printed by |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
118 showing and decrypting them first. |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
119 |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
120 MH-E uses the \"ps-print\" package to do the printing, so you can customize |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
121 the printing further by going to the `ps-print' customization group. This |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
122 command does not use the options `mh-lpr-command-format' or |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
123 `mh-print-background-flag'. See also the commands \\[mh-ps-print-toggle-color] |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
124 and \\[mh-ps-print-toggle-faces]." |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
125 (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
|
126 (mh-ps-print-range range nil)) |
56676 | 127 |
128 ;;;###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
|
129 (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
|
130 "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
|
131 |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
132 Check the documentation of `mh-interactive-range' to see how RANGE is read in |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
133 interactive use. |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
134 |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
135 This command will print inline text attachments but will not decrypt messages. |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
136 However, when a message is displayed in an MH-Show buffer, then that buffer is |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
137 used verbatim for printing with the caveat that only text attachments, if |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
138 opened inline, are printed. Therefore, encrypted messages can be printed by |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
139 showing and decrypting them first. |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
140 |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
141 MH-E uses the \"ps-print\" package to do the printing, so you can customize |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
142 the printing further by going to the `ps-print' customization group. This |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
143 command does not use the options `mh-lpr-command-format' or |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
144 `mh-print-background-flag'. See also the commands \\[mh-ps-print-toggle-color] |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
145 and \\[mh-ps-print-toggle-faces]." |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
146 (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
|
147 (mh-ps-print-range range file)) |
56676 | 148 |
149 ;;;###mh-autoload | |
150 (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
|
151 "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
|
152 |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
153 When faces are enabled, the printed message will look very similar to the |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
154 message in the MH-Show buffer." |
56676 | 155 (interactive) |
156 (if (eq mh-ps-print-func 'ps-spool-buffer-with-faces) | |
157 (progn | |
158 (setq mh-ps-print-func 'ps-spool-buffer) | |
159 (message "Printing without faces")) | |
160 (setq mh-ps-print-func 'ps-spool-buffer-with-faces) | |
161 (message "Printing with faces"))) | |
162 | |
163 ;;;###mh-autoload | |
164 (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
|
165 "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
|
166 |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
167 Colors are emulated on black-and-white printers with shades of gray. This |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
168 might produce illegible output, even if your screen colors only use shades of |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
169 gray. If this is the case, try using this command to toggle between color, no |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
170 color, and a black and white representation of the colors and see which works |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
171 best. You change this setting permanently by customizing the option |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
172 `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
|
173 |
56676 | 174 (interactive) |
175 (if (eq mh-ps-print-color-option nil) | |
176 (progn | |
177 (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
|
178 (message "Colors will be printed as black & white")) |
56676 | 179 (if (eq mh-ps-print-color-option 'black-white) |
180 (progn | |
181 (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
|
182 (message "Colors will be printed")) |
56676 | 183 (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
|
184 (message "Colors will not be printed")))) |
56676 | 185 |
186 ;;; Old non-PS based printing | |
187 ;;;###mh-autoload | |
188 (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
|
189 "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
|
190 |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
191 The message is formatted with \"mhl\" (see option `mh-mhl-format-file') and |
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
192 printed with the \"lpr\" command (see option `mh-lpr-command-format'). |
56676 | 193 |
194 Check the documentation of `mh-interactive-range' to see how RANGE is read in | |
195 interactive use. | |
196 | |
67246
bce5c0d2041c
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
Bill Wohler <wohler@newt.com>
parents:
66615
diff
changeset
|
197 Consider using \\[mh-ps-print-msg] instead." |
56676 | 198 (interactive (list (mh-interactive-range "Print"))) |
199 (message "Printing...") | |
200 (let (msgs) | |
201 ;; Gather message numbers and add them to "printed" sequence. | |
202 (mh-iterate-on-range msg range | |
203 (mh-add-msgs-to-seq msg 'printed t) | |
204 (mh-notate nil mh-note-printed mh-cmd-note) | |
205 (push msg msgs)) | |
206 (setq msgs (nreverse msgs)) | |
207 ;; Print scan listing if we have more than one message. | |
208 (if (> (length msgs) 1) | |
209 (let* ((msgs-string | |
210 (mapconcat 'identity (mh-list-to-string | |
211 (mh-coalesce-msg-list msgs)) " ")) | |
212 (lpr-command | |
213 (format mh-lpr-command-format | |
214 (cond ((listp range) | |
215 (format "Folder: %s, Messages: %s" | |
216 mh-current-folder msgs-string)) | |
217 ((symbolp range) | |
218 (format "Folder: %s, Sequence: %s" | |
219 mh-current-folder range))))) | |
220 (scan-command | |
221 (format "scan %s | %s" msgs-string lpr-command))) | |
222 (if mh-print-background-flag | |
223 (mh-exec-cmd-daemon shell-file-name nil "-c" scan-command) | |
224 (call-process shell-file-name nil nil nil "-c" scan-command)))) | |
225 ;; Print the messages | |
226 (dolist (msg msgs) | |
227 (let* ((mhl-command (format "%s %s %s" | |
228 (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
|
229 (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
|
230 (format " -form %s" mh-mhl-format-file) |
56676 | 231 "") |
232 (mh-msg-filename msg))) | |
233 (lpr-command | |
234 (format mh-lpr-command-format | |
235 (format "%s/%s" mh-current-folder msg))) | |
236 (print-command | |
237 (format "%s | %s" mhl-command lpr-command))) | |
238 (if mh-print-background-flag | |
239 (mh-exec-cmd-daemon shell-file-name nil "-c" print-command) | |
240 (call-process shell-file-name nil nil nil "-c" print-command))))) | |
241 (message "Printing...done")) | |
242 | |
243 (provide 'mh-print) | |
244 | |
245 ;;; Local Variables: | |
246 ;;; indent-tabs-mode: nil | |
247 ;;; sentence-end-double-space: nil | |
248 ;;; End: | |
249 | |
56677 | 250 ;; arch-tag: 8d84d50b-2a49-4d0d-b51e-ba9c9b6fc679 |
56676 | 251 ;;; mh-print.el ends here |