annotate lisp/mh-e/mh-print.el @ 66986:24b9342c0182

*** empty log message ***
author Francesco Potortì <pot@gnu.org>
date Fri, 18 Nov 2005 13:57:25 +0000
parents 8a6d017601ce
children bce5c0d2041c
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 ;; Pp Print to lpr | Default inline settings
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
29 ;; Pf Print to file | Generate a postscript file
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
30 ;; Ps Print show buffer | Fails if no show buffer
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
31 ;;
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
32 ;; PA Toggle inline/attachments
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
33 ;; PC Toggle color
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
34 ;; PF Toggle faces
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
35
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
36 ;;; Change Log:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
37
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
38 ;;; Code:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
39
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
40 (eval-when-compile (require 'mh-acros))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
41 (mh-require-cl)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
42 (require 'ps-print)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
43 (require 'mh-utils)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
44 (require 'mh-funcs)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
45 (eval-when-compile (require 'mh-seq))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
46
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
47 (defvar mh-ps-print-mime nil
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
48 "Control printing of MIME parts.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
49 The three possible states are:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
50 1. nil to not print inline parts
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
51 2. t to print inline parts
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
52 3. non-zero to print inline parts and attachments")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
53
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
54 (defvar mh-ps-print-color-option ps-print-color-p
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
55 "MH-E's version of `\\[ps-print-color-p]'.")
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 (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
58 "Function to use to spool a buffer.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
59 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
60 `ps-spool-buffer-with-faces'.")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
61
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
62 ;; XXX - If buffer is already being displayed, use that buffer
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
63 ;; XXX - What about showing MIME content?
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
64 ;; XXX - Default print buffer is bogus
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
65 (defun mh-ps-spool-buffer (buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
66 "Send BUFFER to printer queue."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
67 (save-excursion
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
68 (set-buffer buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
69 (let ((ps-print-color-p mh-ps-print-color-option)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
70 (ps-left-header
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
71 (list
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
72 (concat "("
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
73 (mh-get-header-field "Subject:") ")")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
74 (concat "("
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
75 (mh-get-header-field "From:") ")")))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
76 (ps-right-header
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
77 (list
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
78 "/pagenumberstring load"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
79 (concat "("
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
80 (mh-get-header-field "Date:") ")"))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
81 (funcall mh-ps-print-func))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
82
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
83 (defun mh-ps-spool-a-msg (msg buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
84 "Print MSG.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
85 First the message is decoded in BUFFER before the results are sent to the
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
86 printer."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
87 (let ((mh-show-buffer mh-show-buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
88 (folder mh-current-folder)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
89 ;; The following is commented out because
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
90 ;; `clean-message-header-flag' isn't used anywhere. I
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
91 ;; commented rather than deleted in case somebody had some
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
92 ;; future plans for it. --SY.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
93 ;(clean-message-header-flag mh-clean-message-header-flag)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
94 )
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
95 (unwind-protect
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
96 (progn
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
97 (setq mh-show-buffer buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
98 (save-excursion
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
99 ;;
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
100 ;; XXX - Use setting of mh-ps-print-mime
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
101 ;;
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
102 (mh-display-msg msg folder)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
103 (mh-ps-spool-buffer mh-show-buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
104 (kill-buffer mh-show-buffer))))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
105
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
106 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
107 (defun mh-ps-print-msg (range)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
108 "Print the messages in RANGE.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
109
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
110 Check the documentation of `mh-interactive-range' to see how RANGE is read in
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
111 interactive use."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
112 (interactive (list (mh-interactive-range "Print")))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
113 (mh-iterate-on-range msg range
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
114 (let ((buffer (get-buffer-create mh-temp-buffer)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
115 (unwind-protect
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
116 (mh-ps-spool-a-msg msg buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
117 (kill-buffer buffer)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
118 (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
119 (ps-despool nil))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
120
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
121 (defun mh-ps-print-preprint (prefix-arg)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
122 "Replacement for `ps-print-preprint'.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
123 The original function does not handle the fact that MH folders are directories
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
124 nicely, when generating the default file name. This function works around
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
125 that. The function is passed the interactive PREFIX-ARG."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
126 (let ((buffer-file-name (format "/tmp/%s" (substring (buffer-name) 1))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
127 (ps-print-preprint prefix-arg)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
128
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
129 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
130 (defun mh-ps-print-msg-file (file range)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
131 "Print to FILE the messages in RANGE.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
132
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
133 Check the documentation of `mh-interactive-range' to see how RANGE is read in
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
134 interactive use."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
135 (interactive (list
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
136 (mh-ps-print-preprint 1)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
137 (mh-interactive-range "Print")))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
138 (mh-iterate-on-range msg range
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
139 (let ((buffer (get-buffer-create mh-temp-buffer)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
140 (unwind-protect
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
141 (mh-ps-spool-a-msg msg buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
142 (kill-buffer buffer)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
143 (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
144 (ps-despool file))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
145
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
146 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
147 (defun mh-ps-print-msg-show (file)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
148 "Print current show buffer to FILE."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
149 (interactive (list (mh-ps-print-preprint current-prefix-arg)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
150 (let ((msg (mh-get-msg-num t))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
151 (folder mh-current-folder)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
152 (show-buffer mh-show-buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
153 (show-window (get-buffer-window mh-show-buffer)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
154 (if (and show-buffer show-window)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
155 (mh-in-show-buffer (show-buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
156 (if (equal (mh-msg-filename msg folder) buffer-file-name)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
157 (progn
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
158 (mh-ps-spool-buffer show-buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
159 (ps-despool file))
66615
8a6d017601ce (mh-ps-spool-buffer, mh-ps-spool-a-msg)
Bill Wohler <wohler@newt.com>
parents: 65980
diff changeset
160 (message "Current message is not being shown(1)")))
8a6d017601ce (mh-ps-spool-buffer, mh-ps-spool-a-msg)
Bill Wohler <wohler@newt.com>
parents: 65980
diff changeset
161 (message "Current message is not being shown(2)"))))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
162
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
163 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
164 (defun mh-ps-print-toggle-faces ()
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
165 "Toggle whether printing is done with faces or not."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
166 (interactive)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
167 (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
168 (progn
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
169 (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
170 (message "Printing without faces"))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
171 (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
172 (message "Printing with faces")))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
173
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
174 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
175 (defun mh-ps-print-toggle-color ()
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
176 "Toggle whether color is used in printing messages."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
177 (interactive)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
178 (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
179 (progn
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
180 (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
181 (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
182 (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
183 (progn
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
184 (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
185 (message "Colors will be printed"))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
186 (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
187 (message "Colors will not be printed"))))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
188
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
189 ;;; XXX: Check option 3. Documentation doesn't sound right.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
190 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
191 (defun mh-ps-print-toggle-mime ()
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
192 "Cycle through available choices on how MIME parts should be printed.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
193 The available settings are:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
194 1. Print only inline MIME parts.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
195 2. Print all MIME parts.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
196 3. Print no MIME parts."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
197 (interactive)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
198 (if (eq mh-ps-print-mime nil)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
199 (progn
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
200 (setq mh-ps-print-mime t)
66615
8a6d017601ce (mh-ps-spool-buffer, mh-ps-spool-a-msg)
Bill Wohler <wohler@newt.com>
parents: 65980
diff changeset
201 (message "Inline parts will be printed, attachments will not be printed"))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
202 (if (eq mh-ps-print-mime t)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
203 (progn
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
204 (setq mh-ps-print-mime 1)
66615
8a6d017601ce (mh-ps-spool-buffer, mh-ps-spool-a-msg)
Bill Wohler <wohler@newt.com>
parents: 65980
diff changeset
205 (message "Both Inline parts and attachments will be printed"))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
206 (setq mh-ps-print-mime nil)
66615
8a6d017601ce (mh-ps-spool-buffer, mh-ps-spool-a-msg)
Bill Wohler <wohler@newt.com>
parents: 65980
diff changeset
207 (message "Neither inline parts nor attachments will be printed"))))
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
208
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
209 ;;; Old non-PS based printing
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
210 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
211 (defun mh-print-msg (range)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
212 "Print RANGE on printer.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
213
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
214 Check the documentation of `mh-interactive-range' to see how RANGE is read in
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
215 interactive use.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
216
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
217 The variable `mh-lpr-command-format' is used to generate the print command.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
218 The messages are formatted by mhl. See the variable `mhl-formfile'."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
219 (interactive (list (mh-interactive-range "Print")))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
220 (message "Printing...")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
221 (let (msgs)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
222 ;; 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
223 (mh-iterate-on-range msg range
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
224 (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
225 (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
226 (push msg msgs))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
227 (setq msgs (nreverse msgs))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
228 ;; 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
229 (if (> (length msgs) 1)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
230 (let* ((msgs-string
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
231 (mapconcat 'identity (mh-list-to-string
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
232 (mh-coalesce-msg-list msgs)) " "))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
233 (lpr-command
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
234 (format mh-lpr-command-format
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
235 (cond ((listp range)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
236 (format "Folder: %s, Messages: %s"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
237 mh-current-folder msgs-string))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
238 ((symbolp range)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
239 (format "Folder: %s, Sequence: %s"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
240 mh-current-folder range)))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
241 (scan-command
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
242 (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
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" scan-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" scan-command))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
246 ;; Print the messages
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
247 (dolist (msg msgs)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
248 (let* ((mhl-command (format "%s %s %s"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
249 (expand-file-name "mhl" mh-lib-progs)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
250 (if mhl-formfile
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
251 (format " -form %s" mhl-formfile)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
252 "")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
253 (mh-msg-filename msg)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
254 (lpr-command
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
255 (format mh-lpr-command-format
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
256 (format "%s/%s" mh-current-folder msg)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
257 (print-command
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
258 (format "%s | %s" mhl-command lpr-command)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
259 (if mh-print-background-flag
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
260 (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
261 (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
262 (message "Printing...done"))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
263
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
264 (provide 'mh-print)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
265
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
266 ;;; Local Variables:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
267 ;;; indent-tabs-mode: nil
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
268 ;;; sentence-end-double-space: nil
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
269 ;;; End:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
270
56677
5aafbbdd005f Add arch taglines
Miles Bader <miles@gnu.org>
parents: 56676
diff changeset
271 ;; 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
272 ;;; mh-print.el ends here