annotate lisp/printer.el @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents
children 576fb035e263
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
1 ;;; printer.el --- support for hard-copy printing in XEmacs
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
2
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
3 ;; Copyright (C) 2000 Ben Wing.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
4 ;; Copyright (C) 2000 Kirill Katsnelson.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
5
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
6 ;; Maintainer: XEmacs Development Team
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
7 ;; Keywords: printer, printing, internal, dumped
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
8
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
10
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
14 ;; any later version.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
15
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
19 ;; General Public License for more details.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
20
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
24 ;; 02111-1307, USA.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
25
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
26 ;;; Synched up with: Not in FSF.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
27
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
28 ;;; Authorship:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
29
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
30 ;; Created 2000 by Ben Wing, to provide the high-level interface onto the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
31 ;; print support implemented by Kirill Katsnelson.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
32
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
33 ;;; Commentary:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
34
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
35 ;; This file is dumped with XEmacs.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
36
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
37
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
38 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
39 ;; generic printing code ;;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
40 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
41
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
42 ;; #### should be named print-buffer, but that's currently in
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
43 ;; lpr-buffer with some horrible definition: print-buffer == "print with
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
44 ;; headings", lpr-buffer == "print without headings", and the headings are
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
45 ;; generated by calling the external program "pr"! This is major stone-age
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
46 ;; here!
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
47 ;;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
48 ;; I propose junking that package entirely and creating a unified,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
49 ;; modern API here that will work well with modern GUI's on top of it,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
50 ;; and with various different actual implementations (e.g. lpr or the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
51 ;; pretty-print package on Unix, built-in msprinter support on
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
52 ;; Windows), where the workings of a particular implementation is
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
53 ;; hidden from the user and there is a consistent set of options to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
54 ;; control how to print, which works across all implementations.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
55 ;;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
56 ;; The code here is just a start and needs a huge amount of work. Probably
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
57 ;; the interfaces below will change and the functions renamed.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
58
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
59 (defgroup printing nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
60 "Generic printing support."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
61 :group 'wp)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
62
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
63 (defcustom printer-name nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
64 "*Name of printer to print to.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
65 If nil, use default.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
66 Under Windows, use `mswindows-printer-list' to get names of installed
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
67 printers."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
68 :type 'string
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
69 :group 'printing)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
70
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
71 (defcustom printer-page-header '(date buffer-name)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
72 "*Controls printed page header.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
73
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
74 #### not yet implemented.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
75
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
76 This can be:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
77 - nil. Header is not printed.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
78 - An fbound symbol or lambda expression. The function is called with
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
79 one parameter, a print-context object, every time the headers need
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
80 to be set up. It can use the function `print-context-property' to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
81 query the properties of this object. The return value is treated as
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
82 if it was literally specified: i.e. it will be reprocessed.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
83 - A list of up to three elements, for left, center and right portions
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
84 of the header. Each of these can be
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
85 - nil, not to print the portion
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
86 - A string, which will be printed literally.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
87 - A predefined symbol, on of the following:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
88 short-file-name File name only, no path
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
89 long-file-name File name with its path
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
90 buffer-name Buffer name
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
91 date Date current when printing started
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
92 time Time current when printing started
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
93 page Current printout page number, 1-based
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
94 user-id User logon id
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
95 user-name User full name
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
96 - A cons of an extent and any of the items given here. The item will
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
97 be displayed using the extent's face, begin-glyph and end-glyph
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
98 properties.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
99 - A list, each element of which is any of the items given here.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
100 Each element of the list is rendered in sequence. For example,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
101 '(\"Page \" page) is rendered as \"Page 5\" on the fifth page.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
102 - An fbound symbol or lambda expression, called with one parameter,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
103 a print-context object, as above. The return value is treated as
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
104 if it was literally specified: i.e. it will be reprocessed."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
105 :type 'sexp
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
106 :group 'printing)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
107
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
108 (defcustom printer-page-footer '(nil page)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
109 "*Controls printed page footer.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
110
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
111 #### not yet implemented.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
112
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
113 Format is the same as `printer-page-header'."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
114 :type 'sexp
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
115 :group 'printing)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
116
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
117 (defun print-context-property (print-context prop)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
118 "Return property PROP of PRINT-CONTEXT.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
119
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
120 Valid properties are
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
121
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
122 print-buffer Buffer being printed.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
123 print-window Window on printer device containing print buffer.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
124 print-frame Frame on printer device corresponding to current page.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
125 print-device Device referring to printer.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
126 printer-name Name of printer being printed to.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
127 short-file-name File name only, no path
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
128 long-file-name File name with its path
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
129 buffer-name Buffer name
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
130 date Date current when printing started
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
131 time Time current when printing started
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
132 page Current printout page number, 1-based
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
133 user-id User logon id
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
134 user-name User full name"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
135 (error "not yet implemented"))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
136
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
137 (defun generic-print-buffer (&optional buf)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
138 "Print buffer BUF using a printing method appropriate to the O.S. being run.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
139 Under Unix, `lpr' is normally used to spool out a no-frills version of the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
140 buffer, or the `ps-print' package is used to pretty-print the buffer to a
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
141 PostScript printer. Under MS Windows, the built-in printing support is used.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
142
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
143 If BUF is nil or omitted, the current buffer is used."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
144 (interactive)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
145 (generic-print-region (point-min buf) (point-max buf) buf))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
146
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
147 (defun generic-print-region (b e &optional buf)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
148 "Print region using a printing method appropriate to the O.S. being run.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
149 The region between B and E of BUF (defaults to the current buffer) is printed.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
150
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
151 Under Unix, `lpr' is normally used to spool out a no-frills version of the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
152 buffer, or the `ps-print' package is used to pretty-print the buffer to a
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
153 PostScript printer. Under MS Windows, the built-in printing support is used."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
154 (cond ((valid-specifier-tag-p 'msprinter)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
155 (let (d f)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
156 (setq buf (decode-buffer buf))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
157 (unwind-protect
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
158 (progn
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
159 (setq d (make-device 'msprinter printer-name))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
160 (setq f (make-frame
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
161 (list* 'name (concat (substitute ?_ ?.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
162 (buffer-name buf))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
163 " - XEmacs")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
164 '(menubar-visible-p nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
165 has-modeline-p nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
166 default-toolbar-visible-p nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
167 default-gutter-visible-p nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
168 minibuffer none
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
169 modeline-shadow-thickness 0
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
170 vertical-scrollbar-visible-p nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
171 horizontal-scrollbar-visible-p nil))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
172 d))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
173 (let* ((w (frame-root-window f))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
174 (vertdpi (cdr (device-system-metric d 'device-dpi)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
175 (pixel-vertical-clip-threshold (/ vertdpi 2))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
176 (last-end 0)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
177 done)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
178 (set-window-buffer w (or buf (current-buffer)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
179 (set-window-start w b)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
180 (while (not done)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
181 (redisplay-frame f)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
182 (print-job-eject-page f)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
183 (let ((end (window-end w))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
184 (pixvis (window-last-line-visible-height w)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
185 ;; in case we get stuck somewhere, bow out
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
186 ;; rather than printing an infinite number of
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
187 ;; pages. #### this will fail with an image
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
188 ;; bigger than an entire page. but we really
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
189 ;; need this check here. we should be more
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
190 ;; clever in our check, to deal with this case.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
191 (if (or (= end last-end)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
192 ;; #### fuckme! window-end returns a value
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
193 ;; outside of the valid range of buffer
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
194 ;; positions!!!
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
195 (>= end e))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
196 (setq done t)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
197 (setq last-end end)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
198 (set-window-start w end)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
199 (if pixvis
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
200 (save-selected-window
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
201 (select-window w)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
202 ;; #### scroll-down should take a window arg.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
203 (let ((window-pixel-scroll-increment pixvis))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
204 (scroll-down 1)))))))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
205 (and f (delete-frame f))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
206 (and d (delete-device d))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
207 )))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
208 ((and (not (eq system-type 'windows-nt))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
209 (fboundp 'lpr-buffer))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
210 (lpr-region buf))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
211 (t (error "No print support available"))))