Mercurial > emacs
annotate lisp/printing.el @ 54707:3ae050b13a3c
Remove my incorrect email address.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sun, 04 Apr 2004 21:45:39 +0000 |
parents | 32aae36e32af |
children | 1c61b23bf7f9 |
rev | line source |
---|---|
49646 | 1 ;;; printing.el --- printing utilities |
2 | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004 |
49646 | 4 ;; Free Software Foundation, Inc. |
5 | |
6 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> | |
7 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> | |
54675
32aae36e32af
Var initialization fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54636
diff
changeset
|
8 ;; Time-stamp: <2004/03/31 23:14:47 vinicius> |
49646 | 9 ;; Keywords: wp, print, PostScript |
54675
32aae36e32af
Var initialization fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54636
diff
changeset
|
10 ;; Version: 6.7.4 |
49646 | 11 ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ |
12 | |
54675
32aae36e32af
Var initialization fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54636
diff
changeset
|
13 (defconst pr-version "6.7.4" |
32aae36e32af
Var initialization fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54636
diff
changeset
|
14 "printing.el, v 6.7.4 <2004/03/31 vinicius> |
49646 | 15 |
16 Please send all bug fixes and enhancements to | |
17 Vinicius Jose Latorre <vinicius@cpqd.com.br> | |
18 ") | |
19 | |
20 ;; This file is part of GNU Emacs. | |
21 | |
22 ;; GNU Emacs is free software; you can redistribute it and/or modify it under | |
23 ;; the terms of the GNU General Public License as published by the Free | |
24 ;; Software Foundation; either version 2, or (at your option) any later | |
25 ;; version. | |
26 | |
27 ;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY | |
28 ;; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
29 ;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
30 ;; details. | |
31 | |
32 ;; You should have received a copy of the GNU General Public License along with | |
33 ;; GNU Emacs; see the file COPYING. If not, write to the Free Software | |
34 ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
35 | |
36 ;;; Commentary: | |
37 | |
38 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
39 ;; | |
40 ;; Introduction | |
41 ;; ------------ | |
42 ;; | |
43 ;; This package provides some printing utilities that includes | |
44 ;; previewing/printing a PostScript file, printing a text file and | |
45 ;; previewing/printing some major modes (like mh-folder-mode, | |
46 ;; rmail-summary-mode, gnus-summary-mode, etc). | |
47 ;; | |
48 ;; `printing' was inspired on: | |
49 ;; | |
50 ;; print-nt.el Frederic Corne <frederic.corne@erli.fr> | |
51 ;; Special printing functions for Windows NT | |
52 ;; | |
53 ;; mh-e-init.el Tom Vogels <tov@ece.cmu.edu> | |
54 ;; PS-print for mail messages | |
55 ;; | |
56 ;; win32-ps-print.el Matthew O. Persico <mpersico@erols.com> | |
57 ;; PostScript printing with ghostscript | |
58 ;; | |
59 ;; ps-print-interface.el Volker Franz <volker.franz@tuebingen.mpg.de> | |
60 ;; Graphical front end for ps-print and previewing | |
61 ;; | |
62 ;; `printing' is prepared to run on GNU, Unix and NT systems. | |
63 ;; On GNU or Unix system, `printing' depends on gs and gv utilities. | |
64 ;; On NT system, `printing' depends on gstools (gswin32.exe and gsview32.exe). | |
65 ;; To obtain ghostscript, ghostview and GSview see the URL | |
66 ;; `http://www.gnu.org/software/ghostscript/ghostscript.html'. | |
67 ;; | |
68 ;; `printing' also depends on ps-print and lpr GNU Emacs packages. | |
69 ;; To download the latest ps-print package see | |
70 ;; `http://www.cpqd.com.br/~vinicius/emacs/ps-print.tar.gz'. | |
71 ;; Please, see README file for ps-print installation instructions. | |
72 ;; | |
73 ;; | |
74 ;; Novices (First Users) | |
75 ;; --------------------- | |
76 ;; | |
77 ;; First of all, take a glance of printing documentation only to have an idea | |
78 ;; of what `printing' is capable. | |
79 ;; | |
80 ;; Then try to set the variables: `pr-ps-name', `pr-ps-printer-alist', | |
81 ;; `pr-txt-name', `pr-txt-printer-alist' and `pr-path-alist'. These variables | |
82 ;; are the main variables for printing processing. | |
83 ;; | |
84 ;; Now, please, see these variables documentation more in deep. You can do | |
85 ;; this by typing C-h v pr-ps-name RET (for example) if you already loaded | |
86 ;; printing package, or by browsing printing.el source file. | |
87 ;; | |
88 ;; If the documentation isn't clear or if you find a way to improve the | |
89 ;; documentation, please, send an email to maintainer. All printing users | |
90 ;; will thank you. | |
91 ;; | |
92 ;; One way to set variables is by calling `pr-customize', customize all | |
93 ;; variables and save the customization by future sessions (see Options | |
94 ;; section). Other way is by coding your settings on Emacs init file (that is, | |
95 ;; .emacs file), see below for a first setting template that it should be | |
96 ;; inserted on your ~/.emacs file (or c:/_emacs, if you're using Windows 9x/NT | |
97 ;; or MS-DOS): | |
98 ;; | |
99 ;; * Example of setting for Windows system: | |
100 ;; | |
101 ;; (require 'printing) ; load printing package | |
102 ;; (setq pr-path-alist | |
103 ;; '((windows "c:/applications/executables" PATH ghostview mpage) | |
104 ;; (ghostview "c:/gs/gsview-dir") | |
105 ;; (mpage "c:/mpage-dir") | |
106 ;; )) | |
107 ;; (setq pr-txt-name 'prt_06a) | |
108 ;; (setq pr-txt-printer-alist | |
109 ;; '((prt_06a "print" nil "/D:\\\\printers\\prt_06a") | |
110 ;; (prt_07c nil nil "/D:\\\\printers\\prt_07c") | |
111 ;; (PRN "" nil "PRN") | |
112 ;; (standard "redpr.exe" nil "") | |
113 ;; )) | |
114 ;; (setq pr-ps-name 'lps_06b) | |
115 ;; (setq pr-ps-printer-alist | |
116 ;; '((lps_06a "print" nil "/D:" "\\\\printers\\lps_06a") | |
117 ;; (lps_06b "print" nil nil "\\\\printers\\lps_06b") | |
118 ;; (lps_07c "print" nil "" "/D:\\\\printers\\lps_07c") | |
119 ;; (lps_08c nil nil nil "\\\\printers\\lps_08c") | |
120 ;; (LPT1 "" nil "" "LPT1:") | |
121 ;; (PRN "" nil "" "PRN") | |
122 ;; (standard "redpr.exe" nil "" "") | |
123 ;; )) | |
124 ;; (pr-update-menus t) ; update now printer and utility menus | |
125 ;; | |
126 ;; * Example of setting for GNU or Unix system: | |
127 ;; | |
128 ;; (require 'printing) ; load printing package | |
129 ;; (setq pr-path-alist | |
130 ;; '((unix "." "~/bin" ghostview mpage PATH) | |
131 ;; (ghostview "$HOME/bin/gsview-dir") | |
132 ;; (mpage "$HOME/bin/mpage-dir") | |
133 ;; )) | |
134 ;; (setq pr-txt-name 'prt_06a) | |
135 ;; (setq pr-txt-printer-alist | |
136 ;; '((prt_06a "lpr" nil "prt_06a") | |
137 ;; (prt_07c nil nil "prt_07c") | |
138 ;; )) | |
139 ;; (setq pr-ps-name 'lps_06b) | |
140 ;; (setq pr-ps-printer-alist | |
141 ;; '((lps_06b "lpr" nil "-P" "lps_06b") | |
142 ;; (lps_07c "lpr" nil nil "lps_07c") | |
143 ;; (lps_08c nil nil nil "lps_08c") | |
144 ;; )) | |
145 ;; (pr-update-menus t) ; update now printer and utility menus | |
146 ;; | |
147 ;; | |
148 ;; NOTE 1: Don't forget to download and install ghostscript utilities (see | |
149 ;; Utilities section). | |
150 ;; | |
151 ;; NOTE 2: The `printer-name' and `ps-printer-name' variables don't need to be | |
152 ;; set, as they are implicit set by `pr-ps-printer-alist' and | |
153 ;; `pr-txt-printer-alist'. | |
154 ;; | |
155 ;; NOTE 3: The duplex feature will only work on PostScript printers that | |
156 ;; support this feature. | |
157 ;; You can check if your PostScript printer supports duplex feature | |
158 ;; by checking the printer manual. Or you can try these steps: | |
159 ;; 1. Open a buffer (or use the *scratch* buffer). | |
160 ;; 2. Type: | |
161 ;; First line (on first page) | |
162 ;; ^L | |
163 ;; Second line (on second page) | |
164 ;; 3. Print this buffer with duplex turned on. | |
165 ;; If it's printed 2 (two) sheets of paper, then your PostScript | |
166 ;; printer doesn't have duplex feature; otherwise, it's ok, your | |
167 ;; printer does have duplex feature. | |
168 ;; | |
54326 | 169 ;; NOTE 4: See Tips section. |
170 ;; | |
171 ;; | |
172 ;; Tips | |
173 ;; ---- | |
174 ;; | |
175 ;; 1. If your have a local printer, that is, a printer which is connected | |
176 ;; directly to your computer, don't forget to connect the printer to your | |
177 ;; computer before printing. | |
178 ;; | |
54333
085835de6939
New tips in Tips section.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54326
diff
changeset
|
179 ;; 2. If you try to print a file and it seems that the file was printed, but |
085835de6939
New tips in Tips section.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54326
diff
changeset
|
180 ;; there is no paper in the printer, then try to set `pr-delete-temp-file' |
085835de6939
New tips in Tips section.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54326
diff
changeset
|
181 ;; to nil. Probably `printing' is deleting the temporary file before your |
085835de6939
New tips in Tips section.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54326
diff
changeset
|
182 ;; local system can get it to send to the printer. |
085835de6939
New tips in Tips section.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54326
diff
changeset
|
183 ;; |
085835de6939
New tips in Tips section.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54326
diff
changeset
|
184 ;; 3. Don't try to print a dynamic buffer, that is, a buffer which is |
085835de6939
New tips in Tips section.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54326
diff
changeset
|
185 ;; modifying while `printing' tries to print. Eventually you got an error |
085835de6939
New tips in Tips section.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54326
diff
changeset
|
186 ;; message. Instead, save the dynamic buffer to a file or copy it in |
085835de6939
New tips in Tips section.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54326
diff
changeset
|
187 ;; another buffer and, then, print the file or the new static buffer. |
085835de6939
New tips in Tips section.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54326
diff
changeset
|
188 ;; An example of dynamic buffer is the *Messages* buffer. |
085835de6939
New tips in Tips section.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54326
diff
changeset
|
189 ;; |
54675
32aae36e32af
Var initialization fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54636
diff
changeset
|
190 ;; 4. When running Emacs on Windows with cygwin, check if the |
32aae36e32af
Var initialization fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54636
diff
changeset
|
191 ;; `pr-shell-file-name' variable is set to the proper shell. This shell |
32aae36e32af
Var initialization fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54636
diff
changeset
|
192 ;; will execute the commands to preview/print the buffer, file or directory. |
32aae36e32af
Var initialization fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54636
diff
changeset
|
193 ;; |
49646 | 194 ;; |
195 ;; Using `printing' | |
196 ;; ---------------- | |
197 ;; | |
198 ;; To use `printing' insert in your ~/.emacs file (or c:/_emacs, if you're | |
199 ;; using Windows 9x/NT or MS-DOS): | |
200 ;; | |
201 ;; (require 'printing) | |
202 ;; | |
203 ;; When `printing' is loaded: | |
204 ;; * On Emacs 20: | |
205 ;; it replaces the Tools/Print menu by Tools/Printing menu. | |
206 ;; * On Emacs 21: | |
207 ;; it replaces the File/Print* menu entries by File/Print menu. | |
208 ;; Please, see section Menu Layout below for menu explanation. | |
209 ;; | |
210 ;; To use `printing' utilities you can use the Printing menu options, type M-x | |
211 ;; followed by one of the commands below, or type a key associated with the | |
212 ;; command you want (if there is a key binding). | |
213 ;; | |
214 ;; `printing' has the following commands: | |
215 ;; | |
216 ;; pr-interface | |
217 ;; pr-ps-directory-preview | |
218 ;; pr-ps-directory-using-ghostscript | |
219 ;; pr-ps-directory-print | |
220 ;; pr-ps-directory-ps-print | |
221 ;; pr-ps-buffer-preview | |
222 ;; pr-ps-buffer-using-ghostscript | |
223 ;; pr-ps-buffer-print | |
224 ;; pr-ps-buffer-ps-print | |
225 ;; pr-ps-region-preview | |
226 ;; pr-ps-region-using-ghostscript | |
227 ;; pr-ps-region-print | |
228 ;; pr-ps-region-ps-print | |
229 ;; pr-ps-mode-preview | |
230 ;; pr-ps-mode-using-ghostscript | |
231 ;; pr-ps-mode-print | |
232 ;; pr-ps-mode-ps-print | |
233 ;; pr-ps-file-preview | |
234 ;; pr-ps-file-up-preview | |
235 ;; pr-ps-file-using-ghostscript | |
236 ;; pr-ps-file-print | |
237 ;; pr-ps-file-ps-print | |
238 ;; pr-ps-file-up-ps-print | |
239 ;; pr-ps-fast-fire | |
240 ;; pr-despool-preview | |
241 ;; pr-despool-using-ghostscript | |
242 ;; pr-despool-print | |
243 ;; pr-despool-ps-print | |
244 ;; pr-printify-directory | |
245 ;; pr-printify-buffer | |
246 ;; pr-printify-region | |
247 ;; pr-txt-directory | |
248 ;; pr-txt-buffer | |
249 ;; pr-txt-region | |
250 ;; pr-txt-mode | |
251 ;; pr-txt-fast-fire | |
252 ;; pr-toggle-file-duplex | |
253 ;; pr-toggle-file-tumble | |
254 ;; pr-toggle-file-landscape | |
255 ;; pr-toggle-ghostscript | |
256 ;; pr-toggle-faces | |
257 ;; pr-toggle-spool | |
258 ;; pr-toggle-duplex | |
259 ;; pr-toggle-tumble | |
260 ;; pr-toggle-landscape | |
261 ;; pr-toggle-upside-down | |
262 ;; pr-toggle-line | |
263 ;; pr-toggle-zebra | |
264 ;; pr-toggle-header | |
265 ;; pr-toggle-lock | |
266 ;; pr-toggle-region | |
267 ;; pr-toggle-mode | |
268 ;; pr-customize | |
269 ;; lpr-customize | |
270 ;; pr-help | |
271 ;; pr-ps-name | |
272 ;; pr-txt-name | |
273 ;; pr-ps-utility | |
274 ;; pr-show-ps-setup | |
275 ;; pr-show-pr-setup | |
276 ;; pr-show-lpr-setup | |
277 ;; | |
278 ;; The general meanings of above commands are: | |
279 ;; | |
280 ;; PREFIX: | |
281 ;; `pr-interface' buffer interface for printing package. | |
282 ;; `pr-help' help for printing package. | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
283 ;; `pr-ps-name' interactively select a PostScript printer. |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
284 ;; `pr-txt-name' interactively select a text printer. |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
285 ;; `pr-ps-utility' interactively select a PostScript utility. |
49646 | 286 ;; `pr-show-*-setup' show current settings. |
287 ;; `pr-ps-*' deal with PostScript code generation. | |
288 ;; `pr-txt-*' deal with text generation. | |
289 ;; `pr-toggle-*' toggle on/off some boolean variable. | |
290 ;; `pr-despool-*' despool the PostScript spooling buffer. | |
291 ;; `pr-printify-*' replace nonprintable ASCII by printable ASCII | |
292 ;; representation. | |
293 ;; | |
294 ;; SUFFIX: | |
295 ;; `*-customize' customization. | |
296 ;; `*-preview' preview a PostScript file. | |
297 ;; `*-using-ghostscript' use ghostscript to print. | |
298 ;; `*-fast-fire' fast fire command (see it for documentation). | |
299 ;; `*-print' send PostScript directly to printer. | |
300 ;; `*-ps-print' send PostScript directly to printer or use | |
301 ;; ghostscript to print. It depends on | |
302 ;; `pr-print-using-ghostscript' option. | |
303 ;; | |
304 ;; INFIX/SUFFIX: | |
305 ;; `*-directory*' process a directory. | |
306 ;; `*-buffer*' process a buffer. | |
307 ;; `*-region*' process a region. | |
308 ;; `*-mode*' process a major mode (see explanation below). | |
309 ;; `*-file-*' process a PostScript file. | |
310 ;; `*-file-up-*' process a PostScript file using a filter utility. | |
311 ;; | |
312 ;; Here are some examples: | |
313 ;; | |
314 ;; `pr-ps-buffer-using-ghostscript' | |
315 ;; Use ghostscript to print a buffer. | |
316 ;; | |
317 ;; `pr-ps-file-print' | |
318 ;; Print a PostScript file. | |
319 ;; | |
320 ;; `pr-toggle-spool' | |
321 ;; Toggle spooling buffer. | |
322 ;; | |
323 ;; So you can preview through ghostview, use ghostscript to print (if you don't | |
324 ;; have a PostScript printer) or send directly to printer a PostScript code | |
325 ;; generated by `ps-print' package. | |
326 ;; | |
327 ;; Besides operating one buffer or region each time, you also can postpone | |
328 ;; previewing or printing by saving the PostScript code generated in a | |
329 ;; temporary Emacs buffer. This way you can save banner pages between | |
330 ;; successive printing. You can toggle on/off spooling by invoking | |
331 ;; `pr-toggle-spool' interactively or through menu bar. | |
332 ;; | |
333 ;; If you type, for example: | |
334 ;; | |
335 ;; C-u M-x pr-ps-buffer-print RET | |
336 ;; | |
337 ;; The `pr-ps-buffer-print' command prompts you for a n-up printing number and | |
338 ;; a file name, and save the PostScript code generated to the file name instead | |
339 ;; of sending to printer. | |
340 ;; | |
341 ;; This behavior is similar with the commands that deal with PostScript code | |
342 ;; generation, that is, with `pr-ps-*' and `pr-despool-*' commands. If | |
343 ;; spooling is on, only `pr-despool-*' commands prompt for a file name and save | |
344 ;; the PostScript code spooled in this file. | |
345 ;; | |
346 ;; Besides the behavior described above, the `*-directory*' commands also | |
347 ;; prompt for a directory and a file name regexp. So, it's possible to process | |
348 ;; all or certain files on a directory at once (see also documentation for | |
349 ;; `pr-list-directory'). | |
350 ;; | |
351 ;; `printing' has also a special way to handle some major mode through | |
352 ;; `*-mode*' commands. So it's possible to customize a major mode printing, | |
353 ;; it's only needed to declare the customization in `pr-mode-alist' (see | |
354 ;; section Options) and invoke some of `*-mode*' commands. An example for | |
355 ;; major mode usage is when you're using gnus (or mh, or rmail, etc.) and | |
356 ;; you're in the *Summary* buffer, if you forget to switch to the *Article* | |
357 ;; buffer before printing, you'll get a nicely formatted list of article | |
358 ;; subjects shows up at the printer. With major mode printing you don't need | |
359 ;; to switch from gnus *Summary* buffer first. | |
360 ;; | |
361 ;; Current global keyboard mapping for GNU Emacs is: | |
362 ;; | |
363 ;; (global-set-key [print] 'pr-ps-fast-fire) | |
364 ;; (global-set-key [M-print] 'pr-ps-mode-using-ghostscript) | |
365 ;; (global-set-key [C-print] 'pr-txt-fast-fire) | |
366 ;; | |
367 ;; And for XEmacs is: | |
368 ;; | |
369 ;; (global-set-key 'f22 'pr-ps-fast-fire) | |
370 ;; (global-set-key '(meta f22) 'pr-ps-mode-using-ghostscript) | |
371 ;; (global-set-key '(control f22) 'pr-txt-fast-fire) | |
372 ;; | |
373 ;; As a suggestion of global keyboard mapping for some `printing' commands: | |
374 ;; | |
375 ;; (global-set-key "\C-ci" 'pr-interface) | |
376 ;; (global-set-key "\C-cbp" 'pr-ps-buffer-print) | |
377 ;; (global-set-key "\C-cbx" 'pr-ps-buffer-preview) | |
378 ;; (global-set-key "\C-cbb" 'pr-ps-buffer-using-ghostscript) | |
379 ;; (global-set-key "\C-crp" 'pr-ps-region-print) | |
380 ;; (global-set-key "\C-crx" 'pr-ps-region-preview) | |
381 ;; (global-set-key "\C-crr" 'pr-ps-region-using-ghostscript) | |
382 ;; | |
383 ;; | |
384 ;; Options | |
385 ;; ------- | |
386 ;; | |
387 ;; Below it's shown a brief description of `printing' options, please, see the | |
388 ;; options declaration in the code for a long documentation. | |
389 ;; | |
390 ;; `pr-path-style' Specify which path style to use for external | |
391 ;; commands. | |
392 ;; | |
393 ;; `pr-path-alist' Specify an alist for command paths. | |
394 ;; | |
395 ;; `pr-txt-name' Specify a printer for printing a text file. | |
396 ;; | |
397 ;; `pr-txt-printer-alist' Specify an alist of all text printers. | |
398 ;; | |
399 ;; `pr-ps-name' Specify a printer for printing a PostScript | |
400 ;; file. | |
401 ;; | |
402 ;; `pr-ps-printer-alist' Specify an alist for all PostScript printers. | |
403 ;; | |
404 ;; `pr-temp-dir' Specify a directory for temporary files during | |
405 ;; printing. | |
406 ;; | |
407 ;; `pr-ps-temp-file' Specify PostScript temporary file name. | |
408 ;; | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
409 ;; `pr-gv-command' Specify path and name of the gsview/gv |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
410 ;; utility. |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
411 ;; |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
412 ;; `pr-gs-command' Specify path and name of the ghostscript |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
413 ;; utility. |
49646 | 414 ;; |
415 ;; `pr-gs-switches' Specify ghostscript switches. | |
416 ;; | |
417 ;; `pr-gs-device' Specify ghostscript device switch value. | |
418 ;; | |
419 ;; `pr-gs-resolution' Specify ghostscript resolution switch value. | |
420 ;; | |
421 ;; `pr-print-using-ghostscript' Non-nil means print using ghostscript. | |
422 ;; | |
423 ;; `pr-faces-p' Non-nil means print with face attributes. | |
424 ;; | |
425 ;; `pr-spool-p' Non-nil means spool printing in a buffer. | |
426 ;; | |
427 ;; `pr-file-landscape' Non-nil means print PostScript file in | |
428 ;; landscape orientation. | |
429 ;; | |
430 ;; `pr-file-duplex' Non-nil means print PostScript file in duplex | |
431 ;; mode. | |
432 ;; | |
433 ;; `pr-file-tumble' Non-nil means print PostScript file in tumble | |
434 ;; mode. | |
435 ;; | |
436 ;; `pr-auto-region' Non-nil means region is automagically detected. | |
437 ;; | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
438 ;; `pr-auto-mode' Non-nil means major-mode specific printing is |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
439 ;; prefered over normal printing. |
49646 | 440 ;; |
441 ;; `pr-mode-alist' Specify an alist for a major-mode and printing | |
442 ;; function. | |
443 ;; | |
444 ;; `pr-ps-utility' Specify PostScript utility processing. | |
445 ;; | |
446 ;; `pr-ps-utility-alist' Specify an alist for PostScript utility | |
447 ;; processing. | |
448 ;; | |
449 ;; `pr-menu-lock' Non-nil means menu is locked while selecting | |
450 ;; toggle options. | |
451 ;; | |
452 ;; `pr-menu-char-height' Specify menu char height in pixels. | |
453 ;; | |
454 ;; `pr-menu-char-width' Specify menu char width in pixels. | |
455 ;; | |
456 ;; `pr-setting-database' Specify an alist for settings in general. | |
457 ;; | |
458 ;; `pr-visible-entry-list' Specify a list of Printing menu visible | |
459 ;; entries. | |
460 ;; | |
461 ;; `pr-delete-temp-file' Non-nil means delete temporary files. | |
462 ;; | |
463 ;; `pr-list-directory' Non-nil means list directory when processing a | |
464 ;; directory. | |
465 ;; | |
466 ;; `pr-buffer-name' Specify the name of the buffer interface for | |
467 ;; printing package. | |
468 ;; | |
469 ;; `pr-buffer-name-ignore' Specify a regexp list for buffer names to be | |
470 ;; ignored in interface buffer. | |
471 ;; | |
472 ;; `pr-buffer-verbose' Non-nil means to be verbose when editing a | |
473 ;; field in interface buffer. | |
474 ;; | |
475 ;; `pr-shell-file-name' Specify file name to load inferior shells | |
476 ;; from. | |
477 ;; | |
478 ;; To set the above options you may: | |
479 ;; | |
480 ;; a) insert the code in your ~/.emacs, like: | |
481 ;; | |
482 ;; (setq pr-faces-p t) | |
483 ;; | |
484 ;; This way always keep your default settings when you enter a new Emacs | |
485 ;; session. | |
486 ;; | |
487 ;; b) or use `set-variable' in your Emacs session, like: | |
488 ;; | |
489 ;; M-x set-variable RET pr-faces-p RET t RET | |
490 ;; | |
491 ;; This way keep your settings only during the current Emacs session. | |
492 ;; | |
493 ;; c) or use customization, for example: | |
494 ;; click on menu-bar *Help* option, | |
495 ;; then click on *Customize*, | |
496 ;; then click on *Browse Customization Groups*, | |
497 ;; expand *PostScript* group, | |
498 ;; expand *Printing* group | |
499 ;; and then customize `printing' options. | |
500 ;; Through this way, you may choose if the settings are kept or not when | |
501 ;; you leave out the current Emacs session. | |
502 ;; | |
503 ;; d) or see the option value: | |
504 ;; | |
505 ;; C-h v pr-faces-p RET | |
506 ;; | |
507 ;; and click the *customize* hypertext button. | |
508 ;; Through this way, you may choose if the settings are kept or not when | |
509 ;; you leave out the current Emacs session. | |
510 ;; | |
511 ;; e) or invoke: | |
512 ;; | |
513 ;; M-x pr-customize RET | |
514 ;; | |
515 ;; and then customize `printing' options. | |
516 ;; Through this way, you may choose if the settings are kept or not when | |
517 ;; you leave out the current Emacs session. | |
518 ;; | |
519 ;; f) or use menu bar, for example: | |
520 ;; click on menu-bar *File* option, | |
521 ;; then click on *Printing*, | |
522 ;; then click on *Customize*, | |
523 ;; then click on *printing* | |
524 ;; and then customize `printing' options. | |
525 ;; Through this way, you may choose if the settings are kept or not when | |
526 ;; you leave out the current Emacs session. | |
527 ;; | |
528 ;; | |
529 ;; Menu Layout | |
530 ;; ----------- | |
531 ;; | |
532 ;; The `printing' menu (Tools/Printing or File/Print) has the following layout: | |
533 ;; | |
534 ;; +-----------------------------+ | |
535 ;; A 0 | Printing Interface | | |
536 ;; +-----------------------------+ +-A---------+ +-B------+ | |
537 ;; I 1 | PostScript Preview >|-------|Directory >|-----|1-up | | |
538 ;; 2 | PostScript Print >|---- A |Buffer >|-- B |2-up | | |
539 ;; 3 | PostScript Printer: name >|---- C |Region >|-- B |4-up | | |
540 ;; +-----------------------------+ |Mode >|-- B |Other...| | |
541 ;; II 4 | Printify >|-----\ |File >|--\ +--------+ | |
542 ;; 5 | Print >|---\ | |Despool... | | | |
543 ;; 6 | Text Printer: name >|-\ | | +-----------+ | | |
544 ;; +-----------------------------+ | | | +---------+ +------------+ | |
54210
602769168263
Replace "As Is..." in PostScript file print/preview by "No Preprocessing...".
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54209
diff
changeset
|
545 ;; III 7 |[ ]Landscape | | | \-|Directory| | No Prep... | Ia |
49646 | 546 ;; 8 |[ ]Print Header | | | |Buffer | +------------+ Ib |
547 ;; 9 |[ ]Print Header Frame | | | |Region | | name >|- C | |
548 ;; 10 |[ ]Line Number | | | +---------+ +------------+ | |
549 ;; 11 |[ ]Zebra Stripes | | | +---------+ | 1-up... | Ic | |
550 ;; 12 |[ ]Duplex | | \---|Directory| | 2-up... | | |
551 ;; 13 |[ ]Tumble | \--\ |Buffer | | 4-up... | | |
552 ;; 14 |[ ]Upside-Down | | |Region | | Other... | | |
553 ;; 15 | Print All Pages >|--\ | |Mode | +------------+ | |
554 ;; +-----------------------------+ | | +---------+ |[ ]Landscape| Id | |
555 ;; IV 16 |[ ]Spool Buffer | | | +-C-------+ |[ ]Duplex | Ie | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
556 ;; 17 |[ ]Print with faces | | \--|( )name A| |[ ]Tumble | If |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
557 ;; 18 |[ ]Print via Ghostscript | | |( )name B| +------------+ |
49646 | 558 ;; +-----------------------------+ | |... | |
559 ;; V 19 |[ ]Auto Region | | |(*)name | | |
560 ;; 20 |[ ]Auto Mode | | |... | | |
561 ;; 21 |[ ]Menu Lock | | +---------+ +--------------+ | |
562 ;; +-----------------------------+ \------------------|(*)All Pages | | |
563 ;; VI 22 | Customize >|--- D +-D------+ |( )Even Pages | | |
564 ;; 23 | Show Settings >|-------|printing| |( )Odd Pages | | |
565 ;; 24 | Help | |ps-print| |( )Even Sheets| | |
566 ;; +-----------------------------+ |lpr | |( )Odd Sheets | | |
567 ;; +--------+ +--------------+ | |
568 ;; | |
569 ;; See `pr-visible-entry-list' for hiding some parts of the menu. | |
570 ;; | |
571 ;; The menu has the following sections: | |
572 ;; | |
573 ;; A. Interface: | |
574 ;; | |
575 ;; 0. You can use a buffer interface instead of menus. It looks like the | |
576 ;; customization buffer. Basically, it has the same options found in the | |
577 ;; menu and some extra options, all this on a buffer. | |
578 ;; | |
579 ;; I. PostScript printing: | |
580 ;; | |
581 ;; 1. You can generate a PostScript file (if you type C-u before activating | |
582 ;; menu) or PostScript temporary file for a directory, a buffer, a region | |
583 ;; or a major mode, choosing 1-up, 2-up, 4-up or any other n-up printing; | |
584 ;; after file generation, ghostview is activated using the file generated | |
585 ;; as argument. This option is disabled if spooling is on (option 16). | |
586 ;; Also, if you already have a PostScript file you can preview it. | |
587 ;; Instead of previewing each buffer, region or major mode at once, you | |
588 ;; can save temporarily the PostScript code generated in a buffer and | |
589 ;; preview it later. The option `Despool...' despools the PostScript | |
590 ;; spooling buffer in a temporary file and uses ghostview to preview it. | |
591 ;; If you type C-u before choosing this option, the PostScript code | |
592 ;; generated is saved in a file instead of saving in a temporary file. | |
593 ;; To spool the PostScript code generated you need to turn on the option | |
594 ;; 16. The option `Despool...' is enabled if spooling is on (option | |
595 ;; 16). | |
596 ;; | |
597 ;; NOTE 1: It's possible to customize a major mode printing, just declare | |
598 ;; the customization in `pr-mode-alist' and invoke some of | |
599 ;; `*-mode*' commands or select Mode option in Printing menu. An | |
600 ;; example for major mode usage is when you're using gnus (or mh, | |
601 ;; or rmail, etc.) and you're in the *Summary* buffer, if you | |
602 ;; forget to switch to the *Article* buffer before printing, | |
603 ;; you'll get a nicely formatted list of article subjects shows | |
604 ;; up at the printer. With major mode printing you don't need to | |
605 ;; switch from gnus *Summary* buffer first. | |
606 ;; | |
607 ;; NOTE 2: There are the following options for PostScript file | |
608 ;; processing: | |
54210
602769168263
Replace "As Is..." in PostScript file print/preview by "No Preprocessing...".
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54209
diff
changeset
|
609 ;; Ia. Print the file *No Preprocessing*, that is, send it |
602769168263
Replace "As Is..." in PostScript file print/preview by "No Preprocessing...".
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54209
diff
changeset
|
610 ;; directly to PostScript printer. |
49646 | 611 ;; Ib. PostScript utility processing selection. |
612 ;; See `pr-ps-utility-alist' and `pr-setting-database' for | |
613 ;; documentation. | |
614 ;; Ic. Do n-up processing before printing. | |
615 ;; Id. Toggle on/off landscape for PostScript file processing. | |
616 ;; Ie. Toggle on/off duplex for PostScript file processing. | |
617 ;; If. Toggle on/off tumble for PostScript file processing. | |
618 ;; | |
619 ;; NOTE 3: Don't forget to download and install the utilities declared on | |
620 ;; `pr-ps-utility-alist'. | |
621 ;; | |
622 ;; 2. Operate the same way as option 1, but it sends directly the PostScript | |
623 ;; code (or put in a file, if you've typed C-u) or it uses ghostscript to | |
624 ;; print the PostScript file generated. It depends on option 18, if it's | |
625 ;; turned on, it uses ghostscript; otherwise, it sends directly to | |
626 ;; printer. If spooling is on (option 16), the PostScript code is saved | |
627 ;; temporarily in a buffer instead of printing it or saving it in a file. | |
628 ;; Also, if you already have a PostScript file you can print it. Instead | |
629 ;; of printing each buffer, region or major mode at once, you can save | |
630 ;; temporarily the PostScript code generated in a buffer and print it | |
631 ;; later. The option `Despool...' despools the PostScript spooling | |
632 ;; buffer directly on a printer. If you type C-u before choosing this | |
633 ;; option, the PostScript code generated is saved in a file instead of | |
634 ;; sending to printer. To spool the PostScript code generated you need | |
635 ;; to turn on the option 16. This option is enabled if spooling is on | |
636 ;; (option 16). See also the NOTE 1, NOTE 2 and NOTE 3 on option 1. | |
637 ;; | |
638 ;; 3. You can select a new PostScript printer to send PostScript code | |
639 ;; generated. For selection it's used all PostScript printers defined | |
640 ;; in `pr-ps-printer-alist' variable (see it for documentation). | |
641 ;; See also `pr-setting-database'. | |
642 ;; | |
643 ;; II. Text printing: | |
644 ;; | |
645 ;; 4. If you have control characters (character code from \000 to \037) in a | |
646 ;; buffer and you want to print them in a text printer, select this | |
647 ;; option. All control characters in your buffer or region will be | |
648 ;; replaced by a printable representation. The printable representations | |
649 ;; use ^ (for ASCII control characters) or hex. The characters tab, | |
650 ;; linefeed, space, return and formfeed are not affected. You don't need | |
651 ;; to select this option if you use any option of section I, the | |
652 ;; PostScript engine treats control characters properly. | |
653 ;; | |
654 ;; 5. If you want to print a directory, buffer, region or major mode in a | |
655 ;; text printer, select this option. See also the NOTE 1 on option 1. | |
656 ;; | |
657 ;; 6. You can select a new text printer to send text generated. For | |
658 ;; selection it's used all text printers defined in | |
659 ;; `pr-txt-printer-alist' variable (see it for documentation). | |
660 ;; See also `pr-setting-database'. | |
661 ;; | |
662 ;; III. PostScript page toggle options: | |
663 ;; | |
664 ;; 7. If you want a PostScript landscape printing, turn on this option. | |
665 ;; | |
666 ;; 8. If you want to have a header in each page in your PostScript code, | |
667 ;; turn on this option. | |
668 ;; | |
669 ;; 9. If you want to draw a gaudy frame around the header, turn on this | |
670 ;; option. This option is enabled if print header is on (option 8). | |
671 ;; | |
672 ;; 10. If you want that the line number is printed in your PostScript code, | |
673 ;; turn on this option. | |
674 ;; | |
675 ;; 11. If you want background zebra stripes in your PostScript code, turn on | |
676 ;; this option. | |
677 ;; | |
678 ;; 12. If you want a duplex printing and your PostScript printer has this | |
679 ;; feature, turn on this option. | |
680 ;; | |
681 ;; 13. If you turned on duplex printing, you can choose if you want to have | |
682 ;; a printing suitable for binding on the left or right (tumble off), or | |
683 ;; to have a printing suitable for binding at top or bottom (tumble on). | |
684 ;; This option is enabled if duplex is on (option 12). | |
685 ;; | |
686 ;; 14. If you want a PostScript upside-down printing, turn on this option. | |
687 ;; | |
688 ;; 15. With this option, you can choose if you want to print all pages, odd | |
689 ;; pages, even pages, odd sheets or even sheets. | |
690 ;; See also `ps-even-or-odd-pages'. | |
691 ;; | |
692 ;; IV. PostScript processing toggle options: | |
693 ;; | |
694 ;; 16. If you want to spool the PostScript code generated, turn on this | |
695 ;; option. To spool the PostScript code generated use option 2. You | |
696 ;; can despool later by choosing option 1 or 2, sub-option `Despool...'. | |
697 ;; | |
698 ;; 17. If you use colors in your buffers and want to see these colors on | |
699 ;; your PostScript code generated, turn on this option. If you have a | |
700 ;; black/white PostScript printer, these colors are displayed in gray | |
701 ;; scale by PostScript printer interpreter. | |
702 ;; | |
703 ;; 18. If you don't have a PostScript printer to send PostScript files, turn | |
704 ;; on this option. When this option is on, the ghostscript is used to | |
705 ;; print PostScript files. In GNU or Unix system, if ghostscript is set | |
706 ;; as a PostScript filter, you don't need to turn on this option. | |
707 ;; | |
708 ;; V. Printing customization: | |
709 ;; | |
710 ;; 19. If you want that region is automagically detected, turn on this | |
711 ;; option. Note that this will only work if you're using transient mark | |
712 ;; mode. When this option is on, the `*-buffer*' commands will behave | |
713 ;; like `*-region*' commands, that is, `*-buffer*' commands will print | |
714 ;; only the region marked instead of all buffer. | |
715 ;; | |
716 ;; 20. Turn this option on if you want that when current major-mode is | |
717 ;; declared in `pr-mode-alist', the `*-buffer*' and `*-region*' commands | |
718 ;; behave like `*-mode*' commands. | |
719 ;; | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
720 ;; 21. If you want that Printing menu stays open while you are setting |
49646 | 721 ;; toggle options, turn on this option. The variables |
722 ;; `pr-menu-char-height' and `pr-menu-char-width' are used to guess the | |
723 ;; menu position, so don't forget to adjust these variables if menu | |
724 ;; position is not ok. | |
725 ;; | |
726 ;; VI. Customization: | |
727 ;; | |
728 ;; 22. Besides all options in section III, IV and V, you can customize much | |
729 ;; more PostScript options in `ps-print' option. Or you can customize | |
730 ;; some `lpr' options for text printing. Or customize `printing' | |
731 ;; options. | |
732 ;; | |
733 ;; 23. Show current settings for `printing', `ps-print' or `lpr'. | |
734 ;; | |
735 ;; 24. Quick help for printing menu layout. | |
736 ;; | |
737 ;; | |
738 ;; Option Settings | |
739 ;; --------------- | |
740 ;; | |
741 ;; Below it's shown only the main options that affect all `printing' package. | |
742 ;; Check all the settings below *BEFORE* running `printing' commands. | |
743 ;; | |
744 ;; * Example of setting for GNU or Unix system: | |
745 ;; | |
746 ;; (require 'printing) | |
747 ;; (setq pr-path-alist | |
748 ;; '((unix "." "~/bin" ghostview mpage PATH) | |
749 ;; (ghostview "$HOME/bin/gsview-dir") | |
750 ;; (mpage "$HOME/bin/mpage-dir") | |
751 ;; )) | |
752 ;; (setq pr-txt-name 'prt_06a) | |
753 ;; (setq pr-txt-printer-alist | |
754 ;; '((prt_06a "lpr" nil "prt_06a") | |
755 ;; (prt_07c nil nil "prt_07c") | |
756 ;; )) | |
757 ;; (setq pr-ps-name 'lps_06b) | |
758 ;; (setq pr-ps-printer-alist | |
759 ;; '((lps_06b "lpr" nil "-P" "lps_06b") | |
760 ;; (lps_07c "lpr" nil nil "lps_07c") | |
761 ;; (lps_08c nil nil nil "lps_08c") | |
762 ;; )) | |
763 ;; (setq pr-temp-dir "/tmp/") | |
764 ;; (setq pr-gv-command "gv") | |
765 ;; (setq pr-gs-command "gs") | |
766 ;; (setq pr-gs-switches '("-q -dNOPAUSE -I/usr/share/ghostscript/5.10")) | |
767 ;; (setq pr-gs-device "uniprint") | |
768 ;; (setq pr-gs-resolution 300) | |
769 ;; (setq pr-ps-utility 'mpage) | |
770 ;; (setq pr-ps-utility-alist | |
771 ;; '((mpage "mpage" nil "-b%s" "-%d" "-l" "-t" "-T" ">" nil) | |
772 ;; (psnup "psnup" ("-q") "-P%s" "-%d" "-l" nil nil " " nil | |
773 ;; (inherits-from: . no-duplex)) | |
774 ;; )) | |
775 ;; (setq pr-setting-database | |
776 ;; '((no-duplex | |
777 ;; nil nil nil | |
778 ;; (pr-file-duplex . nil) | |
779 ;; (pr-file-tumble . nil)) | |
780 ;; )) | |
781 ;; (pr-update-menus t) ; update now printer and utility menus | |
782 ;; | |
783 ;; * Example of setting for Windows system: | |
784 ;; | |
785 ;; (require 'printing) | |
786 ;; (setq pr-path-alist | |
787 ;; '((windows "c:/applications/executables" PATH ghostview mpage) | |
788 ;; (ghostview "c:/gs/gsview-dir") | |
789 ;; (mpage "c:/mpage-dir") | |
790 ;; )) | |
791 ;; (setq pr-txt-name 'prt_06a) | |
792 ;; (setq pr-txt-printer-alist | |
793 ;; '((prt_06a "print" nil "/D:\\\\printers\\prt_06a") | |
794 ;; (prt_07c nil nil "/D:\\\\printers\\prt_07c") | |
795 ;; (PRN "" nil "PRN") | |
796 ;; (standard "redpr.exe" nil "") | |
797 ;; )) | |
798 ;; (setq pr-ps-name 'lps_06b) | |
799 ;; (setq pr-ps-printer-alist | |
800 ;; '((lps_06a "print" nil "/D:" "\\\\printers\\lps_06a") | |
801 ;; (lps_06b "print" nil nil "\\\\printers\\lps_06b") | |
802 ;; (lps_07c "print" nil "" "/D:\\\\printers\\lps_07c") | |
803 ;; (lps_08c nil nil nil "\\\\printers\\lps_08c") | |
804 ;; (LPT1 "" nil "" "LPT1:") | |
805 ;; (PRN "" nil "" "PRN") | |
806 ;; (standard "redpr.exe" nil "" "") | |
807 ;; )) | |
808 ;; (setq pr-temp-dir "C:/WINDOWS/TEMP/") | |
809 ;; (setq pr-gv-command "c:/gs/gsview/gsview32.exe") | |
810 ;; (setq pr-gs-command "c:/gs/gswin32.exe") | |
811 ;; (setq pr-gs-switches '("-q -dNOPAUSE -Ic:/gs/gs5.50;c:/gs/gs5.50/fonts")) | |
812 ;; (setq pr-gs-device "mswinpr2") | |
813 ;; (setq pr-gs-resolution 300) | |
814 ;; (setq pr-ps-utility 'psnup) | |
815 ;; (setq pr-ps-utility-alist | |
816 ;; '((psnup "c:/psutils/psnup" ("-q") "-P%s" "-%d" "-l" nil nil " " | |
817 ;; nil (inherits-from: . no-duplex)) | |
818 ;; )) | |
819 ;; (setq pr-setting-database | |
820 ;; '((no-duplex | |
821 ;; nil nil nil | |
822 ;; (pr-file-duplex . nil) | |
823 ;; (pr-file-tumble . nil)) | |
824 ;; )) | |
825 ;; (pr-update-menus t) ; update now printer and utility menus | |
826 ;; | |
827 ;; NOTE: Don't forget to download and install the utilities declared on | |
828 ;; `pr-ps-utility-alist'. | |
829 ;; | |
830 ;; | |
831 ;; Utilities | |
832 ;; --------- | |
833 ;; | |
834 ;; `printing' package has the following utilities: | |
835 ;; | |
836 ;; `pr-setup' Return the current `printing' setup. | |
837 ;; | |
838 ;; `lpr-setup' Return the current `lpr' setup. | |
839 ;; | |
840 ;; `pr-update-menus' Update utility, PostScript and text printer menus. | |
841 ;; | |
842 ;; Below are some URL where you can find good utilities. | |
843 ;; | |
844 ;; * For `printing' package: | |
845 ;; | |
846 ;; printing `http://www.cpqd.com.br/~vinicius/emacs/printing.el.gz' | |
847 ;; ps-print `http://www.cpqd.com.br/~vinicius/emacs/ps-print.tar.gz' | |
848 ;; | |
849 ;; * For GNU or Unix system: | |
850 ;; | |
851 ;; gs, gv `http://www.gnu.org/software/ghostscript/ghostscript.html' | |
852 ;; enscript `http://people.ssh.fi/mtr/genscript/' | |
853 ;; psnup `http://www.dcs.ed.ac.uk/home/ajcd/psutils/index.html' | |
854 ;; mpage `http://www.mesa.nl/pub/mpage/' | |
855 ;; | |
856 ;; * For Windows system: | |
857 ;; | |
858 ;; gswin32, gsview32 | |
859 ;; `http://www.gnu.org/software/ghostscript/ghostscript.html' | |
860 ;; enscript `http://people.ssh.fi/mtr/genscript/' | |
861 ;; psnup `http://www.dcs.ed.ac.uk/home/ajcd/psutils/index.html' | |
862 ;; redmon `http://www.cs.wisc.edu/~ghost/redmon/' | |
863 ;; | |
864 ;; | |
865 ;; Acknowledgments | |
866 ;; --------------- | |
867 ;; | |
54326 | 868 ;; Thanks to Drew Adams <drew.adams@oracle.com> for directory processing and |
869 ;; `pr-path-alist' suggestions. | |
49646 | 870 ;; |
871 ;; Thanks to Fred Labrosse <f.labrosse@maths.bath.ac.uk> for XEmacs tests. | |
872 ;; | |
873 ;; Thanks to Klaus Berndl <klaus.berndl@sdm.de> for invaluable help/debugging | |
874 ;; and for suggestions: | |
875 ;; - even/odd pages printing. | |
876 ;; - ghostscript parameters for `pr-ps-printer-alist'. | |
877 ;; - default printer name. | |
878 ;; - completion functions. | |
879 ;; - automagic region detection. | |
880 ;; - menu entry hiding. | |
881 ;; - fast fire PostScript printing command. | |
882 ;; - `pr-path-style' variable. | |
883 ;; | |
884 ;; Thanks to Kim F. Storm <storm@filanet.dk> for beta-test and for suggestions: | |
885 ;; - PostScript Print and PostScript Print Preview merge. | |
886 ;; - Tools/Printing menu. | |
887 ;; - replace *-using-preview by *-using-ghostscript. | |
888 ;; - printer selection. | |
889 ;; - extra parameters for `pr-ps-printer-alist'. | |
890 ;; | |
891 ;; Thanks to: | |
892 ;; Frederic Corne <frederic.corne@erli.fr> print-nt.el | |
893 ;; Tom Vogels <tov@ece.cmu.edu> mh-e-init.el | |
894 ;; Matthew O. Persico <mpersico@erols.com> win32-ps-print.el | |
895 ;; Volker Franz <volker.franz@tuebingen.mpg.de> ps-print-interface.el | |
896 ;; And to all people who contributed with them. | |
897 ;; | |
898 ;; | |
899 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
900 | |
901 ;;; Code: | |
902 | |
903 | |
904 (require 'lpr) | |
905 (require 'ps-print) | |
906 | |
907 | |
908 (and (string< ps-print-version "6.5.7") | |
909 (error "`printing' requires `ps-print' package version 6.5.7 or later.")) | |
910 | |
911 | |
912 (eval-and-compile | |
913 (defconst pr-cygwin-system | |
914 (and ps-windows-system (getenv "OSTYPE") | |
915 (string-match "cygwin" (getenv "OSTYPE"))))) | |
916 | |
917 | |
918 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
919 ;; To avoid compilation gripes | |
920 | |
921 | |
922 (eval-and-compile | |
923 | |
924 (or (fboundp 'subst-char-in-string) | |
925 (defun subst-char-in-string (fromchar tochar string &optional inplace) | |
926 "Replace FROMCHAR with TOCHAR in STRING each time it occurs. | |
927 Unless optional argument INPLACE is non-nil, return a new string." | |
928 (let ((i (length string)) | |
929 (newstr (if inplace string (copy-sequence string)))) | |
930 (while (> (setq i (1- i)) 0) | |
931 (if (eq (aref newstr i) fromchar) | |
932 (aset newstr i tochar))) | |
933 newstr))) | |
934 | |
935 ;; GNU Emacs | |
936 (defalias 'pr-e-frame-char-height 'frame-char-height) | |
937 (defalias 'pr-e-frame-char-width 'frame-char-width) | |
938 (defalias 'pr-e-mouse-pixel-position 'mouse-pixel-position) | |
939 ;; XEmacs | |
940 (defalias 'pr-x-add-submenu 'add-submenu) | |
941 (defalias 'pr-x-event-function 'event-function) | |
942 (defalias 'pr-x-event-object 'event-object) | |
943 (defalias 'pr-x-find-menu-item 'find-menu-item) | |
944 (defalias 'pr-x-font-height 'font-height) | |
945 (defalias 'pr-x-font-width 'font-width) | |
946 (defalias 'pr-x-get-popup-menu-response 'get-popup-menu-response) | |
947 (defalias 'pr-x-make-event 'make-event) | |
948 (defalias 'pr-x-misc-user-event-p 'misc-user-event-p) | |
949 (defalias 'pr-x-relabel-menu-item 'relabel-menu-item) | |
950 (defalias 'pr-x-event-x-pixel 'event-x-pixel) | |
951 (defalias 'pr-x-event-y-pixel 'event-y-pixel) | |
952 | |
953 (cond | |
954 ((eq ps-print-emacs-type 'emacs) ; GNU Emacs | |
955 (defvar deactivate-mark nil) | |
956 (defalias 'pr-f-set-keymap-parents 'set-keymap-parent) | |
957 (defalias 'pr-f-set-keymap-name 'ignore) | |
958 (defalias 'pr-f-read-string 'read-string) | |
959 (defun pr-keep-region-active () | |
960 (setq deactivate-mark nil))) | |
961 | |
962 ((eq ps-print-emacs-type 'xemacs) ; XEmacs | |
963 (defvar current-menubar nil) | |
964 (defvar current-mouse-event nil) | |
965 (defvar zmacs-region-stays nil) | |
966 (defalias 'pr-f-set-keymap-parents 'set-keymap-parents) | |
967 (defalias 'pr-f-set-keymap-name 'set-keymap-name) | |
968 (defun pr-f-read-string (prompt initial history default) | |
969 (let ((str (read-string prompt initial))) | |
970 (if (and str (not (string= str ""))) | |
971 str | |
972 default))) | |
973 (defun pr-keep-region-active () | |
974 (setq zmacs-region-stays t))))) | |
975 | |
976 | |
977 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
978 ;; Customization Functions | |
979 | |
980 | |
981 (defun pr-alist-custom-set (symbol value) | |
982 "Set the value of custom variables for printer & utility selection." | |
983 (set symbol value) | |
984 (and (featurep 'printing) ; update only after printing is loaded | |
985 (pr-update-menus t))) | |
986 | |
987 | |
988 (defun pr-ps-utility-custom-set (symbol value) | |
989 "Update utility menu entry." | |
990 (set symbol value) | |
991 (and (featurep 'printing) ; update only after printing is loaded | |
992 (pr-menu-set-utility-title value))) | |
993 | |
994 | |
995 (defun pr-ps-name-custom-set (symbol value) | |
996 "Update `PostScript Printer:' menu entry." | |
997 (set symbol value) | |
998 (and (featurep 'printing) ; update only after printing is loaded | |
999 (pr-menu-set-ps-title value))) | |
1000 | |
1001 | |
1002 (defun pr-txt-name-custom-set (symbol value) | |
1003 "Update `Text Printer:' menu entry." | |
1004 (set symbol value) | |
1005 (and (featurep 'printing) ; update only after printing is loaded | |
1006 (pr-menu-set-txt-title value))) | |
1007 | |
1008 | |
1009 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1010 ;; User Interface (I) | |
1011 | |
1012 | |
1013 (defgroup printing nil | |
1014 "Printing Utilities group" | |
1015 :tag "Printing Utilities" | |
1016 :link '(emacs-library-link :tag "Source Lisp File" "printing.el") | |
1017 :prefix "pr-" | |
1018 :group 'wp | |
1019 :group 'postscript) | |
1020 | |
1021 | |
1022 (defcustom pr-path-style | |
1023 (if (and (not pr-cygwin-system) | |
1024 ps-windows-system) | |
1025 'windows | |
1026 'unix) | |
1027 "*Specify which path style to use for external commands. | |
1028 | |
1029 Valid values are: | |
1030 | |
1031 windows Windows 9x/NT style (\\) | |
1032 | |
1033 unix Unix style (/)" | |
1034 :type '(choice :tag "Path style" | |
1035 (const :tag "Windows 9x/NT Style (\\)" :value windows) | |
1036 (const :tag "Unix Style (/)" :value unix)) | |
1037 :group 'printing) | |
1038 | |
1039 | |
1040 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1041 ;; Internal Functions (I) | |
1042 | |
1043 | |
1044 (defun pr-dosify-path (path) | |
1045 "Replace unix-style directory separator character with dos/windows one." | |
1046 (interactive "sPath: ") | |
1047 (if (eq pr-path-style 'windows) | |
1048 (subst-char-in-string ?/ ?\\ path) | |
1049 path)) | |
1050 | |
1051 | |
1052 (defun pr-unixify-path (path) | |
1053 "Replace dos/windows-style directory separator character with unix one." | |
1054 (interactive "sPath: ") | |
1055 (if (eq pr-path-style 'windows) | |
1056 (subst-char-in-string ?\\ ?/ path) | |
1057 path)) | |
1058 | |
1059 | |
1060 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1061 ;; User Interface (II) | |
1062 | |
1063 | |
1064 (defcustom pr-path-alist | |
1065 '((unix PATH) | |
1066 (cygwin PATH) | |
1067 (windows PATH)) | |
1068 "*Specify an alist for command paths. | |
1069 | |
1070 It's used to find commands used for printing package, like gv, gs, gsview.exe, | |
1071 mpage, print.exe, etc. See also `pr-command' function. | |
1072 | |
1073 Each element has the form: | |
1074 | |
1075 (ENTRY DIRECTORY...) | |
1076 | |
1077 Where: | |
1078 | |
1079 ENTRY It's a symbol, used to identify this entry. | |
1080 There must exist at least one of the following entries: | |
1081 | |
1082 unix this entry is used when Emacs is running on GNU or | |
1083 Unix system. | |
1084 | |
1085 cygwin this entry is used when Emacs is running on Windows | |
1086 95/98/NT/2000 with Cygwin. | |
1087 | |
1088 windows this entry is used when Emacs is running on Windows | |
1089 95/98/NT/2000. | |
1090 | |
1091 DIRECTORY It should be a string or a symbol. If it's a symbol, it should | |
1092 exist an equal entry in `pr-path-alist'. If it's a string, | |
1093 it's considered a directory specification. | |
1094 | |
1095 The directory specification may contain: | |
1096 $var environment variable expansion | |
1097 ~/ tilde expansion | |
1098 ./ current directory | |
1099 ../ previous directory | |
1100 | |
1101 For example, let's say the home directory is /home/my and the | |
1102 current directory is /home/my/dir, so: | |
1103 | |
1104 THE ENTRY IS EXPANDED TO | |
1105 ~/entry /home/my/entry | |
1106 ./entry /home/my/dir/entry | |
1107 ../entry /home/my/entry | |
1108 $HOME/entry /home/my/entry | |
1109 $HOME/~/other/../my/entry /home/my/entry | |
1110 | |
1111 SPECIAL SYMBOL: If the symbol `PATH' is used in the directory | |
1112 list and there isn't a `PATH' entry in `pr-path-alist' or the | |
1113 `PATH' entry has a null directory list, the PATH environment | |
1114 variable is used. | |
1115 | |
1116 Examples: | |
1117 | |
1118 * On GNU or Unix system: | |
1119 | |
1120 '((unix \".\" \"~/bin\" ghostview mpage PATH) | |
1121 (ghostview \"$HOME/bin/gsview-dir\") | |
1122 (mpage \"$HOME/bin/mpage-dir\") | |
1123 ) | |
1124 | |
1125 * On Windows system: | |
1126 | |
1127 '((windows \"c:/applications/executables\" PATH ghostview mpage) | |
1128 (ghostview \"c:/gs/gsview-dir\") | |
1129 (mpage \"c:/mpage-dir\") | |
1130 )" | |
1131 :type '(repeat | |
1132 (cons :tag "" | |
1133 (symbol :tag "Identifier ") | |
1134 (repeat :tag "Directory List" | |
1135 (choice :menu-tag "Directory" | |
1136 :tag "Directory" | |
1137 (string :value "") | |
1138 (symbol :value symbol))))) | |
1139 :group 'printing) | |
1140 | |
1141 | |
1142 (defcustom pr-txt-name 'default | |
1143 "*Specify a printer for printing a text file. | |
1144 | |
1145 The printer name symbol should be defined on `pr-txt-printer-alist' (see it for | |
1146 documentation). | |
1147 | |
1148 This variable should be modified by customization engine. If this variable is | |
1149 modified by other means (for example, a lisp function), use `pr-update-menus' | |
1150 function (see it for documentation) to update text printer menu." | |
1151 :type 'symbol | |
1152 :set 'pr-txt-name-custom-set | |
1153 :group 'printing) | |
1154 | |
1155 | |
1156 (defcustom pr-txt-printer-alist | |
1157 (list (list 'default lpr-command nil | |
1158 (cond ((boundp 'printer-name) printer-name) | |
1159 (ps-windows-system "PRN") | |
1160 (t nil) | |
1161 ))) | |
1162 ;; Examples: | |
1163 ;; * On GNU or Unix system: | |
1164 ;; '((prt_06a "lpr" nil "prt_06a") | |
1165 ;; (prt_07c nil nil "prt_07c") | |
1166 ;; ) | |
1167 ;; * On Windows system: | |
1168 ;; '((prt_06a "print" nil "/D:\\\\printers\\prt_06a") | |
1169 ;; (prt_07c nil nil "/D:\\\\printers\\prt_07c") | |
1170 ;; (PRN "" nil "PRN") | |
1171 ;; (standard "redpr.exe" nil "") | |
1172 ;; ) | |
1173 "*Specify an alist of all text printers (text printer database). | |
1174 | |
1175 The alist element has the form: | |
1176 | |
1177 (SYMBOL COMMAND SWITCHES NAME) | |
1178 | |
1179 Where: | |
1180 | |
1181 SYMBOL It's a symbol to identify a text printer. It's for | |
1182 `pr-txt-name' variable setting and for menu selection. | |
1183 Examples: | |
1184 'prt_06a | |
1185 'my_printer | |
1186 | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1187 COMMAND Name of the program for printing a text file. On MS-DOS and |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1188 MS-Windows systems, if the value is an empty string, then Emacs |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1189 will write directly to the printer port given by NAME (see text |
49646 | 1190 below), that is, the NAME should be something like \"PRN\" or |
1191 \"LPT1:\". | |
1192 If NAME is something like \"\\\\\\\\host\\\\share-name\" then | |
1193 COMMAND shouldn't be an empty string. | |
1194 The programs `print' and `nprint' (the standard print programs | |
1195 on Windows NT and Novell Netware respectively) are handled | |
1196 specially, using NAME as the destination for output; any other | |
1197 program is treated like `lpr' except that an explicit filename | |
1198 is given as the last argument. | |
1199 If COMMAND is nil, it's used the default printing program: | |
1200 `print' for Windows system, `lp' for lp system and `lpr' for | |
1201 all other systems. See also `pr-path-alist'. | |
1202 Examples: | |
1203 \"print\" | |
1204 \"lpr\" | |
1205 \"lp\" | |
1206 | |
1207 SWITCHES List of sexp's to pass as extra options for text printer | |
1208 program. It is recommended to set NAME (see text below) | |
1209 instead of including an explicit switch on this list. | |
1210 Example: | |
1211 . for lpr | |
1212 '(\"-#3\" \"-l\") | |
1213 nil | |
1214 | |
1215 NAME A string that specifies a text printer name. | |
1216 On Unix-like systems, a string value should be a name | |
1217 understood by lpr's -P option (or lp's -d option). | |
1218 On MS-DOS and MS-Windows systems, it is the name of a printer | |
1219 device or port. Typical non-default settings would be \"LPT1:\" | |
1220 to \"LPT3:\" for parallel printers, or \"COM1\" to \"COM4\" or | |
1221 \"AUX\" for serial printers, or \"\\\\\\\\hostname\\\\printer\" | |
1222 (or \"/D:\\\\\\\\hostname\\\\printer\") for a shared network | |
1223 printer. You can also set it to a name of a file, in which | |
1224 case the output gets appended to that file. If you want to | |
1225 discard the printed output, set this to \"NUL\". | |
1226 Examples: | |
1227 . for print.exe | |
1228 \"/D:\\\\\\\\host\\\\share-name\" | |
1229 \"LPT1:\" | |
1230 \"PRN\" | |
1231 | |
1232 . for lpr or lp | |
1233 \"share-name\" | |
1234 | |
1235 This variable should be modified by customization engine. If this variable is | |
1236 modified by other means (for example, a lisp function), use `pr-update-menus' | |
1237 function (see it for documentation) to update text printer menu. | |
1238 | |
1239 Examples: | |
1240 | |
1241 * On GNU or Unix system: | |
1242 | |
1243 '((prt_06a \"lpr\" nil \"prt_06a\") | |
1244 (prt_07c nil nil \"prt_07c\") | |
1245 ) | |
1246 | |
1247 * On Windows system: | |
1248 | |
1249 '((prt_06a \"print\" nil \"/D:\\\\\\\\printers\\\\prt_06a\") | |
1250 (prt_07c nil nil \"/D:\\\\\\\\printers\\\\prt_07c\") | |
1251 (PRN \"\" nil \"PRN\") | |
1252 (standard \"redpr.exe\" nil \"\") | |
1253 )" | |
1254 :type '(repeat | |
1255 (list :tag "Text Printer" | |
1256 (symbol :tag "Printer Symbol Name") | |
1257 (string :tag "Printer Command") | |
1258 (repeat :tag "Printer Switches" | |
1259 (sexp :tag "Switch" :value "")) | |
1260 (choice :menu-tag "Printer Name" | |
1261 :tag "Printer Name" | |
1262 (const :tag "None" nil) | |
1263 string))) | |
1264 :set 'pr-alist-custom-set | |
1265 :group 'printing) | |
1266 | |
1267 | |
1268 (defcustom pr-ps-name 'default | |
1269 "*Specify a printer for printing a PostScript file. | |
1270 | |
1271 This printer name symbol should be defined on `pr-ps-printer-alist' (see it for | |
1272 documentation). | |
1273 | |
1274 This variable should be modified by customization engine. If this variable is | |
1275 modified by other means (for example, a lisp function), use `pr-update-menus' | |
1276 function (see it for documentation) to update PostScript printer menu." | |
1277 :type 'symbol | |
1278 :set 'pr-ps-name-custom-set | |
1279 :group 'printing) | |
1280 | |
1281 | |
1282 (defcustom pr-ps-printer-alist | |
1283 (list (list 'default lpr-command nil | |
1284 (cond (ps-windows-system nil) | |
1285 (ps-lp-system "-d") | |
1286 (t "-P")) | |
1287 (or (getenv "PRINTER") (getenv "LPDEST") ps-printer-name))) | |
1288 ;; Examples: | |
1289 ;; * On GNU or Unix system: | |
1290 ;; '((lps_06b "lpr" nil "-P" "lps_06b") | |
1291 ;; (lps_07c "lpr" nil nil "lps_07c") | |
1292 ;; (lps_08c nil nil nil "lps_08c") | |
1293 ;; ) | |
1294 ;; * On Windows system: | |
1295 ;; '((lps_06a "print" nil "/D:" "\\\\printers\\lps_06a") | |
1296 ;; (lps_06b "print" nil nil "\\\\printers\\lps_06b") | |
1297 ;; (lps_07c "print" nil "" "/D:\\\\printers\\lps_07c") | |
1298 ;; (lps_08c nil nil nil "\\\\printers\\lps_08c") | |
1299 ;; (LPT1 "" nil "" "LPT1:") | |
1300 ;; (PRN "" nil "" "PRN") | |
1301 ;; (standard "redpr.exe" nil "" "") | |
1302 ;; ) | |
1303 "*Specify an alist for all PostScript printers (PostScript printer database). | |
1304 | |
1305 The alist element has the form: | |
1306 | |
1307 (SYMBOL COMMAND SWITCHES PRINTER-SWITCH NAME DEFAULT...) | |
1308 | |
1309 Where: | |
1310 | |
1311 SYMBOL It's a symbol to identify a PostScript printer. It's for | |
1312 `pr-ps-name' variable setting and for menu selection. | |
1313 Examples: | |
1314 'prt_06a | |
1315 'my_printer | |
1316 | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1317 COMMAND Name of the program for printing a PostScript file. On MS-DOS |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1318 and MS-Windows systems, if the value is an empty string then |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1319 Emacs will write directly to the printer port given by NAME |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1320 (see text below), that is, the NAME should be something like |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1321 \"PRN\" or \"LPT1:\". |
49646 | 1322 If NAME is something like \"\\\\\\\\host\\\\share-name\" then |
1323 COMMAND shouldn't be an empty string. | |
1324 The programs `print' and `nprint' (the standard print programs | |
1325 on Windows NT and Novell Netware respectively) are handled | |
1326 specially, using NAME as the destination for output; any other | |
1327 program is treated like `lpr' except that an explicit filename | |
1328 is given as the last argument. | |
1329 If COMMAND is nil, it's used the default printing program: | |
1330 `print' for Windows system, `lp' for lp system and `lpr' for | |
1331 all other systems. See also `pr-path-alist'. | |
1332 Examples: | |
1333 \"print\" | |
1334 \"lpr\" | |
1335 \"lp\" | |
1336 \"cp\" | |
1337 | |
1338 SWITCHES List of sexp's to pass as extra options for PostScript printer | |
1339 program. It is recommended to set NAME (see text below) | |
1340 instead of including an explicit switch on this list. | |
1341 Example: | |
1342 . for lpr | |
1343 '(\"-#3\" \"-l\") | |
1344 nil | |
1345 | |
1346 PRINTER-SWITCH A string that specifies PostScript printer name switch. If | |
1347 it's necessary to have a space between PRINTER-SWITCH and NAME, | |
1348 it should be inserted at the end of PRINTER-SWITCH string. | |
1349 If PRINTER-SWITCH is nil, it's used the default printer name | |
1350 switch: `/D:' for Windows system, `-d' for lp system and `-P' | |
1351 for all other systems. | |
1352 Examples: | |
1353 . for lpr | |
1354 \"-P \" | |
1355 | |
1356 . for lp | |
1357 \"-d \" | |
1358 | |
1359 . for print.exe | |
1360 \"/D:\" | |
1361 | |
1362 NAME A string that specifies a PostScript printer name. | |
1363 On Unix-like systems, a string value should be a name | |
1364 understood by lpr's -P option (or lp's -d option). | |
1365 On MS-DOS and MS-Windows systems, it is the name of a printer | |
1366 device or port. Typical non-default settings would be \"LPT1:\" | |
1367 to \"LPT3:\" for parallel printers, or \"COM1\" to \"COM4\" or | |
1368 \"AUX\" for serial printers, or \"\\\\\\\\hostname\\\\printer\" | |
1369 (or \"/D:\\\\\\\\hostname\\\\printer\") for a shared network | |
1370 printer. You can also set it to a name of a file, in which | |
1371 case the output gets appended to that file. If you want to | |
1372 discard the printed output, set this to \"NUL\". | |
1373 Examples: | |
1374 . for cp.exe | |
1375 \"\\\\\\\\host\\\\share-name\" | |
1376 | |
1377 . for print.exe | |
1378 \"/D:\\\\\\\\host\\\\share-name\" | |
1379 \"\\\\\\\\host\\\\share-name\" | |
1380 \"LPT1:\" | |
1381 \"PRN\" | |
1382 | |
1383 . for lpr or lp | |
1384 \"share-name\" | |
1385 | |
1386 DEFAULT It's a way to set default values when this entry is selected. | |
1387 It's a cons like: | |
1388 | |
1389 (VARIABLE . VALUE) | |
1390 | |
1391 That associates VARIABLE with VALUE. when this entry is | |
1392 selected, it's executed the following command: | |
1393 | |
1394 (set VARIABLE (eval VALUE)) | |
1395 | |
1396 Note that VALUE can be any valid lisp expression. So, don't | |
1397 forget to quote symbols and constant lists. | |
1398 If VARIABLE is the special keyword `inherits-from:', VALUE must | |
1399 be a symbol name setting defined in `pr-setting-database' from | |
1400 which the current setting inherits the context. Take care with | |
1401 circular inheritance. | |
1402 Examples: | |
1403 '(ps-landscape-mode . nil) | |
1404 '(ps-spool-duplex . t) | |
1405 '(pr-gs-device . (my-gs-device t)) | |
1406 | |
1407 This variable should be modified by customization engine. If this variable is | |
1408 modified by other means (for example, a lisp function), use `pr-update-menus' | |
1409 function (see it for documentation) to update PostScript printer menu. | |
1410 | |
1411 Examples: | |
1412 | |
1413 * On GNU or Unix system: | |
1414 | |
1415 '((lps_06b \"lpr\" nil \"-P\" \"lps_06b\") | |
1416 (lps_07c \"lpr\" nil nil \"lps_07c\") | |
1417 (lps_08c nil nil nil \"lps_08c\") | |
1418 ) | |
1419 | |
1420 * On Windows system: | |
1421 | |
1422 '((lps_06a \"print\" nil \"/D:\" \"\\\\\\\\printers\\\\lps_06a\") | |
1423 (lps_06b \"print\" nil nil \"\\\\\\\\printers\\\\lps_06b\") | |
1424 (lps_07c \"print\" nil \"\" \"/D:\\\\\\\\printers\\\\lps_07c\") | |
1425 (lps_08c nil nil nil \"\\\\\\\\printers\\\\lps_08c\") | |
1426 (LPT1 \"\" nil \"\" \"LPT1:\") | |
1427 (PRN \"\" nil \"\" \"PRN\") | |
1428 (standard \"redpr.exe\" nil \"\" \"\") | |
1429 )" | |
1430 :type '(repeat | |
1431 (list | |
1432 :tag "PostScript Printer" | |
1433 (symbol :tag "Printer Symbol Name") | |
1434 (string :tag "Printer Command") | |
1435 (repeat :tag "Printer Switches" | |
1436 (sexp :tag "Switch" :value "")) | |
1437 (choice :menu-tag "Printer Name Switch" | |
1438 :tag "Printer Name Switch" | |
1439 (const :tag "None" nil) | |
1440 string) | |
1441 (choice :menu-tag "Printer Name" | |
1442 :tag "Printer Name" | |
1443 (const :tag "None" nil) | |
1444 string) | |
1445 (repeat | |
1446 :tag "Default Value List" | |
1447 :inline t | |
1448 (cons | |
1449 :tag "" | |
1450 (choice | |
1451 :menu-tag "Variable" | |
1452 :tag "Variable" | |
1453 (const :tag "Landscape" ps-landscape-mode) | |
1454 (const :tag "Print Header" ps-print-header) | |
1455 (const :tag "Print Header Frame" ps-print-header-frame) | |
1456 (const :tag "Line Number" ps-line-number) | |
1457 (const :tag "Zebra Stripes" ps-zebra-stripes) | |
1458 (const :tag "Duplex" ps-spool-duplex) | |
1459 (const :tag "Tumble" ps-spool-tumble) | |
1460 (const :tag "Upside-Down" ps-print-upside-down) | |
1461 (const :tag "PS File Landscape" pr-file-landscape) | |
1462 (const :tag "PS File Duplex" pr-file-duplex) | |
1463 (const :tag "PS File Tumble" pr-file-tumble) | |
1464 (const :tag "Auto Region" pr-auto-region) | |
1465 (const :tag "Auto Mode" pr-auto-mode) | |
1466 (const :tag "Ghostscript Device" pr-gs-device) | |
1467 (const :tag "Ghostscript Resolution" pr-gs-resolution) | |
1468 (const :tag "inherits-from:" inherits-from:) | |
1469 (variable :tag "Other")) | |
1470 (sexp :tag "Value"))) | |
1471 )) | |
1472 :set 'pr-alist-custom-set | |
1473 :group 'printing) | |
1474 | |
1475 | |
1476 (defcustom pr-temp-dir | |
1477 (pr-dosify-path | |
1478 (if (boundp 'temporary-file-directory) | |
1479 (symbol-value 'temporary-file-directory) | |
1480 ;; hacked from `temporary-file-directory' variable in files.el | |
1481 (file-name-as-directory | |
1482 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") | |
1483 (cond (ps-windows-system "c:/temp") | |
1484 ((memq system-type '(vax-vms axp-vms)) "SYS$SCRATCH:") | |
1485 (t "/tmp") | |
1486 ))))) | |
1487 "*Specify a directory for temporary files during printing." | |
1488 :type '(directory :tag "Temporary Directory") | |
1489 :group 'printing) | |
1490 | |
1491 | |
1492 (defcustom pr-ps-temp-file "prspool.ps" | |
1493 "*Specify PostScript temporary file name." | |
1494 :type '(file :tag "PostScript Temporary File Name") | |
1495 :group 'printing) | |
1496 | |
1497 | |
1498 (defcustom pr-gv-command | |
1499 (if ps-windows-system | |
1500 "gsview32.exe" | |
1501 "gv") | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1502 "*Specify path and name of the gsview/gv utility. |
49646 | 1503 |
1504 See also `pr-path-alist'." | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1505 :type '(string :tag "Ghostview Utility") |
49646 | 1506 :group 'printing) |
1507 | |
1508 | |
1509 (defcustom pr-gs-command | |
1510 (if ps-windows-system | |
1511 "gswin32.exe" | |
1512 "gs") | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1513 "*Specify path and name of the ghostscript utility. |
49646 | 1514 |
1515 See also `pr-path-alist'." | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1516 :type '(string :tag "Ghostscript Utility") |
49646 | 1517 :group 'printing) |
1518 | |
1519 | |
1520 (defcustom pr-gs-switches | |
1521 (if ps-windows-system | |
1522 '("-q -dNOPAUSE -Ic:/gs/gs5.50;c:/gs/gs5.50/fonts") | |
1523 '("-q -dNOPAUSE -I/usr/share/ghostscript/5.10")) | |
1524 "*Specify ghostscript switches. See the documentation on GS for more info. | |
1525 | |
1526 It's a list of strings, where each string is one or more ghostscript switches. | |
1527 | |
1528 A note on the gs switches: | |
1529 | |
1530 -q quiet | |
1531 -dNOPAUSE don't wait for user intervention | |
1532 -Ic:/gs/gs5.50;c:/gs/gs5.50/fonts the directories needed for gs | |
1533 -c quit it's added at the end to terminate gs | |
1534 | |
1535 To see ghostscript documentation for more information: | |
1536 | |
1537 * On GNU or Unix system: | |
1538 - for full documentation, type: man gs | |
1539 - for brief documentation, type: gs -h | |
1540 | |
1541 * On Windows system: | |
1542 - for full documentation, see in a browser the file | |
1543 c:/gstools/gs5.50/index.html, that is, the file index.html which is | |
1544 located in the same directory as gswin32.exe. | |
1545 - for brief documentation, type: gswin32.exe -h" | |
1546 :type '(repeat (string :tag "Ghostscript Switch")) | |
1547 :group 'printing) | |
1548 | |
1549 | |
1550 (defcustom pr-gs-device | |
1551 (if ps-windows-system | |
1552 "mswinpr2" | |
1553 "uniprint") | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1554 "*Specify the ghostscript device switch value (-sDEVICE=). |
49646 | 1555 |
1556 A note on the gs switches: | |
1557 | |
1558 -sDEVICE=djet500 the printer - works with HP DeskJet 540 | |
1559 | |
1560 See `pr-gs-switches' for documentation. | |
1561 See also `pr-ps-printer-alist'." | |
1562 :type '(string :tag "Ghostscript Device") | |
1563 :group 'printing) | |
1564 | |
1565 | |
1566 (defcustom pr-gs-resolution 300 | |
1567 "*Specify ghostscript resolution switch value (-r). | |
1568 | |
1569 A note on the gs switches: | |
1570 | |
1571 -r300 resolution 300x300 | |
1572 | |
1573 See `pr-gs-switches' for documentation. | |
1574 See also `pr-ps-printer-alist'." | |
1575 :type '(integer :tag "Ghostscript Resolution") | |
1576 :group 'printing) | |
1577 | |
1578 | |
1579 (defcustom pr-print-using-ghostscript nil | |
1580 "*Non-nil means print using ghostscript. | |
1581 | |
1582 This is useful if you don't have a PostScript printer, so you could use the | |
1583 ghostscript to print a PostScript file. | |
1584 | |
1585 In GNU or Unix system, if ghostscript is set as a PostScript filter, this | |
1586 variable should be nil." | |
1587 :type 'boolean | |
1588 :group 'printing) | |
1589 | |
1590 | |
1591 (defcustom pr-faces-p nil | |
1592 "*Non-nil means print with face attributes." | |
1593 :type 'boolean | |
1594 :group 'printing) | |
1595 | |
1596 | |
1597 (defcustom pr-spool-p nil | |
1598 "*Non-nil means spool printing in a buffer." | |
1599 :type 'boolean | |
1600 :group 'printing) | |
1601 | |
1602 | |
1603 (defcustom pr-file-landscape nil | |
1604 "*Non-nil means print PostScript file in landscape orientation." | |
1605 :type 'boolean | |
1606 :group 'printing) | |
1607 | |
1608 | |
1609 (defcustom pr-file-duplex nil | |
1610 "*Non-nil means print PostScript file in duplex mode." | |
1611 :type 'boolean | |
1612 :group 'printing) | |
1613 | |
1614 | |
1615 (defcustom pr-file-tumble nil | |
1616 "*Non-nil means print PostScript file in tumble mode. | |
1617 | |
1618 If tumble is off, produces a printing suitable for binding on the left or | |
1619 right. | |
1620 If tumble is on, produces a printing suitable for binding at the top or | |
1621 bottom." | |
1622 :type 'boolean | |
1623 :group 'printing) | |
1624 | |
1625 | |
1626 (defcustom pr-auto-region t | |
1627 "*Non-nil means region is automagically detected. | |
1628 | |
1629 Note that this will only work if you're using transient mark mode. | |
1630 | |
1631 When this variable is non-nil, the `*-buffer*' commands will behave like | |
1632 `*-region*' commands, that is, `*-buffer*' commands will print only the region | |
1633 marked instead of all buffer." | |
1634 :type 'boolean | |
1635 :group 'printing) | |
1636 | |
1637 | |
1638 (defcustom pr-auto-mode t | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1639 "*Non-nil means major-mode specific printing is prefered over normal printing. |
49646 | 1640 |
1641 That is, if current major-mode is declared in `pr-mode-alist', the `*-buffer*' | |
1642 and `*-region*' commands will behave like `*-mode*' commands; otherwise, | |
1643 `*-buffer*' commands will print the current buffer and `*-region*' commands | |
1644 will print the current region." | |
1645 :type 'boolean | |
1646 :group 'printing) | |
1647 | |
1648 | |
1649 (defcustom pr-mode-alist | |
1650 '((mh-folder-mode ; mh summary buffer | |
1651 pr-mh-lpr-1 pr-mh-print-1 | |
1652 2 | |
1653 (ps-article-author ps-article-subject) | |
1654 ("/pagenumberstring load" pr-article-date) | |
1655 nil | |
1656 ) | |
1657 (mh-letter-mode ; mh letter buffer | |
1658 pr-mh-lpr-2 pr-mh-print-2 | |
1659 2 | |
1660 (ps-article-author ps-article-subject) | |
1661 ("/pagenumberstring load" pr-article-date) | |
1662 nil | |
1663 ) | |
1664 (rmail-summary-mode ; rmail summary buffer | |
1665 pr-rmail-lpr pr-rmail-print | |
1666 3 | |
1667 (ps-article-subject ps-article-author buffer-name) | |
1668 nil | |
1669 nil | |
1670 ) | |
1671 (rmail-mode ; rmail buffer | |
1672 pr-rmail-lpr pr-rmail-print | |
1673 3 | |
1674 (ps-article-subject ps-article-author buffer-name) | |
1675 nil | |
1676 nil | |
1677 ) | |
1678 (gnus-summary-mode ; gnus summary buffer | |
1679 pr-gnus-lpr pr-gnus-print | |
1680 3 | |
1681 (ps-article-subject ps-article-author gnus-newsgroup-name) | |
1682 nil | |
1683 nil | |
1684 ) | |
1685 (gnus-article-mode ; gnus article buffer | |
1686 pr-gnus-lpr pr-gnus-print | |
1687 3 | |
1688 (ps-article-subject ps-article-author gnus-newsgroup-name) | |
1689 nil | |
1690 nil | |
1691 ) | |
1692 (Info-mode ; Info buffer | |
1693 pr-mode-lpr pr-mode-print | |
1694 2 | |
1695 (ps-info-node ps-info-file) | |
1696 nil | |
1697 nil | |
1698 ) | |
1699 (vm-mode ; vm mode | |
1700 pr-vm-lpr pr-vm-print | |
1701 3 | |
1702 (ps-article-subject ps-article-author buffer-name) | |
1703 nil | |
1704 nil | |
1705 ) | |
1706 ) | |
1707 "*Specify an alist for a major-mode and printing functions. | |
1708 | |
1709 To customize a major mode printing, just declare the customization in | |
1710 `pr-mode-alist' and invoke some of `*-mode*' commands. An example for major | |
1711 mode usage is when you're using gnus (or mh, or rmail, etc.) and you're in the | |
1712 *Summary* buffer, if you forget to switch to the *Article* buffer before | |
1713 printing, you'll get a nicely formatted list of article subjects shows up at | |
1714 the printer. With major mode printing you don't need to switch from gnus | |
1715 *Summary* buffer first. | |
1716 | |
1717 The elements have the following form: | |
1718 | |
1719 (MAJOR-MODE | |
1720 LPR-PRINT PS-PRINT | |
1721 HEADER-LINES | |
1722 LEFT-HEADER | |
1723 RIGHT-HEADER | |
1724 KILL-LOCAL-VARIABLE | |
1725 DEFAULT...) | |
1726 | |
1727 Where: | |
1728 | |
1729 MAJOR-MODE It's the major mode symbol. | |
1730 | |
1731 LPR-PRINT It's a symbol function for text printing. It's invoked with | |
1732 one argument: | |
1733 (HEADER-LINES LEFT-HEADER RIGHT-HEADER DEFAULT...). | |
1734 | |
1735 Usually LPR-PRINT function prepares the environment or buffer | |
1736 and then call the function `pr-mode-lpr' which it's used to | |
1737 process the buffer and send it to text printer. | |
1738 | |
1739 The `pr-mode-lpr' definition is: | |
1740 | |
1741 (pr-mode-lpr HEADER-LIST &optional FROM TO) | |
1742 | |
1743 Where HEADER-LIST is like the argument passed to LPR-PRINT. | |
1744 FROM and TO are the beginning and end markers, respectively, | |
1745 for a region. If FROM is nil, it's used (point-min); if TO is | |
1746 nil, it's used (point-max). | |
1747 | |
1748 PS-PRINT It's a symbol function for PostScript printing. It's invoked | |
1749 with 3 arguments: n-up printing, file name and the list: | |
1750 (HEADER-LINES LEFT-HEADER RIGHT-HEADER DEFAULT...). | |
1751 | |
1752 Usually PS-PRINT function prepares the environment or buffer | |
1753 and then call the function `pr-mode-print' which it's used to | |
1754 process the buffer and send it to PostScript printer. | |
1755 | |
1756 The `pr-mode-print' definition is: | |
1757 | |
1758 (pr-mode-print N-UP FILENAME HEADER-LIST &optional FROM TO) | |
1759 | |
1760 Where N-UP, FILENAME and HEADER-LIST are like the arguments | |
1761 passed to PS-PRINT. FROM and TO are the beginning and end | |
1762 markers, respectively, for a region. If TO is nil, it's used | |
1763 (point-max). | |
1764 | |
1765 HEADER-LINES It's the number of header lines; if is nil, it uses | |
1766 `ps-header-lines' value. | |
1767 | |
1768 LEFT-HEADER It's the left header part, it's a list of string, variable | |
1769 symbol or function symbol (with no argument); if is nil, it | |
1770 uses `ps-left-header' value. | |
1771 | |
1772 RIGHT-HEADER It's the right header part, it's a list of string, variable | |
1773 symbol or function symbol (with no argument); if is nil, it | |
1774 uses `ps-right-header' value. | |
1775 | |
1776 KILL-LOCAL-VARIABLE | |
1777 Non-nil means to kill all buffer local variable declared in | |
1778 DEFAULT (see below). | |
1779 | |
1780 DEFAULT It's a way to set default values when this entry is selected. | |
1781 It's a cons like: | |
1782 | |
1783 (VARIABLE-SYM . VALUE) | |
1784 | |
1785 That associates VARIABLE-SYM with VALUE. when this entry is | |
1786 selected, it's executed the following command: | |
1787 | |
1788 (set (make-local-variable VARIABLE-SYM) (eval VALUE)) | |
1789 | |
1790 Note that VALUE can be any valid lisp expression. So, don't | |
1791 forget to quote symbols and constant lists. | |
1792 If VARIABLE is the special keyword `inherits-from:', VALUE must | |
1793 be a symbol name setting defined in `pr-setting-database' from | |
1794 which the current setting inherits the context. Take care with | |
1795 circular inheritance. | |
1796 Examples: | |
1797 '(ps-landscape-mode . nil) | |
1798 '(ps-spool-duplex . t) | |
1799 '(pr-gs-device . (my-gs-device t))" | |
1800 :type '(repeat | |
1801 (list | |
1802 :tag "" | |
1803 (symbol :tag "Major Mode") | |
1804 (function :tag "Text Printing Function") | |
1805 (function :tag "PS Printing Function") | |
1806 (choice :menu-tag "Number of Header Lines" | |
1807 :tag "Number of Header Lines" | |
1808 (integer :tag "Number") | |
1809 (const :tag "Default Number" nil)) | |
1810 (repeat :tag "Left Header List" | |
1811 (choice :menu-tag "Left Header" | |
1812 :tag "Left Header" | |
1813 string symbol)) | |
1814 (repeat :tag "Right Header List" | |
1815 (choice :menu-tag "Right Header" | |
1816 :tag "Right Header" | |
1817 string symbol)) | |
1818 (boolean :tag "Kill Local Variable At End") | |
1819 (repeat | |
1820 :tag "Default Value List" | |
1821 :inline t | |
1822 (cons | |
1823 :tag "" | |
1824 (choice | |
1825 :menu-tag "Variable" | |
1826 :tag "Variable" | |
1827 (const :tag "Landscape" ps-landscape-mode) | |
1828 (const :tag "Print Header" ps-print-header) | |
1829 (const :tag "Print Header Frame" ps-print-header-frame) | |
1830 (const :tag "Line Number" ps-line-number) | |
1831 (const :tag "Zebra Stripes" ps-zebra-stripes) | |
1832 (const :tag "Duplex" ps-spool-duplex) | |
1833 (const :tag "Tumble" ps-spool-tumble) | |
1834 (const :tag "Upside-Down" ps-print-upside-down) | |
1835 (const :tag "PS File Landscape" pr-file-landscape) | |
1836 (const :tag "PS File Duplex" pr-file-duplex) | |
1837 (const :tag "PS File Tumble" pr-file-tumble) | |
1838 (const :tag "Auto Region" pr-auto-region) | |
1839 (const :tag "Auto Mode" pr-auto-mode) | |
1840 (const :tag "Ghostscript Device" pr-gs-device) | |
1841 (const :tag "Ghostscript Resolution" pr-gs-resolution) | |
1842 (const :tag "inherits-from:" inherits-from:) | |
1843 (variable :tag "Other")) | |
1844 (sexp :tag "Value"))) | |
1845 )) | |
1846 :group 'printing) | |
1847 | |
1848 | |
1849 (defcustom pr-ps-utility 'mpage | |
1850 "*Specify PostScript utility symbol. | |
1851 | |
1852 This utility symbol should be defined on `pr-ps-utility-alist' (see it for | |
1853 documentation). | |
1854 | |
1855 This variable should be modified by customization engine. If this variable is | |
1856 modified by other means (for example, a lisp function), use `pr-update-menus' | |
1857 function (see it for documentation) to update PostScript utility menu. | |
1858 | |
1859 NOTE: Don't forget to download and install the utilities declared on | |
1860 `pr-ps-utility-alist'." | |
1861 :type '(symbol :tag "PS File Utility") | |
1862 :set 'pr-ps-utility-custom-set | |
1863 :group 'printing) | |
1864 | |
1865 | |
1866 (defcustom pr-ps-utility-alist | |
1867 '((mpage "mpage" nil "-b%s" "-%d" "-l" "-t" "-T" ">" nil) | |
1868 (psnup "psnup" ("-q") "-P%s" "-%d" "-l" nil nil " " nil | |
1869 (inherits-from: . no-duplex)) | |
1870 ) | |
1871 ;; Examples: | |
1872 ;; * On GNU or Unix system: | |
1873 ;; '((mpage "mpage" nil "-b%s" "-%d" "-l" "-t" "-T" ">" nil) | |
1874 ;; (psnup "psnup" ("-q") "-P%s" "-%d" "-l" nil nil " " nil | |
1875 ;; (pr-file-duplex . nil) (pr-file-tumble . nil)) | |
1876 ;; ) | |
1877 ;; * On Windows system: | |
1878 ;; '((psnup "c:/psutils/psnup" ("-q") "-P%s" "-%d" "-l" nil nil " " nil | |
1879 ;; (pr-file-duplex . nil) (pr-file-tumble . nil)) | |
1880 ;; ) | |
1881 "*Specify an alist for PostScript utility processing (PS utility database). | |
1882 | |
1883 The alist element has the form: | |
1884 | |
1885 (SYMBOL UTILITY MUST-SWITCHES PAPERSIZE N-UP LANDSCAPE DUPLEX TUMBLE OUTPUT | |
1886 SWITCHES DEFAULT...) | |
1887 | |
1888 Where: | |
1889 | |
1890 SYMBOL It's a symbol to identify a PostScript utility. It's for | |
1891 `pr-ps-utility' variable setting and for menu selection. | |
1892 Examples: | |
1893 'mpage | |
1894 'psnup | |
1895 | |
1896 UTILITY Name of utility for processing a PostScript file. | |
1897 See also `pr-path-alist'. | |
1898 Examples: | |
1899 . for GNU or Unix system: | |
1900 \"mpage\" | |
1901 \"psnup -q\" | |
1902 | |
1903 . for Windows system: | |
1904 \"c:/psutils/psnup -q\" | |
1905 | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1906 MUST-SWITCHES List of sexp's to pass as options to the PostScript utility |
49646 | 1907 program. These options are necessary to process the utility |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1908 program and must be placed before any other switches. |
49646 | 1909 Example: |
1910 . for psnup: | |
1911 '(\"-q\") | |
1912 | |
1913 PAPERSIZE It's a format string to specify paper size switch. | |
1914 Example: | |
1915 . for mpage | |
1916 \"-b%s\" | |
1917 | |
1918 N-UP It's a format string to specify n-up switch. | |
1919 Example: | |
1920 . for psnup | |
1921 \"-%d\" | |
1922 | |
1923 LANDSCAPE It's a string to specify landscape switch. If the utility | |
1924 doesn't have landscape switch, set to nil. | |
1925 Example: | |
1926 . for psnup | |
1927 \"-l\" | |
1928 | |
1929 DUPLEX It's a string to specify duplex switch. If the utility doesn't | |
1930 have duplex switch, set to nil. | |
1931 Example: | |
1932 . for psnup | |
1933 nil | |
1934 | |
1935 TUMBLE It's a string to specify tumble switch. If the utility doesn't | |
1936 have tumble switch, set to nil. | |
1937 Example: | |
1938 . for psnup | |
1939 nil | |
1940 | |
1941 OUTPUT It's a string to specify how to generate an output file. Some | |
1942 utilities accept an output file option, but some others need | |
1943 output redirection or some other way to specify an output file. | |
1944 Example: | |
1945 . for psnup | |
1946 \" \" ; psnup ... input output | |
1947 | |
1948 . for mpage | |
1949 \">\" ; mpage ... input > output | |
1950 | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1951 SWITCHES List of sexp's to pass as extra options to the PostScript utility |
49646 | 1952 program. |
1953 Example: | |
1954 . for psnup | |
1955 '(\"-q\") | |
1956 nil | |
1957 | |
1958 DEFAULT It's a way to set default values when this entry is selected. | |
1959 It's a cons like: | |
1960 | |
1961 (VARIABLE . VALUE) | |
1962 | |
1963 That associates VARIABLE with VALUE. when this entry is | |
1964 selected, it's executed the following command: | |
1965 | |
1966 (set VARIABLE (eval VALUE)) | |
1967 | |
1968 Note that VALUE can be any valid lisp expression. So, don't | |
1969 forget to quote symbols and constant lists. | |
1970 If VARIABLE is the special keyword `inherits-from:', VALUE must | |
1971 be a symbol name setting defined in `pr-setting-database' from | |
1972 which the current setting inherits the context. Take care with | |
1973 circular inheritance. | |
1974 Examples: | |
1975 '(pr-file-landscape . nil) | |
1976 '(pr-file-duplex . t) | |
1977 '(pr-gs-device . (my-gs-device t)) | |
1978 | |
1979 This variable should be modified by customization engine. If this variable is | |
1980 modified by other means (for example, a lisp function), use `pr-update-menus' | |
1981 function (see it for documentation) to update PostScript utility menu. | |
1982 | |
1983 NOTE: Don't forget to download and install the utilities declared on | |
1984 `pr-ps-utility-alist'. | |
1985 | |
1986 Examples: | |
1987 | |
1988 * On GNU or Unix system: | |
1989 | |
1990 '((mpage \"mpage\" nil \"-b%s\" \"-%d\" \"-l\" \"-t\" \"-T\" \">\" nil) | |
1991 (psnup \"psnup\" (\"-q\") \"-P%s\" \"-%d\" \"-l\" nil nil \" \" nil | |
1992 (pr-file-duplex . nil) (pr-file-tumble . nil)) | |
1993 ) | |
1994 | |
1995 * On Windows system: | |
1996 | |
1997 '((psnup \"c:/psutils/psnup\" (\"-q\") \"-P%s\" \"-%d\" \"-l\" nil nil \" \" | |
1998 nil (pr-file-duplex . nil) (pr-file-tumble . nil)) | |
1999 )" | |
2000 :type '(repeat | |
2001 (list :tag "PS File Utility" | |
2002 (symbol :tag "Utility Symbol") | |
2003 (string :tag "Utility Name") | |
2004 (repeat :tag "Must Utility Switches" | |
2005 (sexp :tag "Switch" :value "")) | |
2006 (choice :menu-tag "Paper Size" | |
2007 :tag "Paper Size" | |
2008 (const :tag "No Paper Size" nil) | |
2009 (string :tag "Paper Size Format")) | |
2010 (choice :menu-tag "N-Up" | |
2011 :tag "N-Up" | |
2012 (const :tag "No N-Up" nil) | |
2013 (string :tag "N-Up Format")) | |
2014 (choice :menu-tag "Landscape" | |
2015 :tag "Landscape" | |
2016 (const :tag "No Landscape" nil) | |
2017 (string :tag "Landscape Switch")) | |
2018 (choice :menu-tag "Duplex" | |
2019 :tag "Duplex" | |
2020 (const :tag "No Duplex" nil) | |
2021 (string :tag "Duplex Switch")) | |
2022 (choice :menu-tag "Tumble" | |
2023 :tag "Tumble" | |
2024 (const :tag "No Tumble" nil) | |
2025 (string :tag "Tumble Switch")) | |
2026 (string :tag "Output Separator") | |
2027 (repeat :tag "Utility Switches" | |
2028 (sexp :tag "Switch" :value "")) | |
2029 (repeat | |
2030 :tag "Default Value List" | |
2031 :inline t | |
2032 (cons | |
2033 :tag "" | |
2034 (choice | |
2035 :menu-tag "Variable" | |
2036 :tag "Variable" | |
2037 (const :tag "PS File Landscape" pr-file-landscape) | |
2038 (const :tag "PS File Duplex" pr-file-duplex) | |
2039 (const :tag "PS File Tumble" pr-file-tumble) | |
2040 (const :tag "Ghostscript Device" pr-gs-device) | |
2041 (const :tag "Ghostscript Resolution" pr-gs-resolution) | |
2042 (const :tag "inherits-from:" inherits-from:) | |
2043 (variable :tag "Other")) | |
2044 (sexp :tag "Value"))) | |
2045 )) | |
2046 :set 'pr-alist-custom-set | |
2047 :group 'printing) | |
2048 | |
2049 | |
2050 (defcustom pr-menu-lock t | |
2051 "*Non-nil means menu is locked while selecting toggle options. | |
2052 | |
2053 See also `pr-menu-char-height' and `pr-menu-char-width'." | |
2054 :type 'boolean | |
2055 :group 'printing) | |
2056 | |
2057 | |
2058 (defcustom pr-menu-char-height | |
2059 (cond ((eq ps-print-emacs-type 'emacs) ; GNU Emacs | |
2060 (pr-e-frame-char-height)) | |
2061 ((eq ps-print-emacs-type 'xemacs) ; XEmacs | |
2062 (pr-x-font-height (face-font 'default)))) | |
2063 "*Specify menu char height in pixels. | |
2064 | |
2065 This variable is used to guess which vertical position should be locked the | |
2066 menu, so don't forget to adjust it if menu position is not ok. | |
2067 | |
2068 See also `pr-menu-lock' and `pr-menu-char-width'." | |
2069 :type 'integer | |
2070 :group 'printing) | |
2071 | |
2072 | |
2073 (defcustom pr-menu-char-width | |
2074 (cond ((eq ps-print-emacs-type 'emacs) ; GNU Emacs | |
2075 (pr-e-frame-char-width)) | |
2076 ((eq ps-print-emacs-type 'xemacs) ; XEmacs | |
2077 (pr-x-font-width (face-font 'default)))) | |
2078 "*Specify menu char width in pixels. | |
2079 | |
2080 This variable is used to guess which horizontal position should be locked the | |
2081 menu, so don't forget to adjust it if menu position is not ok. | |
2082 | |
2083 See also `pr-menu-lock' and `pr-menu-char-height'." | |
2084 :type 'integer | |
2085 :group 'printing) | |
2086 | |
2087 | |
2088 (defcustom pr-setting-database | |
2089 '((no-duplex ; setting symbol name | |
2090 nil nil nil ; inherits local kill-local | |
2091 (pr-file-duplex . nil) ; settings | |
2092 (pr-file-tumble . nil)) | |
2093 ) | |
2094 "*Specify an alist for settings in general. | |
2095 | |
2096 The elements have the following form: | |
2097 | |
2098 (SYMBOL INHERITS LOCAL KILL-LOCAL SETTING...) | |
2099 | |
2100 Where: | |
2101 | |
2102 SYMBOL It's a symbol to identify the setting group. | |
2103 | |
2104 INHERITS Specify the inheritance for SYMBOL group. It's a symbol name | |
2105 setting from which the current setting inherits the context. | |
2106 If INHERITS is nil, means that there is no inheritance. | |
2107 This is a simple inheritance mechanism. | |
2108 | |
2109 Let's see an example to illustrate the inheritance mechanism: | |
2110 | |
2111 (setq pr-setting-database | |
2112 '((no-duplex ; setting symbol name | |
2113 nil ; inherits | |
2114 nil nil ; local kill-local | |
2115 (pr-file-duplex . nil) ; settings | |
2116 (pr-file-tumble . nil) | |
2117 ) | |
2118 (no-duplex-and-landscape ; setting symbol name | |
2119 no-duplex ; inherits | |
2120 nil nil ; local kill-local | |
2121 (pr-file-landscape . nil) ; settings | |
2122 ))) | |
2123 | |
2124 The example above has two setting groups: no-duplex and | |
2125 no-duplex-and-landscape. When setting no-duplex is activated | |
2126 through `inherits-from:' (see `pr-ps-utility', `pr-mode-alist' | |
2127 and `pr-ps-printer-alist'), the variables pr-file-duplex and | |
2128 pr-file-tumble are both set to nil. | |
2129 | |
2130 Now when setting no-duplex-and-landscape is activated through | |
2131 `inherits-from:', the variable pr-file-landscape is set to nil | |
2132 and also the settings for no-duplex are done, because | |
2133 no-duplex-and-landscape inherits settings from no-duplex. | |
2134 | |
2135 Take care with circular inheritance. It's an error if circular | |
2136 inheritance happens. | |
2137 | |
2138 LOCAL Non-nil means that all settings for SYMBOL group will be | |
2139 declared local buffer. | |
2140 | |
2141 KILL-LOCAL Non-nil means that all settings for SYMBOL group will be | |
2142 killed at end. It has effect only when LOCAL is non-nil. | |
2143 | |
2144 SETTING It's a cons like: | |
2145 | |
2146 (VARIABLE . VALUE) | |
2147 | |
2148 That associates VARIABLE with VALUE. when this entry is | |
2149 selected, it's executed the following command: | |
2150 | |
2151 * If LOCAL is non-nil: | |
2152 (set (make-local-variable VARIABLE) (eval VALUE)) | |
2153 | |
2154 * If LOCAL is nil: | |
2155 (set VARIABLE (eval VALUE)) | |
2156 | |
2157 Note that VALUE can be any valid lisp expression. So, don't | |
2158 forget to quote symbols and constant lists. | |
2159 This setting is ignored if VARIABLE is equal to keyword | |
2160 `inherits-from:'. | |
2161 Examples: | |
2162 '(ps-landscape-mode . nil) | |
2163 '(ps-spool-duplex . t) | |
2164 '(pr-gs-device . (my-gs-device t))" | |
2165 :type '(repeat | |
2166 (list | |
2167 :tag "" | |
2168 (symbol :tag "Setting Name") | |
2169 (choice :menu-tag "Inheritance" | |
2170 :tag "Inheritance" | |
2171 (const :tag "No Inheritance" nil) | |
2172 (symbol :tag "Inherits From")) | |
2173 (boolean :tag "Local Buffer Setting") | |
2174 (boolean :tag "Kill Local Variable At End") | |
2175 (repeat | |
2176 :tag "Setting List" | |
2177 :inline t | |
2178 (cons | |
2179 :tag "" | |
2180 (choice | |
2181 :menu-tag "Variable" | |
2182 :tag "Variable" | |
2183 (const :tag "Landscape" ps-landscape-mode) | |
2184 (const :tag "Print Header" ps-print-header) | |
2185 (const :tag "Print Header Frame" ps-print-header-frame) | |
2186 (const :tag "Line Number" ps-line-number) | |
2187 (const :tag "Zebra Stripes" ps-zebra-stripes) | |
2188 (const :tag "Duplex" ps-spool-duplex) | |
2189 (const :tag "Tumble" ps-spool-tumble) | |
2190 (const :tag "Upside-Down" ps-print-upside-down) | |
2191 (const :tag "PS File Landscape" pr-file-landscape) | |
2192 (const :tag "PS File Duplex" pr-file-duplex) | |
2193 (const :tag "PS File Tumble" pr-file-tumble) | |
2194 (const :tag "Auto Region" pr-auto-region) | |
2195 (const :tag "Auto Mode" pr-auto-mode) | |
2196 (const :tag "Ghostscript Device" pr-gs-device) | |
2197 (const :tag "Ghostscript Resolution" pr-gs-resolution) | |
2198 (variable :tag "Other")) | |
2199 (sexp :tag "Value"))) | |
2200 )) | |
2201 :group 'printing) | |
2202 | |
2203 | |
2204 (defcustom pr-visible-entry-list | |
2205 '(postscript text postscript-options postscript-process printing help) | |
2206 "*Specify a list of Printing menu visible entries. | |
2207 | |
2208 Valid values with the corresponding menu parts are: | |
2209 | |
2210 +------------------------------+ | |
2211 | Printing Interface | | |
2212 +------------------------------+ | |
2213 `postscript' | PostScript Preview >| | |
2214 | PostScript Print >| | |
2215 | PostScript Printer: name >| | |
2216 +------------------------------+ | |
2217 `text' | Printify >| | |
2218 | Print >| | |
2219 | Text Printer: name >| | |
2220 +------------------------------+ | |
2221 `postscript-options' |[ ] Landscape | | |
2222 |[ ] Print Header | | |
2223 |[ ] Print Header Frame | | |
2224 |[ ] Line Number | | |
2225 |[ ] Zebra Stripes | | |
2226 |[ ] Duplex | | |
2227 |[ ] Tumble | | |
2228 |[ ] Upside-Down | | |
2229 | Print All Pages >| | |
2230 +------------------------------+ | |
2231 `postscript-process' |[ ] Spool Buffer | | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2232 |[ ] Print with faces | |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2233 |[ ] Print via Ghostscript | |
49646 | 2234 +------------------------------+ |
2235 `printing' |[ ] Auto Region | | |
2236 |[ ] Auto Mode | | |
2237 |[ ] Menu Lock | | |
2238 +------------------------------+ | |
2239 `help' | Customize >| | |
2240 | Show Settings >| | |
2241 | Help | | |
2242 +------------------------------+ | |
2243 | |
2244 Any other value is ignored." | |
2245 :type '(repeat :tag "Menu Visible Part" | |
2246 (choice :menu-tag "Menu Part" | |
2247 :tag "Menu Part" | |
2248 (const postscript) | |
2249 (const text) | |
2250 (const postscript-options) | |
2251 (const postscript-process) | |
2252 (const printing) | |
2253 (const help))) | |
2254 :group 'printing) | |
2255 | |
2256 | |
2257 (defcustom pr-delete-temp-file t | |
2258 "*Non-nil means delete temporary files. | |
2259 | |
2260 Set `pr-delete-temp-file' to nil, if the following message (or a similar) | |
2261 happens when printing: | |
2262 | |
2263 Error: could not open \"c:\\temp\\prspool.ps\" for reading." | |
2264 :type 'boolean | |
2265 :group 'printing) | |
2266 | |
2267 | |
2268 (defcustom pr-list-directory nil | |
2269 "*Non-nil means list directory when processing a directory. | |
2270 | |
2271 That is, any subdirectories (and the superdirectory) of the directory (given as | |
2272 argument of functions below) are also printed (as dired-mode listings). | |
2273 | |
2274 It's used by `pr-ps-directory-preview', `pr-ps-directory-using-ghostscript', | |
2275 `pr-ps-directory-print', `pr-ps-directory-ps-print', `pr-printify-directory' | |
2276 and `pr-txt-directory'." | |
2277 :type 'boolean | |
2278 :group 'printing) | |
2279 | |
2280 | |
2281 (defcustom pr-buffer-name "*Printing Interface*" | |
2282 "*Specify the name of the buffer interface for printing package. | |
2283 | |
2284 It's used by `pr-interface'." | |
2285 :type 'string | |
2286 :group 'printing) | |
2287 | |
2288 | |
2289 (defcustom pr-buffer-name-ignore | |
2290 (list (regexp-quote pr-buffer-name) ; ignore printing interface buffer | |
2291 "^ .*$") ; ignore invisible buffers | |
2292 "*Specify a regexp list for buffer names to be ignored in interface buffer. | |
2293 | |
2294 NOTE: Case is important for matching, that is, `case-fold-search' is always | |
2295 nil. | |
2296 | |
2297 It's used by `pr-interface'." | |
2298 :type '(repeat (regexp :tag "Buffer Name Regexp")) | |
2299 :group 'printing) | |
2300 | |
2301 | |
2302 (defcustom pr-buffer-verbose t | |
2303 "*Non-nil means to be verbose when editing a field in interface buffer. | |
2304 | |
2305 It's used by `pr-interface'." | |
2306 :type 'boolean | |
2307 :group 'printing) | |
2308 | |
2309 | |
2310 (defcustom pr-shell-file-name | |
54675
32aae36e32af
Var initialization fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54636
diff
changeset
|
2311 (if (and (not pr-cygwin-system) |
32aae36e32af
Var initialization fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54636
diff
changeset
|
2312 ps-windows-system) |
49646 | 2313 "cmdproxy.exe" |
2314 shell-file-name) | |
2315 "*Specify file name to load inferior shells from." | |
2316 :type 'string | |
2317 :group 'printing) | |
2318 | |
2319 | |
2320 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
2321 ;; Internal Variables | |
2322 | |
2323 | |
2324 (defvar pr-txt-command nil | |
2325 "Name of program for printing a text file. | |
2326 See `pr-txt-printer-alist'.") | |
2327 | |
2328 | |
2329 (defvar pr-txt-switches nil | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2330 "List of sexp's to pass as extra options to the text printer program. |
49646 | 2331 See `pr-txt-printer-alist'.") |
2332 | |
2333 | |
2334 (defvar pr-txt-printer nil | |
2335 "Specify text printer name. | |
2336 See `pr-txt-printer-alist'.") | |
2337 | |
2338 | |
2339 (defvar pr-ps-command nil | |
2340 "Name of program for printing a PostScript file. | |
2341 See `pr-ps-printer-alist'.") | |
2342 | |
2343 | |
2344 (defvar pr-ps-switches nil | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2345 "List of sexp's to pass as extra options to the PostScript printer program. |
49646 | 2346 See `pr-ps-printer-alist'.") |
2347 | |
2348 | |
2349 (defvar pr-ps-printer-switch nil | |
2350 "Specify PostScript printer name switch. | |
2351 See `pr-ps-printer-alist'.") | |
2352 | |
2353 | |
2354 (defvar pr-ps-printer nil | |
2355 "Specify PostScript printer name. | |
2356 See `pr-ps-printer-alist'.") | |
2357 | |
2358 | |
2359 (defvar pr-menu-bar nil | |
2360 "Specify Printing menu-bar entry.") | |
2361 | |
2362 | |
2363 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
2364 ;; Keys & Menus | |
2365 | |
2366 | |
2367 (defmacro pr-xemacs-global-menubar (&rest body) | |
2368 `(save-excursion | |
2369 (let ((temp (get-buffer-create (make-temp-name " *Temp")))) | |
2370 ;; be sure to access global menubar | |
2371 (set-buffer temp) | |
2372 ,@body | |
2373 (kill-buffer temp)))) | |
2374 | |
2375 | |
2376 (defsubst pr-visible-p (key) | |
2377 (memq key pr-visible-entry-list)) | |
2378 | |
2379 | |
2380 (defsubst pr-mode-alist-p () | |
2381 (cdr (assq major-mode pr-mode-alist))) | |
2382 | |
2383 | |
2384 (defsubst pr-auto-mode-p () | |
2385 (and pr-auto-mode (pr-mode-alist-p))) | |
2386 | |
2387 | |
2388 (defsubst pr-using-ghostscript-p () | |
2389 (and pr-print-using-ghostscript (not pr-spool-p))) | |
2390 | |
2391 | |
2392 (eval-and-compile | |
50017
0ee18dc00572
vinicius: copyright date fix. Move pr-get-symbol into eval-and-compile.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49649
diff
changeset
|
2393 (defun pr-get-symbol (name) |
0ee18dc00572
vinicius: copyright date fix. Move pr-get-symbol into eval-and-compile.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49649
diff
changeset
|
2394 ;; Recent versions of easy-menu downcase names before interning them. |
0ee18dc00572
vinicius: copyright date fix. Move pr-get-symbol into eval-and-compile.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49649
diff
changeset
|
2395 (and (fboundp 'easy-menu-name-match) |
0ee18dc00572
vinicius: copyright date fix. Move pr-get-symbol into eval-and-compile.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49649
diff
changeset
|
2396 (setq name (downcase name))) |
0ee18dc00572
vinicius: copyright date fix. Move pr-get-symbol into eval-and-compile.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49649
diff
changeset
|
2397 (or (intern-soft name) |
0ee18dc00572
vinicius: copyright date fix. Move pr-get-symbol into eval-and-compile.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49649
diff
changeset
|
2398 (make-symbol name))) |
0ee18dc00572
vinicius: copyright date fix. Move pr-get-symbol into eval-and-compile.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49649
diff
changeset
|
2399 |
49646 | 2400 (cond |
2401 ((eq ps-print-emacs-type 'emacs) ; GNU Emacs | |
2402 (defsubst pr-region-active-p () | |
2403 (and pr-auto-region transient-mark-mode mark-active))) | |
2404 | |
2405 ((eq ps-print-emacs-type 'xemacs) ; XEmacs | |
2406 (defsubst pr-region-active-p () | |
2407 (and pr-auto-region (not zmacs-region-stays) (ps-mark-active-p))))) | |
2408 | |
2409 | |
2410 (defconst pr-menu-spec | |
2411 (cond | |
2412 ((eq ps-print-emacs-type 'emacs) ; GNU Emacs | |
2413 '( | |
2414 ["Printing Interface" pr-interface | |
2415 :help "Use buffer interface instead of menu interface"] | |
2416 "--" | |
2417 ("PostScript Preview" :visible (pr-visible-p 'postscript) | |
2418 :help "Preview PostScript instead of sending to printer" | |
2419 ("Directory" :active (not pr-spool-p) | |
2420 ["1-up" (pr-ps-directory-preview 1 nil nil t) t] | |
2421 ["2-up" (pr-ps-directory-preview 2 nil nil t) t] | |
2422 ["4-up" (pr-ps-directory-preview 4 nil nil t) t] | |
2423 ["Other..." (pr-ps-directory-preview nil nil nil t) | |
2424 :keys "\\[pr-ps-buffer-preview]"]) | |
2425 ("Buffer" :active (not pr-spool-p) | |
2426 ["1-up" (pr-ps-buffer-preview 1 t) t] | |
2427 ["2-up" (pr-ps-buffer-preview 2 t) t] | |
2428 ["4-up" (pr-ps-buffer-preview 4 t) t] | |
2429 ["Other..." (pr-ps-buffer-preview nil t) | |
2430 :keys "\\[pr-ps-buffer-preview]"]) | |
2431 ("Region" :active (and (not pr-spool-p) (ps-mark-active-p)) | |
2432 ["1-up" (pr-ps-region-preview 1 t) t] | |
2433 ["2-up" (pr-ps-region-preview 2 t) t] | |
2434 ["4-up" (pr-ps-region-preview 4 t) t] | |
2435 ["Other..." (pr-ps-region-preview nil t) | |
2436 :keys "\\[pr-ps-region-preview]"]) | |
2437 ("Mode" :active (and (not pr-spool-p) (pr-mode-alist-p)) | |
2438 ["1-up" (pr-ps-mode-preview 1 t) t] | |
2439 ["2-up" (pr-ps-mode-preview 2 t) t] | |
2440 ["4-up" (pr-ps-mode-preview 4 t) t] | |
2441 ["Other..." (pr-ps-mode-preview nil t) | |
2442 :keys "\\[pr-ps-mode-preview]"]) | |
2443 ("File" | |
54210
602769168263
Replace "As Is..." in PostScript file print/preview by "No Preprocessing...".
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54209
diff
changeset
|
2444 ["No Preprocessing..." (call-interactively 'pr-ps-file-preview) |
49646 | 2445 :keys "\\[pr-ps-file-preview]" |
2446 :help "Preview PostScript file"] | |
2447 "--" | |
2448 ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist | |
2449 :help "Select PostScript utility"] | |
2450 "--" | |
2451 ["1-up..." (pr-ps-file-up-preview 1 t t) pr-ps-utility-alist] | |
2452 ["2-up..." (pr-ps-file-up-preview 2 t t) pr-ps-utility-alist] | |
2453 ["4-up..." (pr-ps-file-up-preview 4 t t) pr-ps-utility-alist] | |
2454 ["Other..." (pr-ps-file-up-preview nil t t) | |
2455 :keys "\\[pr-ps-file-up-preview]" :active pr-ps-utility-alist] | |
2456 "--" | |
2457 ["Landscape" pr-toggle-file-landscape | |
2458 :style toggle :selected pr-file-landscape | |
2459 :help "Toggle landscape for PostScript file" | |
2460 :active pr-ps-utility-alist] | |
2461 ["Duplex" pr-toggle-file-duplex | |
2462 :style toggle :selected pr-file-duplex | |
2463 :help "Toggle duplex for PostScript file" | |
2464 :active pr-ps-utility-alist] | |
2465 ["Tumble" pr-toggle-file-tumble | |
2466 :style toggle :selected pr-file-tumble | |
2467 :help "Toggle tumble for PostScript file" | |
2468 :active (and pr-file-duplex pr-ps-utility-alist)]) | |
2469 ["Despool..." (call-interactively 'pr-despool-preview) | |
2470 :active pr-spool-p :keys "\\[pr-despool-preview]" | |
2471 :help "Despool PostScript buffer to printer or file (C-u)"]) | |
2472 ("PostScript Print" :visible (pr-visible-p 'postscript) | |
2473 :help "Send PostScript to printer or file (C-u)" | |
2474 ("Directory" | |
2475 ["1-up" (pr-ps-directory-ps-print 1 nil nil t) t] | |
2476 ["2-up" (pr-ps-directory-ps-print 2 nil nil t) t] | |
2477 ["4-up" (pr-ps-directory-ps-print 4 nil nil t) t] | |
2478 ["Other..." (pr-ps-directory-ps-print nil nil nil t) | |
2479 :keys "\\[pr-ps-buffer-ps-print]"]) | |
2480 ("Buffer" | |
2481 ["1-up" (pr-ps-buffer-ps-print 1 t) t] | |
2482 ["2-up" (pr-ps-buffer-ps-print 2 t) t] | |
2483 ["4-up" (pr-ps-buffer-ps-print 4 t) t] | |
2484 ["Other..." (pr-ps-buffer-ps-print nil t) | |
2485 :keys "\\[pr-ps-buffer-ps-print]"]) | |
2486 ("Region" :active (ps-mark-active-p) | |
2487 ["1-up" (pr-ps-region-ps-print 1 t) t] | |
2488 ["2-up" (pr-ps-region-ps-print 2 t) t] | |
2489 ["4-up" (pr-ps-region-ps-print 4 t) t] | |
2490 ["Other..." (pr-ps-region-ps-print nil t) | |
2491 :keys "\\[pr-ps-region-ps-print]"]) | |
2492 ("Mode" :active (pr-mode-alist-p) | |
2493 ["1-up" (pr-ps-mode-ps-print 1 t) t] | |
2494 ["2-up" (pr-ps-mode-ps-print 2 t) t] | |
2495 ["4-up" (pr-ps-mode-ps-print 4 t) t] | |
2496 ["Other..." (pr-ps-mode-ps-print nil t) | |
2497 :keys "\\[pr-ps-mode-ps-print]"]) | |
2498 ("File" | |
54210
602769168263
Replace "As Is..." in PostScript file print/preview by "No Preprocessing...".
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54209
diff
changeset
|
2499 ["No Preprocessing..." (call-interactively 'pr-ps-file-ps-print) |
49646 | 2500 :keys "\\[pr-ps-file-ps-print]" |
2501 :help "Send PostScript file to printer"] | |
2502 "--" | |
2503 ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist | |
2504 :help "Select PostScript utility"] | |
2505 "--" | |
2506 ["1-up..." (pr-ps-file-up-ps-print 1 t t) pr-ps-utility-alist] | |
2507 ["2-up..." (pr-ps-file-up-ps-print 2 t t) pr-ps-utility-alist] | |
2508 ["4-up..." (pr-ps-file-up-ps-print 4 t t) pr-ps-utility-alist] | |
2509 ["Other..." (pr-ps-file-up-ps-print nil t t) | |
2510 :keys "\\[pr-ps-file-up-ps-print]" :active pr-ps-utility-alist] | |
2511 "--" | |
2512 ["Landscape" pr-toggle-file-landscape | |
2513 :style toggle :selected pr-file-landscape | |
2514 :help "Toggle landscape for PostScript file" | |
2515 :active pr-ps-utility-alist] | |
2516 ["Duplex" pr-toggle-file-duplex | |
2517 :style toggle :selected pr-file-duplex | |
2518 :help "Toggle duplex for PostScript file" | |
2519 :active pr-ps-utility-alist] | |
2520 ["Tumble" pr-toggle-file-tumble | |
2521 :style toggle :selected pr-file-tumble | |
2522 :help "Toggle tumble for PostScript file" | |
2523 :active (and pr-file-duplex pr-ps-utility-alist)]) | |
2524 ["Despool..." (call-interactively 'pr-despool-ps-print) | |
2525 :active pr-spool-p :keys "\\[pr-despool-ps-print]" | |
2526 :help "Despool PostScript buffer to printer or file (C-u)"]) | |
2527 ["PostScript Printers" pr-update-menus | |
2528 :active pr-ps-printer-alist :included (pr-visible-p 'postscript) | |
2529 :help "Select PostScript printer"] | |
2530 "--" | |
2531 ("Printify" :visible (pr-visible-p 'text) | |
2532 :help "Replace non-printing chars with printable representations." | |
2533 ["Directory" pr-printify-directory t] | |
2534 ["Buffer" pr-printify-buffer t] | |
2535 ["Region" pr-printify-region (ps-mark-active-p)]) | |
2536 ("Print" :visible (pr-visible-p 'text) | |
2537 :help "Send text to printer" | |
2538 ["Directory" pr-txt-directory t] | |
2539 ["Buffer" pr-txt-buffer t] | |
2540 ["Region" pr-txt-region (ps-mark-active-p)] | |
2541 ["Mode" pr-txt-mode (pr-mode-alist-p)]) | |
2542 ["Text Printers" pr-update-menus | |
2543 :active pr-txt-printer-alist :included (pr-visible-p 'text) | |
2544 :help "Select text printer"] | |
2545 "--" | |
2546 ["Landscape" pr-toggle-landscape | |
2547 :style toggle :selected ps-landscape-mode | |
2548 :included (pr-visible-p 'postscript-options)] | |
2549 ["Print Header" pr-toggle-header | |
2550 :style toggle :selected ps-print-header | |
2551 :included (pr-visible-p 'postscript-options)] | |
2552 ["Print Header Frame" pr-toggle-header-frame | |
2553 :style toggle :selected ps-print-header-frame :active ps-print-header | |
2554 :included (pr-visible-p 'postscript-options)] | |
2555 ["Line Number" pr-toggle-line | |
2556 :style toggle :selected ps-line-number | |
2557 :included (pr-visible-p 'postscript-options)] | |
2558 ["Zebra Stripes" pr-toggle-zebra | |
2559 :style toggle :selected ps-zebra-stripes | |
2560 :included (pr-visible-p 'postscript-options)] | |
2561 ["Duplex" pr-toggle-duplex | |
2562 :style toggle :selected ps-spool-duplex | |
2563 :included (pr-visible-p 'postscript-options)] | |
2564 ["Tumble" pr-toggle-tumble | |
2565 :style toggle :selected ps-spool-tumble :active ps-spool-duplex | |
2566 :included (pr-visible-p 'postscript-options)] | |
2567 ["Upside-Down" pr-toggle-upside-down | |
2568 :style toggle :selected ps-print-upside-down | |
2569 :included (pr-visible-p 'postscript-options)] | |
2570 ("Print All Pages" :visible (pr-visible-p 'postscript-options) | |
2571 :help "Select odd/even pages/sheets to print" | |
2572 ["All Pages" (pr-even-or-odd-pages nil) | |
2573 :style radio :selected (eq ps-even-or-odd-pages nil)] | |
2574 ["Even Pages" (pr-even-or-odd-pages 'even-page) | |
2575 :style radio :selected (eq ps-even-or-odd-pages 'even-page)] | |
2576 ["Odd Pages" (pr-even-or-odd-pages 'odd-page) | |
2577 :style radio :selected (eq ps-even-or-odd-pages 'odd-page)] | |
2578 ["Even Sheets" (pr-even-or-odd-pages 'even-sheet) | |
2579 :style radio :selected (eq ps-even-or-odd-pages 'even-sheet)] | |
2580 ["Odd Sheets" (pr-even-or-odd-pages 'odd-sheet) | |
2581 :style radio :selected (eq ps-even-or-odd-pages 'odd-sheet)]) | |
2582 "--" | |
2583 ["Spool Buffer" pr-toggle-spool | |
2584 :style toggle :selected pr-spool-p | |
2585 :included (pr-visible-p 'postscript-process) | |
2586 :help "Toggle PostScript spooling"] | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2587 ["Print with faces" pr-toggle-faces |
49646 | 2588 :style toggle :selected pr-faces-p |
2589 :included (pr-visible-p 'postscript-process) | |
2590 :help "Toggle PostScript printing with faces"] | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2591 ["Print via Ghostscript" pr-toggle-ghostscript |
49646 | 2592 :style toggle :selected pr-print-using-ghostscript |
2593 :included (pr-visible-p 'postscript-process) | |
2594 :help "Toggle PostScript generation using ghostscript"] | |
2595 "--" | |
2596 ["Auto Region" pr-toggle-region | |
2597 :style toggle :selected pr-auto-region | |
2598 :included (pr-visible-p 'printing)] | |
2599 ["Auto Mode" pr-toggle-mode | |
2600 :style toggle :selected pr-auto-mode | |
2601 :included (pr-visible-p 'printing)] | |
2602 ["Menu Lock" pr-toggle-lock | |
2603 :style toggle :selected pr-menu-lock | |
2604 :included (pr-visible-p 'printing)] | |
2605 "--" | |
2606 ("Customize" :visible (pr-visible-p 'help) | |
2607 ["printing" pr-customize t] | |
2608 ["ps-print" ps-print-customize t] | |
2609 ["lpr" lpr-customize t]) | |
2610 ("Show Settings" :visible (pr-visible-p 'help) | |
2611 ["printing" pr-show-pr-setup t] | |
2612 ["ps-print" pr-show-ps-setup t] | |
2613 ["lpr" pr-show-lpr-setup t]) | |
2614 ["Help" pr-help :active t :included (pr-visible-p 'help)] | |
2615 )) | |
2616 | |
2617 | |
2618 ((eq ps-print-emacs-type 'xemacs) ; XEmacs | |
2619 ;; Menu mapping: | |
2620 ;; unfortunately XEmacs doesn't support :active or :visible | |
2621 ;; for submenus, only for items. | |
2622 ;; It uses :included instead of :active or :visible. | |
2623 ;; Also, XEmacs doesn't support :help tag. | |
2624 '( | |
2625 ["Printing Interface" pr-interface] | |
2626 "--" | |
2627 ("PostScript Preview" :included (pr-visible-p 'postscript) | |
2628 ("Directory" :included (not pr-spool-p) | |
2629 ["1-up" (pr-ps-directory-preview 1 nil nil t) t] | |
2630 ["2-up" (pr-ps-directory-preview 2 nil nil t) t] | |
2631 ["4-up" (pr-ps-directory-preview 4 nil nil t) t] | |
2632 ["Other..." (pr-ps-directory-preview nil nil nil t) | |
2633 :keys "\\[pr-ps-buffer-preview]"]) | |
2634 ("Buffer" :included (not pr-spool-p) | |
2635 ["1-up" (pr-ps-buffer-preview 1 t) t] | |
2636 ["2-up" (pr-ps-buffer-preview 2 t) t] | |
2637 ["4-up" (pr-ps-buffer-preview 4 t) t] | |
2638 ["Other..." (pr-ps-buffer-preview nil t) | |
2639 :keys "\\[pr-ps-buffer-preview]"]) | |
2640 ("Region" :included (and (not pr-spool-p) (ps-mark-active-p)) | |
2641 ["1-up" (pr-ps-region-preview 1 t) t] | |
2642 ["2-up" (pr-ps-region-preview 2 t) t] | |
2643 ["4-up" (pr-ps-region-preview 4 t) t] | |
2644 ["Other..." (pr-ps-region-preview nil t) | |
2645 :keys "\\[pr-ps-region-preview]"]) | |
2646 ("Mode" :included (and (not pr-spool-p) (pr-mode-alist-p)) | |
2647 ["1-up" (pr-ps-mode-preview 1 t) t] | |
2648 ["2-up" (pr-ps-mode-preview 2 t) t] | |
2649 ["4-up" (pr-ps-mode-preview 4 t) t] | |
2650 ["Other..." (pr-ps-mode-preview nil t) | |
2651 :keys "\\[pr-ps-mode-preview]"]) | |
2652 ("File" | |
54210
602769168263
Replace "As Is..." in PostScript file print/preview by "No Preprocessing...".
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54209
diff
changeset
|
2653 ["No Preprocessing..." (call-interactively 'pr-ps-file-preview) |
49646 | 2654 :keys "\\[pr-ps-file-preview]"] |
2655 "--" | |
2656 ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist] | |
2657 "--" | |
2658 ["1-up..." (pr-ps-file-up-preview 1 t t) pr-ps-utility-alist] | |
2659 ["2-up..." (pr-ps-file-up-preview 2 t t) pr-ps-utility-alist] | |
2660 ["4-up..." (pr-ps-file-up-preview 4 t t) pr-ps-utility-alist] | |
2661 ["Other..." (pr-ps-file-up-preview nil t t) | |
2662 :keys "\\[pr-ps-file-up-preview]" :active pr-ps-utility-alist] | |
2663 "--" | |
2664 ["Landscape" pr-toggle-file-landscape | |
2665 :style toggle :selected pr-file-landscape | |
2666 :active pr-ps-utility-alist] | |
2667 ["Duplex" pr-toggle-file-duplex | |
2668 :style toggle :selected pr-file-duplex | |
2669 :active pr-ps-utility-alist] | |
2670 ["Tumble" pr-toggle-file-tumble | |
2671 :style toggle :selected pr-file-tumble | |
2672 :active (and pr-file-duplex pr-ps-utility-alist)]) | |
2673 ["Despool..." (call-interactively 'pr-despool-preview) | |
2674 :active pr-spool-p :keys "\\[pr-despool-preview]"]) | |
2675 ("PostScript Print" :included (pr-visible-p 'postscript) | |
2676 ("Directory" | |
2677 ["1-up" (pr-ps-directory-ps-print 1 nil nil t) t] | |
2678 ["2-up" (pr-ps-directory-ps-print 2 nil nil t) t] | |
2679 ["4-up" (pr-ps-directory-ps-print 4 nil nil t) t] | |
2680 ["Other..." (pr-ps-directory-ps-print nil nil nil t) | |
2681 :keys "\\[pr-ps-buffer-ps-print]"]) | |
2682 ("Buffer" | |
2683 ["1-up" (pr-ps-buffer-ps-print 1 t) t] | |
2684 ["2-up" (pr-ps-buffer-ps-print 2 t) t] | |
2685 ["4-up" (pr-ps-buffer-ps-print 4 t) t] | |
2686 ["Other..." (pr-ps-buffer-ps-print nil t) | |
2687 :keys "\\[pr-ps-buffer-ps-print]"]) | |
2688 ("Region" :included (ps-mark-active-p) | |
2689 ["1-up" (pr-ps-region-ps-print 1 t) t] | |
2690 ["2-up" (pr-ps-region-ps-print 2 t) t] | |
2691 ["4-up" (pr-ps-region-ps-print 4 t) t] | |
2692 ["Other..." (pr-ps-region-ps-print nil t) | |
2693 :keys "\\[pr-ps-region-ps-print]"]) | |
2694 ("Mode" :included (pr-mode-alist-p) | |
2695 ["1-up" (pr-ps-mode-ps-print 1 t) t] | |
2696 ["2-up" (pr-ps-mode-ps-print 2 t) t] | |
2697 ["4-up" (pr-ps-mode-ps-print 4 t) t] | |
2698 ["Other..." (pr-ps-mode-ps-print nil t) | |
2699 :keys "\\[pr-ps-mode-ps-print]"]) | |
2700 ("File" | |
54210
602769168263
Replace "As Is..." in PostScript file print/preview by "No Preprocessing...".
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54209
diff
changeset
|
2701 ["No Preprocessing..." (call-interactively 'pr-ps-file-ps-print) |
49646 | 2702 :keys "\\[pr-ps-file-ps-print]"] |
2703 "--" | |
2704 ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist] | |
2705 "--" | |
2706 ["1-up..." (pr-ps-file-up-ps-print 1 t t) pr-ps-utility-alist] | |
2707 ["2-up..." (pr-ps-file-up-ps-print 2 t t) pr-ps-utility-alist] | |
2708 ["4-up..." (pr-ps-file-up-ps-print 4 t t) pr-ps-utility-alist] | |
2709 ["Other..." (pr-ps-file-up-ps-print nil t t) | |
2710 :keys "\\[pr-ps-file-up-ps-print]" :active pr-ps-utility-alist] | |
2711 "--" | |
2712 ["Landscape" pr-toggle-file-landscape | |
2713 :style toggle :selected pr-file-landscape | |
2714 :active pr-ps-utility-alist] | |
2715 ["Duplex" pr-toggle-file-duplex | |
2716 :style toggle :selected pr-file-duplex | |
2717 :active pr-ps-utility-alist] | |
2718 ["Tumble" pr-toggle-file-tumble | |
2719 :style toggle :selected pr-file-tumble | |
2720 :active (and pr-file-duplex pr-ps-utility-alist)]) | |
2721 ["Despool..." (call-interactively 'pr-despool-ps-print) | |
2722 :active pr-spool-p :keys "\\[pr-despool-ps-print]"]) | |
2723 ["PostScript Printers" pr-update-menus | |
2724 :active pr-ps-printer-alist :included (pr-visible-p 'postscript)] | |
2725 "--" | |
2726 ("Printify" :included (pr-visible-p 'text) | |
2727 ["Directory" pr-printify-directory t] | |
2728 ["Buffer" pr-printify-buffer t] | |
2729 ["Region" pr-printify-region (ps-mark-active-p)]) | |
2730 ("Print" :included (pr-visible-p 'text) | |
2731 ["Directory" pr-txt-directory t] | |
2732 ["Buffer" pr-txt-buffer t] | |
2733 ["Region" pr-txt-region (ps-mark-active-p)] | |
2734 ["Mode" pr-txt-mode (pr-mode-alist-p)]) | |
2735 ["Text Printers" pr-update-menus | |
2736 :active pr-txt-printer-alist :included (pr-visible-p 'text)] | |
2737 "--" | |
2738 ["Landscape" pr-toggle-landscape | |
2739 :style toggle :selected ps-landscape-mode | |
2740 :included (pr-visible-p 'postscript-options)] | |
2741 ["Print Header" pr-toggle-header | |
2742 :style toggle :selected ps-print-header | |
2743 :included (pr-visible-p 'postscript-options)] | |
2744 ["Print Header Frame" pr-toggle-header-frame | |
2745 :style toggle :selected ps-print-header-frame :active ps-print-header | |
2746 :included (pr-visible-p 'postscript-options)] | |
2747 ["Line Number" pr-toggle-line | |
2748 :style toggle :selected ps-line-number | |
2749 :included (pr-visible-p 'postscript-options)] | |
2750 ["Zebra Stripes" pr-toggle-zebra | |
2751 :style toggle :selected ps-zebra-stripes | |
2752 :included (pr-visible-p 'postscript-options)] | |
2753 ["Duplex" pr-toggle-duplex | |
2754 :style toggle :selected ps-spool-duplex | |
2755 :included (pr-visible-p 'postscript-options)] | |
2756 ["Tumble" pr-toggle-tumble | |
2757 :style toggle :selected ps-spool-tumble :active ps-spool-duplex | |
2758 :included (pr-visible-p 'postscript-options)] | |
2759 ["Upside-Down" pr-toggle-upside-down | |
2760 :style toggle :selected ps-print-upside-down | |
2761 :included (pr-visible-p 'postscript-options)] | |
2762 ("Print All Pages" :included (pr-visible-p 'postscript-options) | |
2763 ["All Pages" (pr-even-or-odd-pages nil) | |
2764 :style radio :selected (eq ps-even-or-odd-pages nil)] | |
2765 ["Even Pages" (pr-even-or-odd-pages 'even-page) | |
2766 :style radio :selected (eq ps-even-or-odd-pages 'even-page)] | |
2767 ["Odd Pages" (pr-even-or-odd-pages 'odd-page) | |
2768 :style radio :selected (eq ps-even-or-odd-pages 'odd-page)] | |
2769 ["Even Sheets" (pr-even-or-odd-pages 'even-sheet) | |
2770 :style radio :selected (eq ps-even-or-odd-pages 'even-sheet)] | |
2771 ["Odd Sheets" (pr-even-or-odd-pages 'odd-sheet) | |
2772 :style radio :selected (eq ps-even-or-odd-pages 'odd-sheet)]) | |
2773 "--" | |
2774 ["Spool Buffer" pr-toggle-spool | |
2775 :style toggle :selected pr-spool-p | |
2776 :included (pr-visible-p 'postscript-process)] | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2777 ["Print with faces" pr-toggle-faces |
49646 | 2778 :style toggle :selected pr-faces-p |
2779 :included (pr-visible-p 'postscript-process)] | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2780 ["Print via Ghostscript" pr-toggle-ghostscript |
49646 | 2781 :style toggle :selected pr-print-using-ghostscript |
2782 :included (pr-visible-p 'postscript-process)] | |
2783 "--" | |
2784 ["Auto Region" pr-toggle-region | |
2785 :style toggle :selected pr-auto-region | |
2786 :included (pr-visible-p 'printing)] | |
2787 ["Auto Mode" pr-toggle-mode | |
2788 :style toggle :selected pr-auto-mode | |
2789 :included (pr-visible-p 'printing)] | |
2790 ["Menu Lock" pr-toggle-lock | |
2791 :style toggle :selected pr-menu-lock | |
2792 :included (pr-visible-p 'printing)] | |
2793 "--" | |
2794 ("Customize" :included (pr-visible-p 'help) | |
2795 ["printing" pr-customize t] | |
2796 ["ps-print" ps-print-customize t] | |
2797 ["lpr" lpr-customize t]) | |
2798 ("Show Settings" :included (pr-visible-p 'help) | |
2799 ["printing" pr-show-pr-setup t] | |
2800 ["ps-print" pr-show-ps-setup t] | |
2801 ["lpr" pr-show-lpr-setup t]) | |
2802 ["Help" pr-help :active t :included (pr-visible-p 'help)] | |
2803 )) | |
2804 )) | |
2805 | |
2806 | |
2807 (cond | |
2808 ((eq ps-print-emacs-type 'emacs) ; GNU Emacs | |
2809 ;; Menu binding | |
2810 (require 'easymenu) | |
2811 ;; Replace existing "print" item by "Printing" item. | |
2812 ;; If you're changing this file, you'll load it a second, | |
2813 ;; third... time, but "print" item exists only in the first load. | |
2814 (defvar pr-menu-print-item "print") | |
2815 (cond | |
2816 ;; Emacs 20 | |
2817 ((string< emacs-version "21.") | |
2818 (easy-menu-change '("tools") "Printing" pr-menu-spec pr-menu-print-item) | |
2819 (when pr-menu-print-item | |
2820 (easy-menu-remove-item nil '("tools") pr-menu-print-item) | |
2821 (setq pr-menu-print-item nil | |
2822 pr-menu-bar (vector 'menu-bar 'tools | |
2823 (pr-get-symbol "Printing"))))) | |
2824 ;; Emacs 21 | |
2825 (pr-menu-print-item | |
2826 (easy-menu-change '("files") "Print" pr-menu-spec "print-buffer") | |
2827 (let ((items '("print-buffer" "print-region" | |
2828 "ps-print-buffer-faces" "ps-print-region-faces" | |
2829 "ps-print-buffer" "ps-print-region"))) | |
2830 (while items | |
2831 (easy-menu-remove-item nil '("files") (car items)) | |
2832 (setq items (cdr items))) | |
2833 (setq pr-menu-print-item nil | |
2834 pr-menu-bar (vector 'menu-bar 'files | |
2835 (pr-get-symbol "Print"))))) | |
2836 (t | |
2837 (easy-menu-change '("files") "Print" pr-menu-spec))) | |
2838 | |
2839 ;; Key binding | |
2840 (global-set-key [print] 'pr-ps-fast-fire) | |
2841 (global-set-key [M-print] 'pr-ps-mode-using-ghostscript) | |
2842 (global-set-key [C-print] 'pr-txt-fast-fire)) | |
2843 | |
2844 | |
2845 ((eq ps-print-emacs-type 'xemacs) ; XEmacs | |
2846 ;; Menu binding | |
2847 (pr-xemacs-global-menubar | |
2848 (pr-x-add-submenu nil (cons "Printing" pr-menu-spec) "Apps")) | |
2849 | |
2850 ;; Key binding | |
2851 (global-set-key 'f22 'pr-ps-fast-fire) | |
2852 (global-set-key '(meta f22) 'pr-ps-mode-using-ghostscript) | |
2853 (global-set-key '(control f22) 'pr-txt-fast-fire)))) | |
2854 | |
2855 | |
2856 ;;; You can also use something like: | |
2857 ;;;(global-set-key "\C-ci" 'pr-interface) | |
2858 ;;;(global-set-key "\C-cbp" 'pr-ps-buffer-print) | |
2859 ;;;(global-set-key "\C-cbx" 'pr-ps-buffer-preview) | |
2860 ;;;(global-set-key "\C-cbb" 'pr-ps-buffer-using-ghostscript) | |
2861 ;;;(global-set-key "\C-crp" 'pr-ps-region-print) | |
2862 ;;;(global-set-key "\C-crx" 'pr-ps-region-preview) | |
2863 ;;;(global-set-key "\C-crr" 'pr-ps-region-using-ghostscript) | |
2864 | |
2865 | |
2866 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
2867 ;; Help Message | |
2868 | |
2869 | |
2870 (defconst pr-help-message | |
2871 (concat "printing.el version " pr-version | |
2872 " ps-print.el version " ps-print-version | |
2873 "\n\n | |
2874 Menu Layout | |
2875 ----------- | |
2876 | |
2877 The `printing' menu (Tools/Printing or File/Print) has the following layout: | |
2878 | |
2879 +-----------------------------+ | |
2880 A 0 | Printing Interface | | |
2881 +-----------------------------+ +-A---------+ +-B------+ | |
2882 I 1 | PostScript Preview >|-------|Directory >|-----|1-up | | |
2883 2 | PostScript Print >|---- A |Buffer >|-- B |2-up | | |
2884 3 | PostScript Printer: name >|---- C |Region >|-- B |4-up | | |
2885 +-----------------------------+ |Mode >|-- B |Other...| | |
2886 II 4 | Printify >|-----\\ |File >|--\\ +--------+ | |
2887 5 | Print >|---\\ | |Despool... | | | |
2888 6 | Text Printer: name >|-\\ | | +-----------+ | | |
2889 +-----------------------------+ | | | +---------+ +------------+ | |
54210
602769168263
Replace "As Is..." in PostScript file print/preview by "No Preprocessing...".
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54209
diff
changeset
|
2890 III 7 |[ ]Landscape | | | \\-|Directory| | No Prep... | Ia |
49646 | 2891 8 |[ ]Print Header | | | |Buffer | +------------+ Ib |
2892 9 |[ ]Print Header Frame | | | |Region | | name >|- C | |
2893 10 |[ ]Line Number | | | +---------+ +------------+ | |
2894 11 |[ ]Zebra Stripes | | | +---------+ | 1-up... | Ic | |
2895 12 |[ ]Duplex | | \\---|Directory| | 2-up... | | |
2896 13 |[ ]Tumble | \\--\\ |Buffer | | 4-up... | | |
2897 14 |[ ]Upside-Down | | |Region | | Other... | | |
2898 15 | Print All Pages >|--\\ | |Mode | +------------+ | |
2899 +-----------------------------+ | | +---------+ |[ ]Landscape| Id | |
2900 IV 16 |[ ]Spool Buffer | | | +-C-------+ |[ ]Duplex | Ie | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2901 17 |[ ]Print with faces | | \\--|( )name A| |[ ]Tumble | If |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2902 18 |[ ]Print via Ghostscript | | |( )name B| +------------+ |
49646 | 2903 +-----------------------------+ | |... | |
2904 V 19 |[ ]Auto Region | | |(*)name | | |
2905 20 |[ ]Auto Mode | | |... | | |
2906 21 |[ ]Menu Lock | | +---------+ +--------------+ | |
2907 +-----------------------------+ \\------------------|(*)All Pages | | |
2908 VI 22 | Customize >|--- D +-D------+ |( )Even Pages | | |
2909 23 | Show Settings >|-------|printing| |( )Odd Pages | | |
2910 24 | Help | |ps-print| |( )Even Sheets| | |
2911 +-----------------------------+ |lpr | |( )Odd Sheets | | |
2912 +--------+ +--------------+ | |
2913 | |
2914 See `pr-visible-entry-list' for hiding some parts of the menu. | |
2915 | |
2916 The menu has the following sections: | |
2917 | |
2918 A. Interface: | |
2919 | |
2920 0. You can use a buffer interface instead of menus. It looks like the | |
2921 customization buffer. Basically, it has the same options found in the | |
2922 menu and some extra options, all this on a buffer. | |
2923 | |
2924 I. PostScript printing: | |
2925 | |
2926 1. You can generate a PostScript file (if you type C-u before activating | |
2927 menu) or PostScript temporary file for a directory, a buffer, a region | |
2928 or a major mode, choosing 1-up, 2-up, 4-up or any other n-up printing; | |
2929 after file generation, ghostview is activated using the file generated | |
2930 as argument. This option is disabled if spooling is on (option 16). | |
2931 Also, if you already have a PostScript file you can preview it. | |
2932 Instead of previewing each buffer, region or major mode at once, you | |
2933 can save temporarily the PostScript code generated in a buffer and | |
2934 preview it later. The option `Despool...' despools the PostScript | |
2935 spooling buffer in a temporary file and uses ghostview to preview it. | |
2936 If you type C-u before choosing this option, the PostScript code | |
2937 generated is saved in a file instead of saving in a temporary file. To | |
2938 spool the PostScript code generated you need to turn on the option 16. | |
2939 The option `Despool...' is enabled if spooling is on (option 16). | |
2940 | |
2941 NOTE 1: It's possible to customize a major mode printing, just declare | |
2942 the customization in `pr-mode-alist' and invoke some of | |
2943 `*-mode*' commands or select Mode option in Printing menu. An | |
2944 example for major mode usage is when you're using gnus (or mh, | |
2945 or rmail, etc.) and you're in the *Summary* buffer, if you | |
2946 forget to switch to the *Article* buffer before printing, | |
2947 you'll get a nicely formatted list of article subjects shows | |
2948 up at the printer. With major mode printing you don't need to | |
2949 switch from gnus *Summary* buffer first. | |
2950 | |
2951 NOTE 2: There are the following options for PostScript file processing: | |
54210
602769168263
Replace "As Is..." in PostScript file print/preview by "No Preprocessing...".
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54209
diff
changeset
|
2952 Ia. Print the file *No Preprocessing*, that is, send it |
602769168263
Replace "As Is..." in PostScript file print/preview by "No Preprocessing...".
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54209
diff
changeset
|
2953 directly to PostScript printer. |
49646 | 2954 Ib. PostScript utility processing selection. |
2955 See `pr-ps-utility-alist' and `pr-setting-database' for | |
2956 documentation. | |
2957 Ic. Do n-up processing before printing. | |
2958 Id. Toggle on/off landscape for PostScript file processing. | |
2959 Ie. Toggle on/off duplex for PostScript file processing. | |
2960 If. Toggle on/off tumble for PostScript file processing. | |
2961 | |
2962 NOTE 3: Don't forget to download and install the utilities declared on | |
2963 `pr-ps-utility-alist'. | |
2964 | |
2965 2. Operate the same way as option 1, but it sends directly the PostScript | |
2966 code (or put in a file, if you've typed C-u) or it uses ghostscript to | |
2967 print the PostScript file generated. It depends on option 18, if it's | |
2968 turned on, it uses ghostscript; otherwise, it sends directly to | |
2969 printer. If spooling is on (option 16), the PostScript code is saved | |
2970 temporarily in a buffer instead of printing it or saving it in a file. | |
2971 Also, if you already have a PostScript file you can print it. | |
2972 Instead of printing each buffer, region or major mode at once, you can | |
2973 save temporarily the PostScript code generated in a buffer and print it | |
2974 later. The option `Despool...' despools the PostScript spooling buffer | |
2975 directly on a printer. If you type C-u before choosing this option, | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2976 the PostScript code generated is saved in a file instead of sending it to |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2977 the printer. To spool the PostScript code generated you need to turn on |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2978 option 16. This option is enabled if spooling is on (option 16). |
49646 | 2979 See also the NOTE 1, NOTE 2 and NOTE 3 on option 1. |
2980 | |
2981 3. You can select a new PostScript printer to send PostScript code | |
2982 generated. For selection it's used all PostScript printers defined | |
2983 in `pr-ps-printer-alist' variable (see it for documentation). | |
2984 See also `pr-setting-database'. | |
2985 | |
2986 II. Text printing: | |
2987 | |
2988 4. If you have control characters (character code from \\000 to \\037) in a | |
2989 buffer and you want to print them in a text printer, select this | |
2990 option. All control characters in your buffer or region will be | |
2991 replaced by a printable representation. The printable representations | |
2992 use ^ (for ASCII control characters) or hex. The characters tab, | |
2993 linefeed, space, return and formfeed are not affected. | |
2994 You don't need to select this option if you use any option of section | |
2995 I, the PostScript engine treats control characters properly. | |
2996 | |
2997 5. If you want to print a directory, buffer, region or major mode in a | |
2998 text printer, select this option. See also the NOTE 1 on option 1. | |
2999 | |
3000 6. You can select a new text printer to send text generated. For | |
3001 selection it's used all text printers defined in `pr-txt-printer-alist' | |
3002 variable (see it for documentation). | |
3003 See also `pr-setting-database'. | |
3004 | |
3005 III. PostScript page toggle options: | |
3006 | |
3007 7. If you want a PostScript landscape printing, turn on this option. | |
3008 | |
3009 8. If you want to have a header in each page in your PostScript code, | |
3010 turn on this option. | |
3011 | |
3012 9. If you want to draw a gaudy frame around the header, turn on this | |
3013 option. This option is enabled if print header is on (option 8). | |
3014 | |
3015 10. If you want that the line number is printed in your PostScript code, | |
3016 turn on this option. | |
3017 | |
3018 11. If you want background zebra stripes in your PostScript code, turn on | |
3019 this option. | |
3020 | |
3021 12. If you want a duplex printing and your PostScript printer has this | |
3022 feature, turn on this option. | |
3023 | |
3024 13. If you turned on duplex printing, you can choose if you want to have a | |
3025 printing suitable for binding on the left or right (tumble off), or to | |
3026 have a printing suitable for binding at top or bottom (tumble on). | |
3027 This option is enabled if duplex is on (option 12). | |
3028 | |
3029 14. If you want a PostScript upside-down printing, turn on this option. | |
3030 | |
3031 15. With this option, you can choose if you want to print all pages, odd | |
3032 pages, even pages, odd sheets or even sheets. | |
3033 See also `ps-even-or-odd-pages'. | |
3034 | |
3035 IV. PostScript processing toggle options: | |
3036 | |
3037 16. If you want to spool the PostScript code generated, turn on this | |
3038 option. To spool the PostScript code generated use option 2. You can | |
3039 despool later by choosing option 1 or 2, sub-option `Despool...'. | |
3040 | |
3041 17. If you use colors in your buffers and want to see these colors on your | |
3042 PostScript code generated, turn on this option. If you have a | |
3043 black/white PostScript printer, these colors are displayed in gray | |
3044 scale by PostScript printer interpreter. | |
3045 | |
3046 18. If you don't have a PostScript printer to send PostScript files, turn | |
3047 on this option. When this option is on, the ghostscript is used to | |
3048 print PostScript files. In GNU or Unix system, if ghostscript is set | |
3049 as a PostScript filter, you don't need to turn on this option. | |
3050 | |
3051 V. Printing customization: | |
3052 | |
3053 19. If you want that region is automagically detected, turn on this | |
3054 option. Note that this will only work if you're using transient mark | |
3055 mode. When this option is on, the `*-buffer*' commands will behave | |
3056 like `*-region*' commands, that is, `*-buffer*' commands will print | |
3057 only the region marked instead of all buffer. | |
3058 | |
3059 20. Turn this option on if you want that when current major-mode is | |
3060 declared in `pr-mode-alist', the `*-buffer*' and `*-region*' commands | |
3061 behave like `*-mode*' commands. | |
3062 | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3063 21. If you want that Printing menu stays open while you are setting |
49646 | 3064 toggle options, turn on this option. The variables |
3065 `pr-menu-char-height' and `pr-menu-char-width' are used to guess the | |
3066 menu position, so don't forget to adjust these variables if menu | |
3067 position is not ok. | |
3068 | |
3069 VI. Customization: | |
3070 | |
3071 22. Besides all options in section III, IV and V, you can customize much | |
3072 more PostScript options in `ps-print' option. Or you can customize | |
3073 some `lpr' options for text printing. Or customize `printing' | |
3074 options. | |
3075 | |
3076 23. Show current settings for `printing', `ps-print' or `lpr'. | |
3077 | |
3078 24. Quick help for printing menu layout. | |
3079 ") | |
3080 "Printing help message.") | |
3081 | |
3082 | |
3083 (defconst pr-interface-help-message | |
3084 (concat "printing.el version " pr-version | |
3085 " ps-print.el version " ps-print-version | |
3086 "\n\n | |
3087 The printing interface buffer has the same functionality as the printing menu. | |
3088 The major difference is that the states (like sending PostScript generated to a | |
3089 file, n-up printing, etc.) are set and saved between priting buffer | |
3090 activation. Also, the landscape, duplex and tumble values are the same for | |
3091 PostScript file and directory/buffer/region/mode processing; using menu, there | |
3092 are different value sets for PostScript file and directory/buffer/region/mode | |
3093 processing. | |
3094 | |
3095 The printing interface buffer has the following sections: | |
3096 | |
3097 1. Print: | |
3098 | |
3099 Here you can choose to print/preview a buffer, a directory or a PostScript | |
3100 file: | |
3101 | |
3102 1a. Buffer: | |
3103 | |
3104 * Buffer List: | |
3105 Select a buffer from the current buffer list. | |
3106 | |
3107 * Region: | |
3108 If it's on, this means that the selected buffer has an active region, | |
3109 so you can turn on/off, as you wish. | |
3110 If it's off when a buffer is selected, this means that the selected | |
3111 buffer has no active region, so it'll not be possible to turn it on. | |
3112 If you want to process the region, let this option on. | |
3113 If you want to process the whole buffer, let this option off. | |
3114 | |
3115 * Mode: | |
3116 If it's on, this means that the selected buffer major mode is declared | |
3117 for major mode processing, so you can turn on/off, as you wish. | |
3118 If it's off when a buffer is selected, this means that the selected | |
3119 buffer major mode isn't declared for major mode processing, so it'll | |
3120 not be possible to turn it on. | |
3121 If you want the major mode processing, let this option on. | |
3122 If you don't want the major mode processing, let this option off. | |
3123 | |
3124 NOTE 1: It's possible to customize a major mode printing, just declare | |
3125 the customization in `pr-mode-alist' and invoke some of | |
3126 `*-mode*' commands or select Mode option in Printing menu. An | |
3127 example for major mode usage is when you're using gnus (or mh, | |
3128 or rmail, etc.) and you're in the *Summary* buffer, if you | |
3129 forget to switch to the *Article* buffer before printing, | |
3130 you'll get a nicely formatted list of article subjects shows | |
3131 up at the printer. With major mode printing you don't need to | |
3132 switch from gnus *Summary* buffer first. | |
3133 | |
3134 1b. Directory: | |
3135 | |
3136 * Directory: | |
3137 Specify a valid directory path. | |
3138 | |
3139 * File Regexp: | |
3140 Specify a file name regexp. All file names in the directory that | |
3141 match with regexp will be printed/previewed. An empty file name | |
3142 regexp means to print/preview all files in the directory. | |
3143 | |
3144 * List Directory Entry: | |
3145 If it's turned on, list directory entries besides file entries. | |
3146 | |
3147 1c. PostScript file: | |
3148 | |
3149 * PostScript File: | |
3150 Specify an existent PostScript file to print/preview. | |
3151 | |
3152 * PostScript Utility: | |
3153 Select a PostScript utility. | |
3154 See `pr-ps-utility-alist' and `pr-setting-database' for documentation. | |
3155 | |
3156 NOTE 2: Don't forget to download and install the utilities declared on | |
3157 `pr-ps-utility-alist'. | |
3158 | |
54210
602769168263
Replace "As Is..." in PostScript file print/preview by "No Preprocessing...".
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54209
diff
changeset
|
3159 * No Preprocessing: |
49646 | 3160 If it's turned on, don't use the PostScript utility to preprocess the |
3161 PostScript file before printing/previewing. | |
3162 | |
3163 2. PostScript printer: | |
3164 | |
3165 * PostScript Printer: | |
3166 You can select a new PostScript printer to send PostScript code | |
3167 generated. For selection it's used all PostScript printers defined | |
3168 in `pr-ps-printer-alist' variable (see it for documentation). | |
3169 See also `pr-setting-database'. | |
3170 | |
3171 * Despool: | |
3172 If spooling is on, you can turn it on/off, as you wish. | |
3173 If spooling is off, it'll not be possible to turn it on. | |
3174 If it's turned on, specify to despools the PostScript spooling buffer in | |
3175 a temporary file or in the selected PostScript file when | |
3176 printing/previewing. | |
3177 | |
3178 * Preview: | |
3179 Preview the PostScript generated. | |
3180 | |
3181 * Print: | |
3182 Print the PostScript generated. | |
3183 | |
3184 * Quit: | |
3185 Quit from printing interface buffer. | |
3186 | |
3187 * Send to Printer/Temporary File: | |
3188 If it's turned on, the PostScript generated is sent directly to | |
3189 PostScript printer or, for previewing, to a temporary file. | |
3190 | |
3191 * Send to File: | |
3192 Specify a file name to send the PostScript generated. | |
3193 | |
3194 * N-Up: | |
3195 Specify n-up printing. | |
3196 | |
3197 3. Text printer: | |
3198 | |
3199 * Text Printer: | |
3200 Select a new text printer to send text generated. For selection it's used | |
3201 all text printers defined in `pr-txt-printer-alist' variable (see it for | |
3202 documentation). See also `pr-setting-database'. | |
3203 | |
3204 * Printify: | |
3205 If you have control characters (character code from \\000 to \\037) in a | |
3206 buffer and you want to print them in a text printer, select this | |
3207 option. All control characters in your buffer or region will be | |
3208 replaced by a printable representation. The printable representations | |
3209 use ^ (for ASCII control characters) or hex. The characters tab, | |
3210 linefeed, space, return and formfeed are not affected. | |
3211 You don't need to select this option if you use any option of section | |
3212 I, the PostScript engine treats control characters properly. | |
3213 | |
3214 * Print: | |
3215 To print a directory, buffer, region or major mode in a | |
3216 text printer, select this option. See also the NOTE 1 on section 1. | |
3217 | |
3218 * Quit: | |
3219 Quit from printing interface buffer. | |
3220 | |
3221 4. Settings: | |
3222 | |
3223 There are 3 setting columns: | |
3224 | |
3225 4a. First column (left column): | |
3226 | |
3227 * Landscape: | |
3228 PostScript landscape printing. | |
3229 | |
3230 * Print Header: | |
3231 To have a header in each page in your PostScript code. | |
3232 | |
3233 * Print Header Frame: | |
3234 To draw a gaudy frame around the header. | |
3235 | |
3236 * Line Number: | |
3237 The line number is printed in your PostScript code. | |
3238 | |
3239 * Zebra Stripes: | |
3240 Background zebra stripes in your PostScript code. | |
3241 | |
3242 * Duplex: | |
3243 Duplex printing (if your PostScript printer has this feature). | |
3244 | |
3245 * Tumble: | |
3246 If duplex printing is on, you can choose if you want to have a | |
3247 printing suitable for binding on the left or right (tumble off), or to | |
3248 have a printing suitable for binding at top or bottom (tumble on). | |
3249 | |
3250 * Upside-Down: | |
3251 PostScript upside-down printing. | |
3252 | |
3253 4b. Second column (middle column): | |
3254 | |
3255 * Auto Region: | |
3256 If you want that region is automagically detected, turn on this | |
3257 option. Note that this will only work if you're using transient mark | |
3258 mode. When this option is on, the `*-buffer*' commands will behave | |
3259 like `*-region*' commands, that is, `*-buffer*' commands will print | |
3260 only the region marked instead of all buffer. | |
3261 | |
3262 * Auto Mode: | |
3263 Turn this option on if you want that when current major-mode is | |
3264 declared in `pr-mode-alist', the `*-buffer*' and `*-region*' commands | |
3265 behave like `*-mode*' commands. | |
3266 | |
3267 * Menu Lock: | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3268 If you want that Printing menu stays open while you are setting |
49646 | 3269 toggle options, turn on this option. The variables |
3270 `pr-menu-char-height' and `pr-menu-char-width' are used to guess the | |
3271 menu position, so don't forget to adjust these variables if menu | |
3272 position is not ok. | |
3273 | |
3274 * Spool Buffer: | |
3275 To spool the PostScript code generated. You can despool later by | |
3276 setting Despool option on PostScript printer section. | |
3277 | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3278 * Print with faces: |
49646 | 3279 If you use colors in your buffers and want to see these colors on your |
3280 PostScript code generated, turn on this option. If you have a | |
3281 black/white PostScript printer, these colors are displayed in gray | |
3282 scale by PostScript printer interpreter. | |
3283 | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3284 * Print via Ghostscript: |
49646 | 3285 If you don't have a PostScript printer to send PostScript files, turn |
3286 on this option. When this option is on, the ghostscript is used to | |
3287 print PostScript files. In GNU or Unix system, if ghostscript is set | |
3288 as a PostScript filter, you don't need to turn on this option. | |
3289 | |
3290 * Parity Page Menu: | |
3291 To print all pages, odd pages, even pages, odd sheets or even sheets. | |
3292 See also `ps-even-or-odd-pages'. | |
3293 | |
3294 4c. Third column (right column): | |
3295 | |
3296 * Verbose: | |
3297 That is, to be verbose when editing a field in interface buffer. | |
3298 | |
3299 5. Customize: | |
3300 | |
3301 Besides all options in section 4, you can customize much more PostScript | |
3302 options in `ps-print' option. Or you can customize some `lpr' options for | |
3303 text printing. Or customize `printing' options. | |
3304 | |
3305 6. Show settings: | |
3306 | |
3307 Show current settings for `printing', `ps-print' or `lpr'. | |
3308 | |
3309 7. Help: | |
3310 | |
3311 Quick help for printing interface buffer and printing menu layout. You can | |
3312 also quit the printing interface buffer or kill all printing help buffer. | |
3313 ") | |
3314 "Printing buffer interface help message.") | |
3315 | |
3316 | |
3317 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
3318 ;; Commands | |
3319 | |
3320 | |
3321 ;;;###autoload | |
3322 (defun pr-interface (&optional buffer) | |
3323 "Activate the printing interface buffer. | |
3324 | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3325 If BUFFER is nil, the current buffer is used for printing. |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3326 |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3327 For more information, type \\[pr-interface-help]." |
49646 | 3328 (interactive) |
3329 (save-excursion | |
3330 (set-buffer (or buffer (current-buffer))) | |
3331 (pr-create-interface))) | |
3332 | |
3333 | |
3334 ;;;###autoload | |
3335 (defun pr-ps-directory-preview (n-up dir file-regexp &optional filename) | |
3336 "Preview directory using ghostview. | |
3337 | |
3338 Interactively, the command prompts for N-UP printing number, a directory, a | |
3339 file name regexp for matching and, when you use a prefix argument (C-u), the | |
3340 command prompts the user for a file name, and saves the PostScript image in | |
3341 that file instead of saving it in a temporary file. | |
3342 | |
3343 Noninteractively, if N-UP is nil, prompts for N-UP printing number. If DIR is | |
3344 nil, prompts for DIRectory. If FILE-REGEXP is nil, prompts for | |
3345 FILE(name)-REGEXP. The argument FILENAME is treated as follows: if it's nil, | |
3346 save the image in a temporary file. If FILENAME is a string, save the | |
3347 PostScript image in a file with that name. If FILENAME is t, prompts for a | |
3348 file name. | |
3349 | |
3350 See also documentation for `pr-list-directory'." | |
3351 (interactive (pr-interactive-ps-dir-args (pr-prompt "PS preview dir"))) | |
3352 (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename | |
3353 (pr-prompt "PS preview dir")) | |
3354 (setq filename (pr-ps-file filename)) | |
3355 (pr-ps-file-list n-up dir file-regexp filename) | |
3356 (or pr-spool-p | |
3357 (pr-ps-file-preview filename))) | |
3358 | |
3359 | |
3360 ;;;###autoload | |
3361 (defun pr-ps-directory-using-ghostscript (n-up dir file-regexp &optional filename) | |
3362 "Print directory using PostScript through ghostscript. | |
3363 | |
3364 Interactively, the command prompts for N-UP printing number, a directory, a | |
3365 file name regexp for matching and, when you use a prefix argument (C-u), the | |
3366 command prompts the user for a file name, and saves the PostScript image in | |
3367 that file instead of saving it in a temporary file. | |
3368 | |
3369 Noninteractively, if N-UP is nil, prompts for N-UP printing number. If DIR is | |
3370 nil, prompts for DIRectory. If FILE-REGEXP is nil, prompts for | |
3371 FILE(name)-REGEXP. The argument FILENAME is treated as follows: if it's nil, | |
3372 save the image in a temporary file. If FILENAME is a string, save the | |
3373 PostScript image in a file with that name. If FILENAME is t, prompts for a | |
3374 file name. | |
3375 | |
3376 See also documentation for `pr-list-directory'." | |
3377 (interactive (pr-interactive-ps-dir-args (pr-prompt "PS print dir GS"))) | |
3378 (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename | |
3379 (pr-prompt "PS print dir GS")) | |
3380 (let ((file (pr-ps-file filename))) | |
3381 (pr-ps-file-list n-up dir file-regexp file) | |
3382 (pr-ps-file-using-ghostscript file) | |
3383 (or filename (pr-delete-file file)))) | |
3384 | |
3385 | |
3386 ;;;###autoload | |
3387 (defun pr-ps-directory-print (n-up dir file-regexp &optional filename) | |
3388 "Print directory using PostScript printer. | |
3389 | |
3390 Interactively, the command prompts for N-UP printing number, a directory, a | |
3391 file name regexp for matching and, when you use a prefix argument (C-u), the | |
3392 command prompts the user for a file name, and saves the PostScript image in | |
3393 that file instead of saving it in a temporary file. | |
3394 | |
3395 Noninteractively, if N-UP is nil, prompts for N-UP printing number. If DIR is | |
3396 nil, prompts for DIRectory. If FILE-REGEXP is nil, prompts for | |
3397 FILE(name)-REGEXP. The argument FILENAME is treated as follows: if it's nil, | |
3398 save the image in a temporary file. If FILENAME is a string, save the | |
3399 PostScript image in a file with that name. If FILENAME is t, prompts for a | |
3400 file name. | |
3401 | |
3402 See also documentation for `pr-list-directory'." | |
3403 (interactive (pr-interactive-ps-dir-args (pr-prompt "PS print dir"))) | |
3404 (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename | |
3405 (pr-prompt "PS print dir")) | |
3406 (let ((file (pr-ps-file filename))) | |
3407 (pr-ps-file-list n-up dir file-regexp file) | |
3408 (pr-ps-file-print file) | |
3409 (or filename (pr-delete-file file)))) | |
3410 | |
3411 | |
3412 ;;;###autoload | |
3413 (defun pr-ps-directory-ps-print (n-up dir file-regexp &optional filename) | |
3414 "Print directory using PostScript printer or through ghostscript. | |
3415 | |
3416 It depends on `pr-print-using-ghostscript'. | |
3417 | |
3418 Interactively, the command prompts for N-UP printing number, a directory, a | |
3419 file name regexp for matching and, when you use a prefix argument (C-u), the | |
3420 command prompts the user for a file name, and saves the PostScript image in | |
3421 that file instead of saving it in a temporary file. | |
3422 | |
3423 Noninteractively, if N-UP is nil, prompts for N-UP printing number. If DIR is | |
3424 nil, prompts for DIRectory. If FILE-REGEXP is nil, prompts for | |
3425 FILE(name)-REGEXP. The argument FILENAME is treated as follows: if it's nil, | |
3426 save the image in a temporary file. If FILENAME is a string, save the | |
3427 PostScript image in a file with that name. If FILENAME is t, prompts for a | |
3428 file name. | |
3429 | |
3430 See also documentation for `pr-list-directory'." | |
3431 (interactive (pr-interactive-ps-dir-args | |
3432 (pr-prompt (pr-prompt-gs "PS print dir")))) | |
3433 (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename | |
3434 (pr-prompt (pr-prompt-gs "PS print dir"))) | |
3435 (if (pr-using-ghostscript-p) | |
3436 (pr-ps-directory-using-ghostscript n-up dir file-regexp filename) | |
3437 (pr-ps-directory-print n-up dir file-regexp filename))) | |
3438 | |
3439 | |
3440 ;;;###autoload | |
3441 (defun pr-ps-buffer-preview (n-up &optional filename) | |
3442 "Preview buffer using ghostview. | |
3443 | |
3444 Interactively, the command prompts for N-UP printing number and, when you use a | |
3445 prefix argument (C-u), the command prompts the user for a file name, and saves | |
3446 the PostScript image in that file instead of saving it in a temporary file. | |
3447 | |
3448 Noninteractively, if N-UP is nil, prompts for N-UP printing number. The | |
3449 argument FILENAME is treated as follows: if it's nil, save the image in a | |
3450 temporary file. If FILENAME is a string, save the PostScript image in a file | |
3451 with that name. If FILENAME is t, prompts for a file name." | |
3452 (interactive (pr-interactive-n-up-file (pr-prompt "PS preview"))) | |
3453 (if (pr-auto-mode-p) | |
3454 (pr-ps-mode-preview n-up filename) | |
3455 (pr-ps-preview (pr-region-active-symbol) n-up filename | |
3456 (pr-region-active-string "PS preview")))) | |
3457 | |
3458 | |
3459 ;;;###autoload | |
3460 (defun pr-ps-buffer-using-ghostscript (n-up &optional filename) | |
3461 "Print buffer using PostScript through ghostscript. | |
3462 | |
3463 Interactively, the command prompts for N-UP printing number and, when you use a | |
3464 prefix argument (C-u), the command prompts the user for a file name, and saves | |
3465 the PostScript image in that file instead of sending it to the printer. | |
3466 | |
3467 Noninteractively, if N-UP is nil, prompts for N-UP printing number. The | |
3468 argument FILENAME is treated as follows: if it's nil, send the image to the | |
3469 printer. If FILENAME is a string, save the PostScript image in a file with | |
3470 that name. If FILENAME is t, prompts for a file name." | |
3471 (interactive (pr-interactive-n-up-file (pr-prompt "PS print GS"))) | |
3472 (if (pr-auto-mode-p) | |
3473 (pr-ps-mode-using-ghostscript n-up filename) | |
3474 (pr-ps-using-ghostscript (pr-region-active-symbol) n-up filename | |
3475 (pr-region-active-string "PS print GS")))) | |
3476 | |
3477 | |
3478 ;;;###autoload | |
3479 (defun pr-ps-buffer-print (n-up &optional filename) | |
3480 "Print buffer using PostScript printer. | |
3481 | |
3482 Interactively, the command prompts for N-UP printing number and, when you use a | |
3483 prefix argument (C-u), the command prompts the user for a file name, and saves | |
3484 the PostScript image in that file instead of sending it to the printer. | |
3485 | |
3486 Noninteractively, if N-UP is nil, prompts for N-UP printing number. The | |
3487 argument FILENAME is treated as follows: if it's nil, send the image to the | |
3488 printer. If FILENAME is a string, save the PostScript image in a file with | |
3489 that name. If FILENAME is t, prompts for a file name." | |
3490 (interactive (pr-interactive-n-up-file (pr-prompt "PS print"))) | |
3491 (if (pr-auto-mode-p) | |
3492 (pr-ps-mode-print n-up filename) | |
3493 (pr-ps-print (pr-region-active-symbol) n-up filename | |
3494 (pr-region-active-string "PS print")))) | |
3495 | |
3496 | |
3497 ;;;###autoload | |
3498 (defun pr-ps-buffer-ps-print (n-up &optional filename) | |
3499 "Print buffer using PostScript printer or through ghostscript. | |
3500 | |
3501 It depends on `pr-print-using-ghostscript'. | |
3502 | |
3503 Interactively, the command prompts for N-UP printing number and, when you use a | |
3504 prefix argument (C-u), the command prompts the user for a file name, and saves | |
3505 the PostScript image in that file instead of sending it to the printer. | |
3506 | |
3507 Noninteractively, if N-UP is nil, prompts for N-UP printing number. The | |
3508 argument FILENAME is treated as follows: if it's nil, send the image to the | |
3509 printer. If FILENAME is a string, save the PostScript image in a file with | |
3510 that name. If FILENAME is t, prompts for a file name." | |
3511 (interactive (pr-interactive-n-up-file | |
3512 (pr-prompt (pr-prompt-gs "PS print")))) | |
3513 (cond ((pr-auto-mode-p) | |
3514 (pr-ps-mode-ps-print n-up filename)) | |
3515 ((pr-using-ghostscript-p) | |
3516 (pr-ps-using-ghostscript (pr-region-active-symbol) n-up filename | |
3517 (pr-region-active-string "PS print GS"))) | |
3518 (t | |
3519 (pr-ps-print (pr-region-active-symbol) n-up filename | |
3520 (pr-region-active-string "PS print"))))) | |
3521 | |
3522 | |
3523 ;;;###autoload | |
3524 (defun pr-ps-region-preview (n-up &optional filename) | |
3525 "Preview region using ghostview. | |
3526 | |
3527 See also `pr-ps-buffer-preview'." | |
3528 (interactive (pr-interactive-n-up-file (pr-prompt-region "PS preview"))) | |
3529 (if (pr-auto-mode-p) | |
3530 (let ((pr-auto-region t)) | |
3531 (pr-ps-mode-preview n-up filename)) | |
3532 (pr-ps-preview 'region n-up filename "PS preview region"))) | |
3533 | |
3534 | |
3535 ;;;###autoload | |
3536 (defun pr-ps-region-using-ghostscript (n-up &optional filename) | |
3537 "Print region using PostScript through ghostscript. | |
3538 | |
3539 See also `pr-ps-buffer-using-ghostscript'." | |
3540 (interactive (pr-interactive-n-up-file (pr-prompt-region "PS print GS"))) | |
3541 (if (pr-auto-mode-p) | |
3542 (let ((pr-auto-region t)) | |
3543 (pr-ps-mode-using-ghostscript n-up filename)) | |
3544 (pr-ps-using-ghostscript 'region n-up filename "PS print GS region"))) | |
3545 | |
3546 | |
3547 ;;;###autoload | |
3548 (defun pr-ps-region-print (n-up &optional filename) | |
3549 "Print region using PostScript printer. | |
3550 | |
3551 See also `pr-ps-buffer-print'." | |
3552 (interactive (pr-interactive-n-up-file (pr-prompt-region "PS print"))) | |
3553 (if (pr-auto-mode-p) | |
3554 (let ((pr-auto-region t)) | |
3555 (pr-ps-mode-print n-up filename)) | |
3556 (pr-ps-print 'region n-up filename "PS print region"))) | |
3557 | |
3558 | |
3559 ;;;###autoload | |
3560 (defun pr-ps-region-ps-print (n-up &optional filename) | |
3561 "Print region using PostScript printer or through ghostscript. | |
3562 | |
3563 See also `pr-ps-buffer-ps-print'." | |
3564 (interactive (pr-interactive-n-up-file | |
3565 (pr-prompt-region (pr-prompt-gs "PS print")))) | |
3566 (cond ((pr-auto-mode-p) | |
3567 (let ((pr-auto-region t)) | |
3568 (pr-ps-mode-ps-print n-up filename))) | |
3569 ((pr-using-ghostscript-p) | |
3570 (pr-ps-using-ghostscript 'region n-up filename "PS print GS region")) | |
3571 (t | |
3572 (pr-ps-print 'region n-up filename "PS print region")))) | |
3573 | |
3574 | |
3575 ;;;###autoload | |
3576 (defun pr-ps-mode-preview (n-up &optional filename) | |
3577 "Preview major mode using ghostview. | |
3578 | |
3579 See also `pr-ps-buffer-preview'." | |
3580 (interactive (pr-interactive-n-up-file "PS preview mode")) | |
3581 (pr-set-n-up-and-filename 'n-up 'filename "PS preview mode") | |
3582 (let ((file (pr-ps-file filename))) | |
3583 (and (pr-ps-mode n-up file) | |
3584 (not pr-spool-p) | |
3585 (pr-ps-file-preview file)))) | |
3586 | |
3587 | |
3588 ;;;###autoload | |
3589 (defun pr-ps-mode-using-ghostscript (n-up &optional filename) | |
3590 "Print major mode using PostScript through ghostscript. | |
3591 | |
3592 See also `pr-ps-buffer-using-ghostscript'." | |
3593 (interactive (pr-interactive-n-up-file "PS print GS mode")) | |
3594 (pr-set-n-up-and-filename 'n-up 'filename "PS print GS mode") | |
3595 (let ((file (pr-ps-file filename))) | |
3596 (when (and (pr-ps-mode n-up file) | |
3597 (not pr-spool-p)) | |
3598 (pr-ps-file-using-ghostscript file) | |
3599 (or filename (pr-delete-file file))))) | |
3600 | |
3601 | |
3602 ;;;###autoload | |
3603 (defun pr-ps-mode-print (n-up &optional filename) | |
3604 "Print major mode using PostScript printer. | |
3605 | |
3606 See also `pr-ps-buffer-print'." | |
3607 (interactive (pr-interactive-n-up-file "PS print mode")) | |
3608 (pr-set-n-up-and-filename 'n-up 'filename "PS print mode") | |
3609 (pr-ps-mode n-up filename)) | |
3610 | |
3611 | |
3612 ;;;###autoload | |
3613 (defun pr-ps-mode-ps-print (n-up &optional filename) | |
3614 "Print major mode using PostScript or through ghostscript. | |
3615 | |
3616 See also `pr-ps-buffer-ps-print'." | |
3617 (interactive (pr-interactive-n-up-file (pr-prompt-gs "PS print mode"))) | |
3618 (if (pr-using-ghostscript-p) | |
3619 (pr-ps-mode-using-ghostscript n-up filename) | |
3620 (pr-ps-mode-print n-up filename))) | |
3621 | |
3622 | |
3623 ;;;###autoload | |
3624 (defun pr-printify-directory (&optional dir file-regexp) | |
3625 "Replace nonprinting characters in directory with printable representations. | |
3626 The printable representations use ^ (for ASCII control characters) or hex. | |
3627 The characters tab, linefeed, space, return and formfeed are not affected. | |
3628 | |
3629 Interactively, the command prompts for a directory and a file name regexp for | |
3630 matching. | |
3631 | |
3632 Noninteractively, if DIR is nil, prompts for DIRectory. If FILE-REGEXP is nil, | |
3633 prompts for FILE(name)-REGEXP. | |
3634 | |
3635 See also documentation for `pr-list-directory'." | |
3636 (interactive (pr-interactive-dir-args "Printify dir")) | |
3637 (pr-set-dir-args 'dir 'file-regexp "Printify dir") | |
3638 (pr-file-list dir file-regexp 'pr-printify-buffer)) | |
3639 | |
3640 | |
3641 ;;;###autoload | |
3642 (defun pr-printify-buffer () | |
3643 "Replace nonprinting characters in buffer with printable representations. | |
3644 The printable representations use ^ (for ASCII control characters) or hex. | |
3645 The characters tab, linefeed, space, return and formfeed are not affected." | |
3646 (interactive "*") | |
3647 (if (pr-region-active-p) | |
3648 (pr-printify-region) | |
3649 (printify-region (point-min) (point-max)))) | |
3650 | |
3651 | |
3652 ;;;###autoload | |
3653 (defun pr-printify-region () | |
3654 "Replace nonprinting characters in region with printable representations. | |
3655 The printable representations use ^ (for ASCII control characters) or hex. | |
3656 The characters tab, linefeed, space, return and formfeed are not affected." | |
3657 (interactive "*") | |
3658 (printify-region (point) (mark))) | |
3659 | |
3660 | |
3661 ;;;###autoload | |
3662 (defun pr-txt-directory (&optional dir file-regexp) | |
3663 "Print directory using text printer. | |
3664 | |
3665 Interactively, the command prompts for a directory and a file name regexp for | |
3666 matching. | |
3667 | |
3668 Noninteractively, if DIR is nil, prompts for DIRectory. If FILE-REGEXP is nil, | |
3669 prompts for FILE(name)-REGEXP. | |
3670 | |
3671 See also documentation for `pr-list-directory'." | |
3672 (interactive (pr-interactive-dir-args "Print dir")) | |
3673 (pr-set-dir-args 'dir 'file-regexp "Print dir") | |
3674 (pr-file-list dir file-regexp 'pr-txt-buffer)) | |
3675 | |
3676 | |
3677 ;;;###autoload | |
3678 (defun pr-txt-buffer () | |
3679 "Print buffer using text printer." | |
3680 (interactive) | |
3681 (cond ((pr-auto-mode-p) | |
3682 (pr-txt-mode)) | |
3683 ((pr-region-active-p) | |
3684 (pr-txt-region)) | |
3685 (t | |
3686 (pr-txt-print (point-min) (point-max))))) | |
3687 | |
3688 | |
3689 ;;;###autoload | |
3690 (defun pr-txt-region () | |
3691 "Print region using text printer." | |
3692 (interactive) | |
3693 (if (pr-auto-mode-p) | |
3694 (let ((pr-auto-region t)) | |
3695 (pr-txt-mode)) | |
3696 (pr-txt-print (point) (mark)))) | |
3697 | |
3698 | |
3699 ;;;###autoload | |
3700 (defun pr-txt-mode () | |
3701 "Print major mode using text printer." | |
3702 (interactive) | |
3703 (let ((args (pr-mode-alist-p))) | |
3704 (if args | |
3705 (funcall (car args) (nthcdr 2 args)) | |
3706 (ding) | |
3707 (message "`%s' major mode not declared." major-mode)))) | |
3708 | |
3709 | |
3710 ;;;###autoload | |
3711 (defun pr-despool-preview (&optional filename) | |
3712 "Preview spooled PostScript. | |
3713 | |
3714 Interactively, when you use a prefix argument (C-u), the command prompts the | |
3715 user for a file name, and saves the spooled PostScript image in that file | |
3716 instead of saving it in a temporary file. | |
3717 | |
3718 Noninteractively, the argument FILENAME is treated as follows: if it is nil, | |
3719 save the image in a temporary file. If FILENAME is a string, save the | |
3720 PostScript image in a file with that name." | |
3721 (interactive (list (ps-print-preprint current-prefix-arg))) | |
3722 (let ((file (pr-ps-file filename))) | |
3723 (when (stringp file) | |
3724 (pr-despool-print file) | |
3725 (pr-ps-file-preview file)))) | |
3726 | |
3727 | |
3728 ;;;###autoload | |
3729 (defun pr-despool-using-ghostscript (&optional filename) | |
3730 "Print spooled PostScript using ghostscript. | |
3731 | |
3732 Interactively, when you use a prefix argument (C-u), the command prompts the | |
3733 user for a file name, and saves the spooled PostScript image in that file | |
3734 instead of sending it to the printer. | |
3735 | |
3736 Noninteractively, the argument FILENAME is treated as follows: if it is nil, | |
3737 send the image to the printer. If FILENAME is a string, save the PostScript | |
3738 image in a file with that name." | |
3739 (interactive (list (ps-print-preprint current-prefix-arg))) | |
3740 (let ((file (pr-ps-file filename))) | |
3741 (when (stringp file) | |
3742 (pr-despool-print file) | |
3743 (pr-ps-file-using-ghostscript file) | |
3744 (or filename (pr-delete-file file))))) | |
3745 | |
3746 | |
3747 ;;;###autoload | |
3748 (defun pr-despool-print (&optional filename) | |
3749 "Send the spooled PostScript to the printer. | |
3750 | |
3751 Interactively, when you use a prefix argument (C-u), the command prompts the | |
3752 user for a file name, and saves the spooled PostScript image in that file | |
3753 instead of sending it to the printer. | |
3754 | |
3755 Noninteractively, the argument FILENAME is treated as follows: if it is nil, | |
3756 send the image to the printer. If FILENAME is a string, save the PostScript | |
3757 image in a file with that name." | |
3758 (interactive (list (ps-print-preprint current-prefix-arg))) | |
3759 (let ((ps-lpr-command (pr-command pr-ps-command)) | |
3760 (ps-lpr-switches pr-ps-switches) | |
3761 (ps-printer-name-option pr-ps-printer-switch) | |
3762 (ps-printer-name pr-ps-printer)) | |
3763 (ps-despool filename))) | |
3764 | |
3765 | |
3766 ;;;###autoload | |
3767 (defun pr-despool-ps-print (&optional filename) | |
3768 "Send the spooled PostScript to the printer or use ghostscript to print it. | |
3769 | |
3770 Interactively, when you use a prefix argument (C-u), the command prompts the | |
3771 user for a file name, and saves the spooled PostScript image in that file | |
3772 instead of sending it to the printer. | |
3773 | |
3774 Noninteractively, the argument FILENAME is treated as follows: if it is nil, | |
3775 send the image to the printer. If FILENAME is a string, save the PostScript | |
3776 image in a file with that name." | |
3777 (interactive (list (ps-print-preprint current-prefix-arg))) | |
3778 (if pr-print-using-ghostscript | |
3779 (pr-despool-using-ghostscript filename) | |
3780 (pr-despool-print filename))) | |
3781 | |
3782 | |
3783 ;;;###autoload | |
3784 (defun pr-ps-file-preview (filename) | |
3785 "Preview PostScript file FILENAME." | |
3786 (interactive (list (pr-ps-infile-preprint "Preview "))) | |
3787 (and (stringp filename) (file-exists-p filename) | |
3788 (let ((shell-file-name pr-shell-file-name)) | |
3789 (start-process-shell-command "PREVIEW" "*Messages*" | |
3790 (pr-command pr-gv-command) filename)))) | |
3791 | |
3792 | |
3793 ;;;###autoload | |
3794 (defun pr-ps-file-up-preview (n-up ifilename &optional ofilename) | |
3795 "Preview PostScript file FILENAME." | |
3796 (interactive (pr-interactive-n-up-inout "PS preview")) | |
3797 (let ((outfile (pr-ps-utility-args 'n-up 'ifilename 'ofilename | |
3798 "PS preview "))) | |
3799 (pr-ps-utility-process n-up ifilename outfile) | |
3800 (pr-ps-file-preview outfile))) | |
3801 | |
3802 | |
3803 ;;;###autoload | |
3804 (defun pr-ps-file-using-ghostscript (filename) | |
3805 "Print PostScript file FILENAME using ghostscript." | |
3806 (interactive (list (pr-ps-infile-preprint "Print preview "))) | |
3807 (and (stringp filename) (file-exists-p filename) | |
3808 (let* ((file (pr-expand-file-name filename)) | |
3809 (tempfile (pr-dosify-path (make-temp-name file)))) | |
3810 ;; gs use | |
3811 (pr-shell-command | |
3812 (concat (pr-command pr-gs-command) | |
3813 " -sDEVICE=" pr-gs-device | |
3814 " -r" (int-to-string pr-gs-resolution) | |
3815 " " (pr-switches-string pr-gs-switches "pr-gs-switches") | |
3816 " -sOutputFile=" tempfile " " file " -c quit")) | |
3817 ;; printing | |
3818 (pr-ps-file-print tempfile) | |
3819 ;; deleting | |
3820 (pr-delete-file tempfile)))) | |
3821 | |
3822 | |
3823 ;;;###autoload | |
3824 (defun pr-ps-file-print (filename) | |
3825 "Print PostScript file FILENAME." | |
3826 (interactive (list (pr-ps-infile-preprint "Print "))) | |
3827 (and (stringp filename) (file-exists-p filename) | |
3828 ;; printing | |
3829 (let ((file (pr-expand-file-name filename))) | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3830 (if (string= pr-ps-command "") |
49646 | 3831 (let ((ps-spool-buffer (get-buffer-create ps-spool-buffer-name))) |
3832 (save-excursion | |
3833 (set-buffer ps-spool-buffer) | |
3834 (erase-buffer) | |
3835 (insert-file-contents-literally file)) | |
3836 (pr-despool-print)) | |
3837 (pr-shell-command | |
3838 (concat (pr-command pr-ps-command) " " | |
3839 (pr-switches-string pr-ps-switches "pr-gs-switches") " " | |
3840 (if (string-match "cp" pr-ps-command) | |
3841 ;; for "cp" (cmd in out) | |
3842 (concat "\"" file "\" " | |
3843 pr-ps-printer-switch pr-ps-printer) | |
3844 ;; else, for others (cmd out in) | |
3845 (concat pr-ps-printer-switch pr-ps-printer | |
3846 " \"" file "\"")))))))) | |
3847 | |
3848 | |
3849 ;;;###autoload | |
3850 (defun pr-ps-file-ps-print (filename) | |
3851 "Send PostScript file FILENAME to printer or use ghostscript to print it." | |
3852 (interactive (list (pr-ps-infile-preprint | |
3853 (if pr-print-using-ghostscript | |
3854 "Print preview " | |
3855 "Print ")))) | |
3856 (if pr-print-using-ghostscript | |
3857 (pr-ps-file-using-ghostscript filename) | |
3858 (pr-ps-file-print filename))) | |
3859 | |
3860 | |
3861 ;;;###autoload | |
3862 (defun pr-ps-file-up-ps-print (n-up ifilename &optional ofilename) | |
3863 "Process a PostScript file IFILENAME and send it to printer. | |
3864 | |
3865 Interactively, the command prompts for N-UP printing number, for an input | |
3866 PostScript file IFILENAME and, when you use a prefix argument (C-u), the | |
3867 command prompts the user for an output PostScript file name OFILENAME, and | |
3868 saves the PostScript image in that file instead of sending it to the printer. | |
3869 | |
3870 Noninteractively, if N-UP is nil, prompts for N-UP printing number. The | |
3871 argument IFILENAME is treated as follows: if it's t, prompts for an input | |
3872 PostScript file name; otherwise, it *must* be a string that it's an input | |
3873 PostScript file name. The argument OFILENAME is treated as follows: if it's | |
3874 nil, send the image to the printer. If OFILENAME is a string, save the | |
3875 PostScript image in a file with that name. If OFILENAME is t, prompts for a | |
3876 file name." | |
3877 (interactive (pr-interactive-n-up-inout | |
3878 (if pr-print-using-ghostscript | |
3879 "PS print GS" | |
3880 "PS print"))) | |
3881 (let ((outfile (pr-ps-utility-args 'n-up 'ifilename 'ofilename | |
3882 (if pr-print-using-ghostscript | |
3883 "PS print GS " | |
3884 "PS print ")))) | |
3885 (pr-ps-utility-process n-up ifilename outfile) | |
3886 (unless ofilename | |
3887 (pr-ps-file-ps-print outfile) | |
3888 (pr-delete-file outfile)))) | |
3889 | |
3890 | |
3891 ;;;###autoload | |
3892 (defun pr-toggle-file-duplex () | |
3893 "Toggle duplex for PostScript file." | |
3894 (interactive) | |
3895 (pr-toggle 'pr-file-duplex "PS file duplex" nil 7 5 nil | |
3896 '("PostScript Print" "File"))) | |
3897 | |
3898 | |
3899 ;;;###autoload | |
3900 (defun pr-toggle-file-tumble () | |
3901 "Toggle tumble for PostScript file. | |
3902 | |
3903 If tumble is off, produces a printing suitable for binding on the left or | |
3904 right. | |
3905 If tumble is on, produces a printing suitable for binding at the top or | |
3906 bottom." | |
3907 (interactive) | |
3908 (pr-toggle 'pr-file-tumble "PS file tumble" nil 8 5 nil | |
3909 '("PostScript Print" "File"))) | |
3910 | |
3911 | |
3912 ;;;###autoload | |
3913 (defun pr-toggle-file-landscape () | |
3914 "Toggle landscape for PostScript file." | |
3915 (interactive) | |
3916 (pr-toggle 'pr-file-landscape "PS file landscape" nil 6 5 nil | |
3917 '("PostScript Print" "File"))) | |
3918 | |
3919 | |
3920 ;;;###autoload | |
3921 (defun pr-toggle-ghostscript () | |
3922 "Toggle printing using ghostscript." | |
3923 (interactive) | |
3924 (pr-toggle 'pr-print-using-ghostscript "Printing using ghostscript" | |
3925 'postscript-process 2 12 'toggle)) | |
3926 | |
3927 | |
3928 ;;;###autoload | |
3929 (defun pr-toggle-faces () | |
3930 "Toggle printing with faces." | |
3931 (interactive) | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3932 (pr-toggle 'pr-faces-p "Printing with faces" |
49646 | 3933 'postscript-process 1 12 'toggle)) |
3934 | |
3935 | |
3936 ;;;###autoload | |
3937 (defun pr-toggle-spool () | |
3938 "Toggle spooling." | |
3939 (interactive) | |
3940 (pr-toggle 'pr-spool-p "Spooling printing" | |
3941 'postscript-process 0 12 'toggle)) | |
3942 | |
3943 | |
3944 ;;;###autoload | |
3945 (defun pr-toggle-duplex () | |
3946 "Toggle duplex." | |
3947 (interactive) | |
3948 (pr-toggle 'ps-spool-duplex "Printing duplex" | |
3949 'postcsript-options 5 12 'toggle)) | |
3950 | |
3951 | |
3952 ;;;###autoload | |
3953 (defun pr-toggle-tumble () | |
3954 "Toggle tumble. | |
3955 | |
3956 If tumble is off, produces a printing suitable for binding on the left or | |
3957 right. | |
3958 If tumble is on, produces a printing suitable for binding at the top or | |
3959 bottom." | |
3960 (interactive) | |
3961 (pr-toggle 'ps-spool-tumble "Tumble" | |
3962 'postscript-options 6 12 'toggle)) | |
3963 | |
3964 | |
3965 ;;;###autoload | |
3966 (defun pr-toggle-landscape () | |
3967 "Toggle landscape." | |
3968 (interactive) | |
3969 (pr-toggle 'ps-landscape-mode "Landscape" | |
3970 'postscript-options 0 12 'toggle)) | |
3971 | |
3972 | |
3973 ;;;###autoload | |
3974 (defun pr-toggle-upside-down () | |
3975 "Toggle upside-down." | |
3976 (interactive) | |
3977 (pr-toggle 'ps-print-upside-down "Upside-Down" | |
3978 'postscript-options 7 12 'toggle)) | |
3979 | |
3980 | |
3981 ;;;###autoload | |
3982 (defun pr-toggle-line () | |
3983 "Toggle line number." | |
3984 (interactive) | |
3985 (pr-toggle 'ps-line-number "Line number" | |
3986 'postscript-options 3 12 'toggle)) | |
3987 | |
3988 | |
3989 ;;;###autoload | |
3990 (defun pr-toggle-zebra () | |
3991 "Toggle zebra stripes." | |
3992 (interactive) | |
3993 (pr-toggle 'ps-zebra-stripes "Zebra stripe" | |
3994 'postscript-options 4 12 'toggle)) | |
3995 | |
3996 | |
3997 ;;;###autoload | |
3998 (defun pr-toggle-header () | |
3999 "Toggle printing header." | |
4000 (interactive) | |
4001 (pr-toggle 'ps-print-header "Print header" | |
4002 'postscript-options 1 12 'toggle)) | |
4003 | |
4004 | |
4005 ;;;###autoload | |
4006 (defun pr-toggle-header-frame () | |
4007 "Toggle printing header frame." | |
4008 (interactive) | |
4009 (pr-toggle 'ps-print-header-frame "Print header frame" | |
4010 'postscript-options 2 12 'toggle)) | |
4011 | |
4012 | |
4013 ;;;###autoload | |
4014 (defun pr-toggle-lock () | |
4015 "Toggle menu lock." | |
4016 (interactive) | |
4017 (pr-toggle 'pr-menu-lock "Menu lock" | |
4018 'printing 2 12 'toggle)) | |
4019 | |
4020 | |
4021 ;;;###autoload | |
4022 (defun pr-toggle-region () | |
4023 "Toggle auto region." | |
4024 (interactive) | |
4025 (pr-toggle 'pr-auto-region "Auto region" | |
4026 'printing 0 12 'toggle)) | |
4027 | |
4028 | |
4029 ;;;###autoload | |
4030 (defun pr-toggle-mode () | |
4031 "Toggle auto mode." | |
4032 (interactive) | |
4033 (pr-toggle 'pr-auto-mode "Auto mode" | |
4034 'printing 1 12 'toggle)) | |
4035 | |
4036 | |
4037 ;;;###autoload | |
4038 (defun pr-customize (&rest ignore) | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4039 "Customization of the `printing' group." |
49646 | 4040 (interactive) |
4041 (customize-group 'printing)) | |
4042 | |
4043 | |
4044 ;;;###autoload | |
4045 (defun lpr-customize (&rest ignore) | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4046 "Customization of the `lpr' group." |
49646 | 4047 (interactive) |
4048 (customize-group 'lpr)) | |
4049 | |
4050 | |
4051 ;;;###autoload | |
4052 (defun pr-help (&rest ignore) | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4053 "Help for the printing package." |
49646 | 4054 (interactive) |
4055 (pr-show-setup pr-help-message "*Printing Help*")) | |
4056 | |
4057 | |
4058 ;;;###autoload | |
4059 (defun pr-ps-name () | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4060 "Interactively select a PostScript printer." |
49646 | 4061 (interactive) |
4062 (pr-menu-set-ps-title | |
4063 (pr-complete-alist "PostScript printer" pr-ps-printer-alist pr-ps-name))) | |
4064 | |
4065 | |
4066 ;;;###autoload | |
4067 (defun pr-txt-name () | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4068 "Interactively select a text printer." |
49646 | 4069 (interactive) |
4070 (pr-menu-set-txt-title | |
4071 (pr-complete-alist "Text printer" pr-txt-printer-alist pr-txt-name))) | |
4072 | |
4073 | |
4074 ;;;###autoload | |
4075 (defun pr-ps-utility () | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4076 "Interactively select a PostScript utility." |
49646 | 4077 (interactive) |
4078 (pr-menu-set-utility-title | |
4079 (pr-complete-alist "Postscript utility" pr-ps-utility-alist pr-ps-utility))) | |
4080 | |
4081 | |
4082 ;;;###autoload | |
4083 (defun pr-show-ps-setup (&rest ignore) | |
4084 "Show current ps-print settings." | |
4085 (interactive) | |
4086 (pr-show-setup (ps-setup) "*PS Setup*")) | |
4087 | |
4088 | |
4089 ;;;###autoload | |
4090 (defun pr-show-pr-setup (&rest ignore) | |
4091 "Show current printing settings." | |
4092 (interactive) | |
4093 (pr-show-setup (pr-setup) "*PR Setup*")) | |
4094 | |
4095 | |
4096 ;;;###autoload | |
4097 (defun pr-show-lpr-setup (&rest ignore) | |
4098 "Show current lpr settings." | |
4099 (interactive) | |
4100 (pr-show-setup (lpr-setup) "*LPR Setup*")) | |
4101 | |
4102 | |
4103 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
4104 ;; Fast Commands | |
4105 | |
4106 | |
4107 ;;;###autoload | |
4108 (defun pr-ps-fast-fire (n-up &optional select) | |
4109 "Fast fire function for PostScript printing. | |
4110 | |
4111 If a region is active, the region will be printed instead of the whole buffer. | |
4112 Also if the current major-mode is defined in `pr-mode-alist', the settings in | |
4113 `pr-mode-alist' will be used, that is, the current buffer or region will be | |
4114 printed using `pr-ps-mode-ps-print'. | |
4115 | |
4116 | |
4117 Interactively, you have the following situations: | |
4118 | |
4119 M-x pr-ps-fast-fire RET | |
4120 The command prompts the user for a N-UP value and printing will | |
4121 immediatelly be done using the current active printer. | |
4122 | |
4123 C-u M-x pr-ps-fast-fire RET | |
4124 C-u 0 M-x pr-ps-fast-fire RET | |
4125 The command prompts the user for a N-UP value and also for a current | |
4126 PostScript printer, then printing will immediatelly be done using the new | |
4127 current active printer. | |
4128 | |
4129 C-u 1 M-x pr-ps-fast-fire RET | |
4130 The command prompts the user for a N-UP value and also for a file name, | |
4131 and saves the PostScript image in that file instead of sending it to the | |
4132 printer. | |
4133 | |
4134 C-u 2 M-x pr-ps-fast-fire RET | |
4135 The command prompts the user for a N-UP value, then for a current | |
4136 PostScript printer and, finally, for a file name. Then change the active | |
4137 printer to that choosen by user and saves the PostScript image in | |
4138 that file instead of sending it to the printer. | |
4139 | |
4140 | |
4141 Noninteractively, the argument N-UP should be a positive integer greater than | |
4142 zero and the argument SELECT is treated as follows: | |
4143 | |
4144 If it's nil, send the image to the printer. | |
4145 | |
4146 If it's a list or an integer lesser or equal to zero, the command prompts | |
4147 the user for a current PostScript printer, then printing will immediatelly | |
4148 be done using the new current active printer. | |
4149 | |
4150 If it's an integer equal to 1, the command prompts the user for a file name | |
4151 and saves the PostScript image in that file instead of sending it to the | |
4152 printer. | |
4153 | |
4154 If it's an integer greater or equal to 2, the command prompts the user for a | |
4155 current PostScript printer and for a file name. Then change the active | |
4156 printer to that choosen by user and saves the PostScript image in that file | |
4157 instead of sending it to the printer. | |
4158 | |
4159 If it's a symbol which it's defined in `pr-ps-printer-alist', it's the new | |
4160 active printer and printing will immediatelly be done using the new active | |
4161 printer. | |
4162 | |
4163 Otherwise, send the image to the printer. | |
4164 | |
4165 | |
4166 Note that this command always behaves as if `pr-auto-region' and `pr-auto-mode' | |
4167 are both set to t." | |
4168 (interactive (list (pr-interactive-n-up (pr-prompt-gs "PS print fast")) | |
4169 current-prefix-arg)) | |
4170 (let ((pr-auto-region t) | |
4171 (pr-auto-mode t) | |
4172 filename) | |
4173 (cond ((null select)) | |
4174 ((listp select) | |
4175 (pr-ps-name)) | |
4176 ((and (symbolp select) | |
4177 (assq select pr-ps-printer-alist)) | |
4178 (pr-menu-set-ps-title select)) | |
4179 ((integerp select) | |
4180 (and (/= select 1) | |
4181 (pr-ps-name)) | |
4182 (and (>= select 1) (not pr-spool-p) | |
4183 (setq filename (pr-ps-outfile-preprint | |
4184 (if pr-print-using-ghostscript | |
4185 "Fast GS " | |
4186 "Fast ")))))) | |
4187 (pr-ps-buffer-ps-print | |
4188 (if (integerp n-up) | |
4189 (min (max n-up 1) 100) | |
4190 (error "n-up must be an integer greater than zero.")) | |
4191 filename))) | |
4192 | |
4193 | |
4194 ;;;###autoload | |
4195 (defun pr-txt-fast-fire (&optional select-printer) | |
4196 "Fast fire function for text printing. | |
4197 | |
4198 If a region is active, the region will be printed instead of the whole buffer. | |
4199 Also if the current major-mode is defined in `pr-mode-alist', the settings in | |
4200 `pr-mode-alist' will be used, that is, the current buffer or region will be | |
4201 printed using `pr-txt-mode'. | |
4202 | |
4203 Interactively, when you use a prefix argument (C-u), the command prompts the | |
4204 user for a new active text printer. | |
4205 | |
4206 Noninteractively, the argument SELECT-PRINTER is treated as follows: | |
4207 | |
4208 If it's nil, the printing is sent to the current active text printer. | |
4209 | |
4210 If it's a symbol which it's defined in `pr-txt-printer-alist', it's the new | |
4211 active printer and printing will immediatelly be done using the new active | |
4212 printer. | |
4213 | |
4214 If it's non-nil, the command prompts the user for a new active text printer. | |
4215 | |
4216 Note that this command always behaves as if `pr-auto-region' and `pr-auto-mode' | |
4217 are both set to t." | |
4218 (interactive (list current-prefix-arg)) | |
4219 (cond ((null select-printer)) | |
4220 ((and (symbolp select-printer) | |
4221 (assq select-printer pr-txt-printer-alist)) | |
4222 (pr-menu-set-txt-title select-printer)) | |
4223 (t | |
4224 (pr-txt-name))) | |
4225 (let ((pr-auto-region t) | |
4226 (pr-auto-mode t)) | |
4227 (pr-txt-buffer))) | |
4228 | |
4229 | |
4230 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
4231 ;; Utilities | |
4232 | |
4233 | |
4234 (defun pr-setup () | |
4235 "Return the current `printing' setup. | |
4236 | |
4237 This is *not* an interactive command. | |
4238 One way to see `printing' setup is to switch to a *Scratch* buffer and type: | |
4239 | |
4240 M-: (insert (pr-setup)) RET | |
4241 | |
4242 Or choose the menu option Printing/Show Settings/printing." | |
4243 (let (ps-prefix-quote) | |
4244 (mapconcat | |
4245 #'ps-print-quote | |
4246 (list | |
4247 (concat "\n;;; printing.el version " pr-version "\n") | |
4248 '(19 . pr-shell-file-name) | |
4249 '(19 . pr-path-style) | |
4250 '(19 . pr-path-alist) | |
4251 nil | |
4252 '(21 . pr-txt-name) | |
4253 '(21 . pr-txt-printer-alist) | |
4254 nil | |
4255 '(20 . pr-ps-name) | |
4256 '(20 . pr-ps-printer-alist) | |
4257 nil | |
4258 '(20 . pr-temp-dir) | |
4259 '(20 . pr-ps-temp-file) | |
4260 '(20 . pr-delete-temp-file) | |
4261 '(20 . pr-list-directory) | |
4262 nil | |
4263 '(17 . pr-gv-command) | |
4264 '(17 . pr-gs-command) | |
4265 '(17 . pr-gs-switches) | |
4266 '(17 . pr-gs-device) | |
4267 '(17 . pr-gs-resolution) | |
4268 nil | |
4269 '(27 . pr-print-using-ghostscript) | |
4270 '(27 . pr-faces-p) | |
4271 '(27 . pr-spool-p) | |
4272 '(27 . pr-file-landscape) | |
4273 '(27 . pr-file-duplex) | |
4274 '(27 . pr-file-tumble) | |
4275 '(27 . pr-auto-region) | |
4276 '(27 . pr-auto-mode) | |
4277 nil | |
4278 '(20 . pr-ps-utility) | |
4279 '(20 . pr-ps-utility-alist) | |
4280 nil | |
4281 '(14 . pr-mode-alist) | |
4282 nil | |
4283 '(20 . pr-menu-lock) | |
4284 '(20 . pr-menu-char-height) | |
4285 '(20 . pr-menu-char-width) | |
4286 nil | |
4287 '(20 . pr-setting-database) | |
4288 nil | |
4289 '(22 . pr-visible-entry-list) | |
4290 nil | |
4291 '(22 . pr-buffer-verbose) | |
4292 '(22 . pr-buffer-name) | |
4293 '(22 . pr-buffer-name-ignore) | |
4294 ")\n\n;;; printing.el - end of settings\n") | |
4295 "\n"))) | |
4296 | |
4297 | |
4298 (defun lpr-setup () | |
4299 "Return the current `lpr' setup. | |
4300 | |
4301 This is *not* an interactive command. | |
4302 One way to see `lpr' setup is to switch to a *Scratch* buffer and type: | |
4303 | |
4304 M-: (insert (lpr-setup)) RET | |
4305 | |
4306 Or choose the menu option Printing/Show Settings/lpr." | |
4307 (let (ps-prefix-quote) | |
4308 (mapconcat | |
4309 #'ps-print-quote | |
4310 '("\n;;; lpr.el settings\n" | |
4311 (25 . printer-name) | |
4312 (25 . lpr-switches) | |
4313 (25 . lpr-add-switches) | |
4314 (25 . lpr-command) | |
4315 (25 . lpr-headers-switches) | |
4316 (25 . print-region-function) | |
4317 (25 . lpr-page-header-program) | |
4318 (25 . lpr-page-header-switches) | |
4319 ")\n\n;;; lpr.el - end of settings\n") | |
4320 "\n"))) | |
4321 | |
4322 | |
4323 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
4324 ;; mh-e (adapted from mh-e-init.el -- Tom Vogels <tov@ece.cmu.edu>) | |
4325 | |
4326 | |
4327 (defalias 'pr-mh-get-msg-num 'mh-get-msg-num) | |
4328 (defalias 'pr-mh-show 'mh-show) | |
4329 (defalias 'pr-mh-start-of-uncleaned-message 'mh-start-of-uncleaned-message) | |
4330 (defvar mh-show-buffer nil) | |
4331 | |
4332 | |
4333 (defun pr-article-date () | |
4334 "Find the date of an article or mail message in current buffer. | |
4335 Return only the dayname, if present, weekday, month, and year." | |
4336 (save-excursion | |
4337 (goto-char (point-min)) | |
4338 (if (re-search-forward | |
4339 "^Date:[ \t]+\\(\\([A-Za-z]+, \\)?[0-9]+ [A-Za-z]+ [0-9]+\\)" nil t) | |
4340 (buffer-substring (match-beginning 1) (match-end 1)) | |
4341 (format-time-string "%Y/%m/%d")))) | |
4342 | |
4343 | |
4344 (defun pr-mh-current-message () | |
4345 "Go to mh-inbox current message." | |
4346 (let ((msg (or (pr-mh-get-msg-num nil) 0))) | |
4347 (pr-mh-show) | |
4348 (set-buffer mh-show-buffer) | |
4349 (goto-char (point-min)) | |
4350 (pr-mh-start-of-uncleaned-message) | |
4351 (message "Printing message %d" msg))) | |
4352 | |
4353 | |
4354 (defun pr-mh-print-1 (n-up filename header-list) | |
4355 "Print mh-inbox current message in PostScript." | |
4356 (save-excursion | |
4357 (save-window-excursion | |
4358 (pr-mh-current-message) | |
4359 (pr-mode-print n-up filename header-list (point))))) | |
4360 | |
4361 | |
4362 (defun pr-mh-lpr-1 (header-list) | |
4363 "Print mh-inbox current message in text printer." | |
4364 (save-excursion | |
4365 (save-window-excursion | |
4366 (pr-mh-current-message) | |
4367 (pr-mode-lpr header-list (point))))) | |
4368 | |
4369 | |
4370 (defalias 'pr-mh-print-2 'pr-mode-print) | |
4371 | |
4372 | |
4373 (defalias 'pr-mh-lpr-2 'pr-mode-lpr) | |
4374 | |
4375 | |
4376 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
4377 ;; rmail (hacked from ps-print.el) | |
4378 | |
4379 | |
4380 (defun pr-rmail-lpr (header-list) | |
4381 "Print RMAIL current message in text printer." | |
4382 (pr-lpr-message-from-summary header-list | |
4383 'rmail-buffer 'rmail-summary-buffer)) | |
4384 | |
4385 | |
4386 (defun pr-rmail-print (n-up filename header-list) | |
4387 "Print RMAIL current message in PostScript." | |
4388 (pr-ps-message-from-summary n-up filename header-list | |
4389 'rmail-buffer 'rmail-summary-buffer)) | |
4390 | |
4391 | |
4392 (defun pr-ps-message-from-summary (n-up filename header-list | |
4393 summary-buffer summary-default) | |
4394 "Print current message in PostScript." | |
4395 (let ((buf (or (and (boundp summary-buffer) | |
4396 (symbol-value summary-buffer)) | |
4397 (symbol-value summary-default)))) | |
4398 (and (get-buffer buf) | |
4399 (save-excursion | |
4400 (set-buffer buf) | |
4401 (pr-mode-print n-up filename header-list))))) | |
4402 | |
4403 | |
4404 (defun pr-lpr-message-from-summary (header-list summary-buffer summary-default) | |
4405 "Print current message in text printer." | |
4406 (let ((buf (or (and (boundp summary-buffer) | |
4407 (symbol-value summary-buffer)) | |
4408 (symbol-value summary-default)))) | |
4409 (and (get-buffer buf) | |
4410 (save-excursion | |
4411 (set-buffer buf) | |
4412 (pr-mode-lpr header-list))))) | |
4413 | |
4414 | |
4415 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
4416 ;; gnus (hacked from ps-print.el) | |
4417 | |
4418 | |
4419 (defvar pr-gnus-article "*Article*") | |
4420 | |
4421 | |
4422 (defun pr-gnus-print (n-up filename header-list) | |
4423 "Print *Article* current message in PostScript." | |
4424 (pr-ps-message-from-summary n-up filename header-list | |
4425 'gnus-article-buffer 'pr-gnus-article)) | |
4426 | |
4427 | |
4428 (defun pr-gnus-lpr (header-list) | |
4429 "Print *Article* current message in text printer." | |
4430 (pr-lpr-message-from-summary header-list | |
4431 'gnus-article-buffer 'pr-gnus-article)) | |
4432 | |
4433 | |
4434 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
4435 ;; vm (hacked from ps-print.el) | |
4436 | |
4437 | |
4438 (defvar pr-vm-summary "") | |
4439 | |
4440 | |
4441 (defun pr-vm-print (n-up filename header-list) | |
4442 "Print current vm message in PostScript." | |
4443 (pr-ps-message-from-summary n-up filename header-list | |
4444 'vm-mail-buffer 'pr-vm-summary)) | |
4445 | |
4446 | |
4447 (defun pr-vm-lpr (header-list) | |
4448 "Print current vm message in text printer." | |
4449 (pr-lpr-message-from-summary header-list | |
4450 'vm-mail-buffer 'pr-vm-summary)) | |
4451 | |
4452 | |
4453 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
4454 ;; Mode Functions | |
4455 | |
4456 | |
4457 (defun pr-ps-mode (n-up filename) | |
4458 "If current major mode is declared, print it in PostScript." | |
4459 (let ((args (pr-mode-alist-p))) | |
4460 (if args | |
4461 (let ((fun (cdr args))) | |
4462 (funcall (car fun) n-up filename (cdr fun)) | |
4463 t) | |
4464 (ding) | |
4465 (message "`%s' major mode not declared." major-mode) | |
4466 nil))) | |
4467 | |
4468 | |
4469 (defmacro pr-local-variable (header-list &rest body) | |
4470 `(save-excursion | |
4471 (let ((ps-header-lines (or (nth 0 ,header-list) ps-header-lines)) | |
4472 (ps-left-header (or (nth 1 ,header-list) ps-left-header)) | |
4473 (ps-right-header (or (nth 2 ,header-list) ps-right-header)) | |
4474 ps-razzle-dazzle) | |
4475 (let ((local-var-list (pr-eval-local-alist (nthcdr 4 ,header-list)))) | |
4476 ,@body | |
4477 (and (nth 3 ,header-list) | |
4478 (pr-kill-local-variable local-var-list)))))) | |
4479 | |
4480 | |
4481 (defun pr-mode-print (n-up filename header-list &optional from to) | |
4482 "Print current major mode in PostScript." | |
4483 (pr-local-variable | |
4484 header-list | |
4485 (let ((file (pr-ps-file filename)) | |
4486 (start (cond (from) | |
4487 ((pr-region-active-p) (region-beginning)) | |
4488 (t nil) | |
4489 ))) | |
4490 (pr-text2ps (pr-region-active-symbol start) n-up file start | |
4491 (cond (to) | |
4492 ((pr-region-active-p) (region-end)) | |
4493 (from (point-max)) | |
4494 )) | |
4495 (unless (or pr-spool-p filename) | |
4496 (pr-ps-file-print file) | |
4497 (pr-delete-file file))))) | |
4498 | |
4499 | |
4500 (defun pr-mode-lpr (header-list &optional from to) | |
4501 "Print current major mode in text printer." | |
4502 (pr-local-variable | |
4503 header-list | |
4504 (pr-txt-print (cond (from) | |
4505 ((pr-region-active-p) (region-beginning)) | |
4506 (t (point-min))) | |
4507 (cond (to) | |
4508 ((pr-region-active-p) (region-end)) | |
4509 (t (point-max)))))) | |
4510 | |
4511 | |
4512 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
4513 ;; Menu Lock | |
4514 | |
4515 | |
4516 (defconst pr-menu-entry-alist | |
4517 '((postscript . 3) | |
4518 (text . 3) | |
4519 (postscript-options . 9) | |
4520 (postscript-process . 3) | |
4521 (printing . 3) | |
4522 (help . 3) | |
4523 ) | |
4524 "Alist that associates menu part with number of items per part. | |
4525 | |
4526 It's used by `pr-menu-index'. | |
4527 | |
4528 Each element has the form: | |
4529 | |
4530 (MENU-PART . NUMBER-OF-ITEMS) | |
4531 | |
4532 See `pr-visible-entry-alist'.") | |
4533 | |
4534 | |
4535 (defun pr-menu-index (entry index) | |
4536 (let ((base-list | |
4537 (cond ((eq entry 'text) | |
4538 '(postscript)) | |
4539 ((eq entry 'postscript-options) | |
4540 '(postscript text)) | |
4541 ((eq entry 'postscript-process) | |
4542 '(postscript text postscript-options)) | |
4543 ((eq entry 'printing) | |
4544 '(postscript text postscript-options postscript-process)) | |
4545 (t | |
4546 nil) | |
4547 )) | |
4548 key) | |
4549 (while base-list | |
4550 (setq key (car base-list) | |
4551 base-list (cdr base-list)) | |
4552 (and (pr-visible-p key) | |
4553 (setq index (+ index | |
4554 (cdr (assq key pr-menu-entry-alist))))))) | |
4555 (+ index 2)) | |
4556 | |
4557 | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4558 (defvar pr-menu-position nil) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4559 (defvar pr-menu-state nil) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4560 |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4561 |
49646 | 4562 (eval-and-compile |
4563 (cond | |
4564 ((eq ps-print-emacs-type 'xemacs) | |
4565 ;; XEmacs | |
4566 (defun pr-menu-position (entry index horizontal) | |
4567 (pr-x-make-event | |
4568 'button-release | |
4569 (list 'button 1 | |
4570 'x (- (pr-x-event-x-pixel current-mouse-event) ; X | |
4571 (* horizontal pr-menu-char-width)) | |
4572 'y (- (pr-x-event-y-pixel current-mouse-event) ; Y | |
4573 (* (pr-menu-index entry index) pr-menu-char-height))))) | |
4574 ) | |
4575 (ps-windows-system | |
4576 ;; GNU Emacs for Windows 9x/NT | |
4577 (defun pr-menu-position (entry index horizontal) | |
4578 (let ((pos (cdr (pr-e-mouse-pixel-position)))) | |
4579 (list | |
54636
be1994e2a5ce
New version 6.7.3.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54621
diff
changeset
|
4580 (list (or (car pos) 0) ; X |
be1994e2a5ce
New version 6.7.3.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54621
diff
changeset
|
4581 (- (or (cdr pos) 0) ; Y |
49646 | 4582 (* (pr-menu-index entry index) pr-menu-char-height))) |
4583 (selected-frame)))) ; frame | |
4584 ) | |
4585 (t | |
4586 ;; GNU Emacs | |
4587 (defun pr-menu-position (entry index horizontal) | |
4588 (let ((pos (cdr (pr-e-mouse-pixel-position)))) | |
4589 (list | |
54636
be1994e2a5ce
New version 6.7.3.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54621
diff
changeset
|
4590 (list (- (or (car pos) 0) ; X |
49646 | 4591 (* horizontal pr-menu-char-width)) |
54636
be1994e2a5ce
New version 6.7.3.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54621
diff
changeset
|
4592 (- (or (cdr pos) 0) ; Y |
49646 | 4593 (* (pr-menu-index entry index) pr-menu-char-height))) |
4594 (selected-frame)))) ; frame | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4595 )) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4596 |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4597 (cond |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4598 ((eq ps-print-emacs-type 'emacs) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4599 ;; GNU Emacs |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4600 (defun pr-menu-lookup (path) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4601 (let ((ipath pr-menu-bar)) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4602 (lookup-key global-map |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4603 (if path |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4604 (vconcat ipath |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4605 (mapcar 'pr-get-symbol |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4606 (if (listp path) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4607 path |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4608 (list path)))) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4609 ipath)))) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4610 |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4611 ;; GNU Emacs |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4612 (defun pr-menu-lock (entry index horizontal state path) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4613 (when (and (not (interactive-p)) pr-menu-lock) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4614 (or (and pr-menu-position (eq state pr-menu-state)) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4615 (setq pr-menu-position (pr-menu-position entry index horizontal) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4616 pr-menu-state state)) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4617 (let* ((menu (pr-menu-lookup path)) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4618 (result (x-popup-menu pr-menu-position menu))) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4619 (and result |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4620 (let ((command (lookup-key menu (vconcat result)))) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4621 (if (fboundp command) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4622 (funcall command) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4623 (eval command))))) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4624 (setq pr-menu-position nil)))) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4625 |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4626 |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4627 ((eq ps-print-emacs-type 'xemacs) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4628 ;; XEmacs |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4629 (defun pr-menu-lookup (path) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4630 (car (pr-x-find-menu-item current-menubar (cons "Printing" path)))) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4631 |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4632 ;; XEmacs |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4633 (defun pr-menu-lock (entry index horizontal state path) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4634 (when (and (not (interactive-p)) pr-menu-lock) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4635 (or (and pr-menu-position (eq state pr-menu-state)) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4636 (setq pr-menu-position (pr-menu-position entry index horizontal) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4637 pr-menu-state state)) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4638 (let* ((menu (pr-menu-lookup path)) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4639 (result (pr-x-get-popup-menu-response menu pr-menu-position))) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4640 (and (pr-x-misc-user-event-p result) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4641 (funcall (pr-x-event-function result) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4642 (pr-x-event-object result)))) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4643 (setq pr-menu-position nil)))))) |
49646 | 4644 |
4645 | |
4646 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
4647 ;; Printer & Utility Selection | |
4648 | |
4649 | |
4650 (defun pr-update-var (var-sym alist) | |
4651 (or (assq (symbol-value var-sym) alist) | |
4652 (set var-sym (car (car alist))))) | |
4653 | |
4654 | |
4655 (defun pr-update-menus (&optional force) | |
4656 "Update utility, PostScript and text printer menus. | |
4657 | |
4658 If FORCE is non-nil, update menus doesn't matter if `pr-ps-printer-alist', | |
4659 `pr-txt-printer-alist' or `pr-ps-utility-alist' were modified or not; | |
4660 otherwise, update PostScript printer menu iff `pr-ps-printer-menu-modified' is | |
4661 non-nil, update text printer menu iff `pr-txt-printer-menu-modified' is | |
4662 non-nil, and update PostScript File menus iff `pr-ps-utility-menu-modified' is | |
4663 non-nil." | |
54621
14d929e67a70
Modify interactive declaration.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54333
diff
changeset
|
4664 (interactive "P") |
49646 | 4665 (pr-update-var 'pr-ps-name pr-ps-printer-alist) |
4666 (pr-update-var 'pr-txt-name pr-txt-printer-alist) | |
4667 (pr-update-var 'pr-ps-utility pr-ps-utility-alist) | |
4668 (pr-do-update-menus force)) | |
4669 | |
4670 | |
4671 (defvar pr-ps-printer-menu-modified t | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4672 "Non-nil means `pr-ps-printer-alist' was modified and we need to update menu.") |
49646 | 4673 (defvar pr-txt-printer-menu-modified t |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4674 "Non-nil means `pr-txt-printer-alist' was modified and we need to update menu.") |
49646 | 4675 (defvar pr-ps-utility-menu-modified t |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4676 "Non-nil means `pr-ps-utility-alist' was modified and we need to update menu.") |
49646 | 4677 |
4678 | |
4679 (defconst pr-even-or-odd-alist | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4680 '((nil . "Print All Pages") |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4681 (even-page . "Print Even Pages") |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4682 (odd-page . "Print Odd Pages") |
49646 | 4683 (even-sheet . "Print Even Sheets") |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4684 (odd-sheet . "Print Odd Sheets"))) |
49646 | 4685 |
4686 | |
4687 (defun pr-menu-create (name alist var-sym fun entry index) | |
4688 (cons name | |
4689 (mapcar | |
4690 #'(lambda (elt) | |
4691 (let ((sym (car elt))) | |
4692 (vector | |
4693 (symbol-name sym) | |
4694 (list fun (list 'quote sym) nil (list 'quote entry) index) | |
4695 :style 'radio | |
4696 :selected (list 'eq var-sym (list 'quote sym))))) | |
4697 alist))) | |
4698 | |
4699 | |
4700 (eval-and-compile | |
4701 (cond | |
4702 ((eq ps-print-emacs-type 'emacs) | |
4703 ;; GNU Emacs | |
4704 (defalias 'pr-update-mode-line 'force-mode-line-update) | |
4705 | |
4706 ;; GNU Emacs | |
4707 (defun pr-do-update-menus (&optional force) | |
4708 (pr-menu-alist pr-ps-printer-alist | |
4709 'pr-ps-name | |
4710 'pr-menu-set-ps-title | |
4711 "PostScript Printers" | |
4712 'pr-ps-printer-menu-modified | |
4713 force | |
4714 "PostScript Printers" | |
4715 'postscript 2) | |
4716 (pr-menu-alist pr-txt-printer-alist | |
4717 'pr-txt-name | |
4718 'pr-menu-set-txt-title | |
4719 "Text Printers" | |
4720 'pr-txt-printer-menu-modified | |
4721 force | |
4722 "Text Printers" | |
4723 'text 2) | |
4724 (let ((save-var pr-ps-utility-menu-modified)) | |
4725 (pr-menu-alist pr-ps-utility-alist | |
4726 'pr-ps-utility | |
4727 'pr-menu-set-utility-title | |
4728 '("PostScript Print" "File" "PostScript Utility") | |
4729 'save-var | |
4730 force | |
4731 "PostScript Utility" | |
4732 nil 1)) | |
4733 (pr-menu-alist pr-ps-utility-alist | |
4734 'pr-ps-utility | |
4735 'pr-menu-set-utility-title | |
4736 '("PostScript Preview" "File" "PostScript Utility") | |
4737 'pr-ps-utility-menu-modified | |
4738 force | |
4739 "PostScript Utility" | |
4740 nil 1) | |
4741 (pr-even-or-odd-pages ps-even-or-odd-pages force)) | |
4742 | |
4743 ;; GNU Emacs | |
4744 (defvar pr-temp-menu nil) | |
4745 | |
4746 ;; GNU Emacs | |
4747 (defun pr-menu-alist (alist var-sym fun menu-path modified-sym force name | |
4748 entry index) | |
4749 (when (and alist (or force (symbol-value modified-sym))) | |
4750 (easy-menu-define pr-temp-menu nil "" | |
4751 (pr-menu-create name alist var-sym fun entry index)) | |
4752 (let ((item (pr-menu-get-item menu-path))) | |
4753 (and item | |
4754 (let* ((binding (nthcdr 3 item)) | |
4755 (key-binding (cdr binding))) | |
4756 (setcar binding pr-temp-menu) | |
4757 (and key-binding (listp (car key-binding)) | |
4758 (setcdr binding (cdr key-binding))) ; skip KEY-BINDING | |
4759 (funcall fun (symbol-value var-sym) item)))) | |
4760 (set modified-sym nil))) | |
4761 | |
4762 ;; GNU Emacs | |
4763 (defun pr-menu-set-ps-title (value &optional item entry index) | |
4764 (pr-menu-set-item-name (or item | |
4765 (pr-menu-get-item "PostScript Printers")) | |
4766 (format "PostScript Printer: %s" value)) | |
4767 (pr-ps-set-printer value) | |
4768 (and index | |
4769 (pr-menu-lock entry index 12 'toggle nil))) | |
4770 | |
4771 ;; GNU Emacs | |
4772 (defun pr-menu-set-txt-title (value &optional item entry index) | |
4773 (pr-menu-set-item-name (or item | |
4774 (pr-menu-get-item "Text Printers")) | |
4775 (format "Text Printer: %s" value)) | |
4776 (pr-txt-set-printer value) | |
4777 (and index | |
4778 (pr-menu-lock entry index 12 'toggle nil))) | |
4779 | |
4780 ;; GNU Emacs | |
4781 (defun pr-menu-set-utility-title (value &optional item entry index) | |
4782 (let ((name (symbol-name value))) | |
4783 (if item | |
4784 (pr-menu-set-item-name item name) | |
4785 (pr-menu-set-item-name | |
4786 (pr-menu-get-item | |
4787 '("PostScript Print" "File" "PostScript Utility")) | |
4788 name) | |
4789 (pr-menu-set-item-name | |
4790 (pr-menu-get-item | |
4791 '("PostScript Preview" "File" "PostScript Utility")) | |
4792 name))) | |
4793 (pr-ps-set-utility value) | |
4794 (and index | |
4795 (pr-menu-lock entry index 5 nil '("PostScript Print" "File")))) | |
4796 | |
4797 ;; GNU Emacs | |
4798 (defun pr-even-or-odd-pages (value &optional no-lock) | |
4799 (pr-menu-set-item-name (pr-menu-get-item "Print All Pages") | |
4800 (cdr (assq value pr-even-or-odd-alist))) | |
4801 (setq ps-even-or-odd-pages value) | |
4802 (or no-lock | |
4803 (pr-menu-lock 'postscript-options 8 12 'toggle nil)))) | |
4804 | |
4805 | |
4806 ((eq ps-print-emacs-type 'xemacs) | |
4807 ;; XEmacs | |
4808 (defalias 'pr-update-mode-line 'set-menubar-dirty-flag) | |
4809 | |
4810 ;; XEmacs | |
4811 (defvar pr-ps-name-old "PostScript Printers") | |
4812 (defvar pr-txt-name-old "Text Printers") | |
4813 (defvar pr-ps-utility-old "PostScript Utility") | |
4814 (defvar pr-even-or-odd-old "Print All Pages") | |
4815 | |
4816 ;; XEmacs | |
4817 (defun pr-do-update-menus (&optional force) | |
4818 (pr-menu-alist pr-ps-printer-alist | |
4819 'pr-ps-name | |
4820 'pr-menu-set-ps-title | |
4821 '("Printing") | |
4822 'pr-ps-printer-menu-modified | |
4823 force | |
4824 pr-ps-name-old | |
4825 'postscript 2) | |
4826 (pr-menu-alist pr-txt-printer-alist | |
4827 'pr-txt-name | |
4828 'pr-menu-set-txt-title | |
4829 '("Printing") | |
4830 'pr-txt-printer-menu-modified | |
4831 force | |
4832 pr-txt-name-old | |
4833 'text 2) | |
4834 (let ((save-var pr-ps-utility-menu-modified)) | |
4835 (pr-menu-alist pr-ps-utility-alist | |
4836 'pr-ps-utility | |
4837 'pr-menu-set-utility-title | |
4838 '("Printing" "PostScript Print" "File") | |
4839 'save-var | |
4840 force | |
4841 pr-ps-utility-old | |
4842 nil 1)) | |
4843 (pr-menu-alist pr-ps-utility-alist | |
4844 'pr-ps-utility | |
4845 'pr-menu-set-utility-title | |
4846 '("Printing" "PostScript Preview" "File") | |
4847 'pr-ps-utility-menu-modified | |
4848 force | |
4849 pr-ps-utility-old | |
4850 nil 1) | |
4851 (pr-even-or-odd-pages ps-even-or-odd-pages force)) | |
4852 | |
4853 ;; XEmacs | |
4854 (defun pr-menu-alist (alist var-sym fun menu-path modified-sym force name | |
4855 entry index) | |
4856 (when (and alist (or force (symbol-value modified-sym))) | |
4857 (pr-xemacs-global-menubar | |
4858 (pr-x-add-submenu menu-path | |
4859 (pr-menu-create name alist var-sym | |
4860 fun entry index))) | |
4861 (funcall fun (symbol-value var-sym)) | |
4862 (set modified-sym nil))) | |
4863 | |
4864 ;; XEmacs | |
4865 (defun pr-menu-set-ps-title (value &optional item entry index) | |
4866 (pr-relabel-menu-item (format "PostScript Printer: %s" value) | |
4867 'pr-ps-name-old) | |
4868 (pr-ps-set-printer value) | |
4869 (and index | |
4870 (pr-menu-lock entry index 12 'toggle nil))) | |
4871 | |
4872 ;; XEmacs | |
4873 (defun pr-menu-set-txt-title (value &optional item entry index) | |
4874 (pr-relabel-menu-item (format "Text Printer: %s" value) | |
4875 'pr-txt-name-old) | |
4876 (pr-txt-set-printer value) | |
4877 (and index | |
4878 (pr-menu-lock entry index 12 'toggle nil))) | |
4879 | |
4880 ;; XEmacs | |
4881 (defun pr-menu-set-utility-title (value &optional item entry index) | |
4882 (pr-xemacs-global-menubar | |
4883 (let ((newname (format "%s" value))) | |
4884 (pr-x-relabel-menu-item | |
4885 (list "Printing" "PostScript Print" "File" pr-ps-utility-old) | |
4886 newname) | |
4887 (pr-x-relabel-menu-item | |
4888 (list "Printing" "PostScript Preview" "File" pr-ps-utility-old) | |
4889 newname) | |
4890 (setq pr-ps-utility-old newname))) | |
4891 (pr-ps-set-utility value) | |
4892 (and index | |
4893 (pr-menu-lock entry index 5 nil '("PostScript Print" "File")))) | |
4894 | |
4895 ;; XEmacs | |
4896 (defun pr-even-or-odd-pages (value &optional no-lock) | |
4897 (pr-relabel-menu-item (cdr (assq value pr-even-or-odd-alist)) | |
4898 'pr-even-or-odd-old) | |
4899 (setq ps-even-or-odd-pages value) | |
4900 (or no-lock | |
4901 (pr-menu-lock 'postscript-options 8 12 'toggle nil)))))) | |
4902 | |
4903 ;; XEmacs | |
4904 (defun pr-relabel-menu-item (newname var-sym) | |
4905 (pr-xemacs-global-menubar | |
4906 (pr-x-relabel-menu-item | |
4907 (list "Printing" (symbol-value var-sym)) | |
4908 newname) | |
4909 (set var-sym newname))) | |
4910 | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4911 ;; GNU Emacs |
49646 | 4912 (defun pr-menu-set-item-name (item name) |
4913 (and item | |
4914 (setcar (nthcdr 2 item) name))) ; ITEM-NAME | |
4915 | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4916 ;; GNU Emacs |
49646 | 4917 (defun pr-menu-get-item (name-list) |
4918 ;; NAME-LIST is a string or a list of strings. | |
4919 (let ((ipath pr-menu-bar) | |
4920 (len (and (listp name-list) (length name-list)))) | |
4921 (and len (= len 1) | |
4922 (setq name-list (car name-list))) | |
4923 (cond | |
4924 ((null name-list) | |
4925 ;; nil | |
4926 nil) | |
4927 ((listp name-list) | |
4928 ;; list and (length list) > 1 | |
4929 (let* ((copy (copy-sequence name-list)) | |
4930 (name (pr-get-symbol (nth (1- len) copy))) | |
4931 (path (progn | |
4932 (setcdr (nthcdr (- len 2) copy) nil) | |
4933 copy)) | |
4934 (menu (lookup-key | |
4935 global-map | |
4936 (if path | |
4937 (vconcat ipath | |
4938 (mapcar 'pr-get-symbol path)) | |
4939 ipath)))) | |
4940 (assq name (nthcdr 2 menu)))) | |
4941 (t | |
4942 ;; string | |
4943 (let ((name (pr-get-symbol name-list)) | |
4944 (menu (lookup-key global-map ipath))) | |
4945 (assq name (nthcdr 2 menu))))))) | |
4946 | |
4947 | |
4948 (defun pr-ps-set-utility (value) | |
4949 (let ((item (cdr (assq value pr-ps-utility-alist)))) | |
4950 (or item | |
4951 (error | |
4952 "Invalid PostScript utility name `%s' for variable `pr-ps-utility'." | |
4953 value)) | |
4954 (setq pr-ps-utility value) | |
4955 (pr-eval-alist (nthcdr 9 item))) | |
4956 (pr-update-mode-line)) | |
4957 | |
4958 | |
4959 (defun pr-ps-set-printer (value) | |
4960 (let ((ps (cdr (assq value pr-ps-printer-alist)))) | |
4961 (or ps | |
4962 (error | |
4963 "Invalid PostScript printer name `%s' for variable `pr-ps-name'." | |
4964 value)) | |
4965 (setq pr-ps-name value | |
4966 pr-ps-command (pr-dosify-path (nth 0 ps)) | |
4967 pr-ps-switches (nth 1 ps) | |
4968 pr-ps-printer-switch (nth 2 ps) | |
4969 pr-ps-printer (pr-dosify-path (nth 3 ps))) | |
4970 (or (stringp pr-ps-command) | |
4971 (setq pr-ps-command | |
4972 (cond (ps-windows-system "print") | |
4973 (ps-lp-system "lp") | |
4974 (t "lpr") | |
4975 ))) | |
4976 (or (stringp pr-ps-printer-switch) | |
4977 (setq pr-ps-printer-switch | |
4978 (cond (ps-windows-system "/D:") | |
4979 (ps-lp-system "-d") | |
4980 (t "-P") | |
4981 ))) | |
4982 (pr-eval-alist (nthcdr 4 ps))) | |
4983 (pr-update-mode-line)) | |
4984 | |
4985 | |
4986 (defun pr-txt-set-printer (value) | |
4987 (let ((txt (cdr (assq value pr-txt-printer-alist)))) | |
4988 (or txt | |
4989 (error "Invalid text printer name `%s' for variable `pr-txt-name'." | |
4990 value)) | |
4991 (setq pr-txt-name value | |
4992 pr-txt-command (pr-dosify-path (nth 0 txt)) | |
4993 pr-txt-switches (nth 1 txt) | |
4994 pr-txt-printer (pr-dosify-path (nth 2 txt)))) | |
4995 (or (stringp pr-txt-command) | |
4996 (setq pr-txt-command | |
4997 (cond (ps-windows-system "print") | |
4998 (ps-lp-system "lp") | |
4999 (t "lpr") | |
5000 ))) | |
5001 (pr-update-mode-line)) | |
5002 | |
5003 | |
5004 (defun pr-eval-alist (alist) | |
5005 (mapcar #'(lambda (option) | |
5006 (let ((var-sym (car option)) | |
5007 (value (cdr option))) | |
5008 (if (eq var-sym 'inherits-from:) | |
5009 (pr-eval-setting-alist value 'global) | |
5010 (set var-sym (eval value))))) | |
5011 alist)) | |
5012 | |
5013 | |
5014 (defun pr-eval-local-alist (alist) | |
5015 (let (local-list) | |
5016 (mapcar #'(lambda (option) | |
5017 (let ((var-sym (car option)) | |
5018 (value (cdr option))) | |
5019 (setq local-list | |
5020 (if (eq var-sym 'inherits-from:) | |
5021 (nconc (pr-eval-setting-alist value) local-list) | |
5022 (set (make-local-variable var-sym) (eval value)) | |
5023 (cons var-sym local-list))))) | |
5024 alist) | |
5025 local-list)) | |
5026 | |
5027 | |
5028 (defun pr-eval-setting-alist (key &optional global old) | |
5029 (let ((setting (cdr (assq key pr-setting-database)))) | |
5030 (and setting | |
5031 (let ((inherits (nth 0 setting)) | |
5032 (local (nth 1 setting)) | |
5033 (kill (nth 2 setting)) | |
5034 local-list) | |
5035 (and local global | |
5036 (progn | |
5037 (ding) | |
5038 (message "There are local buffer settings for `%S'." key) | |
5039 (setq global nil))) | |
5040 (and inherits | |
5041 (if (memq inherits old) | |
5042 (error "Circular inheritance for `%S'." inherits) | |
5043 (setq local-list | |
5044 (pr-eval-setting-alist inherits global | |
5045 (cons inherits old))))) | |
5046 (mapcar | |
5047 (cond ((not local) ; global settings | |
5048 #'(lambda (option) | |
5049 (let ((var-sym (car option))) | |
5050 (or (eq var-sym 'inherits-from:) | |
5051 (set var-sym (eval (cdr option))))))) | |
5052 (kill ; local settings with killing | |
5053 #'(lambda (option) | |
5054 (let ((var-sym (car option))) | |
5055 (unless (eq var-sym 'inherits-from:) | |
5056 (setq local-list (cons var-sym local-list)) | |
5057 (set (make-local-variable var-sym) | |
5058 (eval (cdr option))))))) | |
5059 (t ; local settings without killing | |
5060 #'(lambda (option) | |
5061 (let ((var-sym (car option))) | |
5062 (or (eq var-sym 'inherits-from:) | |
5063 (set (make-local-variable var-sym) | |
5064 (eval (cdr option)))))))) | |
5065 (nthcdr 3 setting)) | |
5066 local-list)))) | |
5067 | |
5068 | |
5069 (defun pr-kill-local-variable (local-var-list) | |
5070 (mapcar 'kill-local-variable local-var-list)) | |
5071 | |
5072 | |
5073 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
5074 ;; Internal Functions (II) | |
5075 | |
5076 | |
5077 (defun pr-prompt (str) | |
5078 (if (pr-auto-mode-p) | |
5079 (concat str " mode") | |
5080 (pr-region-active-string str))) | |
5081 | |
5082 | |
5083 (defun pr-prompt-region (str) | |
5084 (concat str (if (pr-auto-mode-p) | |
5085 " mode" | |
5086 " region"))) | |
5087 | |
5088 | |
5089 (defun pr-prompt-gs (str) | |
5090 (if (pr-using-ghostscript-p) | |
5091 (concat str " GS") | |
5092 str)) | |
5093 | |
5094 | |
5095 (defun pr-region-active-symbol (&optional region-p) | |
5096 (if (or region-p (pr-region-active-p)) | |
5097 'region | |
5098 'buffer)) | |
5099 | |
5100 | |
5101 (defun pr-region-active-string (prefix) | |
5102 (concat prefix | |
5103 (if (pr-region-active-p) | |
5104 " region" | |
5105 " buffer"))) | |
5106 | |
5107 | |
5108 (defun pr-show-setup (settings buffer-name) | |
5109 (with-output-to-temp-buffer buffer-name | |
5110 (princ settings) | |
5111 (print-help-return-message))) | |
5112 | |
5113 | |
5114 (defun pr-complete-alist (prompt alist default) | |
5115 (let ((collection (mapcar #'(lambda (elt) | |
5116 (setq elt (car elt)) | |
5117 (cons (symbol-name elt) elt)) | |
5118 alist))) | |
5119 (cdr (assoc (completing-read (concat prompt ": ") | |
5120 collection nil t | |
5121 (symbol-name default) nil | |
5122 (symbol-name default)) | |
5123 collection)))) | |
5124 | |
5125 | |
5126 (defun pr-delete-file (file) | |
5127 (and pr-delete-temp-file (delete-file file))) | |
5128 | |
5129 | |
5130 (defun pr-expand-file-name (filename) | |
5131 (pr-dosify-path (expand-file-name filename))) | |
5132 | |
5133 | |
5134 (defun pr-ps-outfile-preprint (&optional mess) | |
5135 (let* ((prompt (format "%soutput PostScript file name: " (or mess ""))) | |
5136 (res (read-file-name prompt default-directory "" nil))) | |
5137 (while (cond ((not (file-writable-p res)) | |
5138 (ding) | |
5139 (setq prompt "is unwritable")) | |
5140 ((file-directory-p res) | |
5141 (ding) | |
5142 (setq prompt "is a directory")) | |
5143 ((file-exists-p res) | |
5144 (ding) | |
5145 (setq prompt "exists") | |
5146 (not (y-or-n-p (format "File `%s' exists; overwrite? " | |
5147 res)))) | |
5148 (t nil)) | |
5149 (setq res (read-file-name | |
5150 (format "File %s; PostScript file: " prompt) | |
5151 (file-name-directory res) nil nil | |
5152 (file-name-nondirectory res)))) | |
5153 (pr-expand-file-name res))) | |
5154 | |
5155 | |
5156 (defun pr-ps-infile-preprint (&optional mess) | |
5157 (let* ((prompt (format "%sinput PostScript file name: " (or mess ""))) | |
5158 (res (read-file-name prompt default-directory "" nil))) | |
5159 (while (cond ((not (file-exists-p res)) | |
5160 (ding) | |
5161 (setq prompt "doesn't exist")) | |
5162 ((not (file-readable-p res)) | |
5163 (ding) | |
5164 (setq prompt "is unreadable")) | |
5165 ((file-directory-p res) | |
5166 (ding) | |
5167 (setq prompt "is a directory")) | |
5168 (t nil)) | |
5169 (setq res (read-file-name | |
5170 (format "File %s; PostScript file: " prompt) | |
5171 (file-name-directory res) nil nil | |
5172 (file-name-nondirectory res)))) | |
5173 (pr-expand-file-name res))) | |
5174 | |
5175 | |
5176 (defun pr-toggle (var-sym mess entry index horizontal state &optional path) | |
5177 (set var-sym (not (symbol-value var-sym))) | |
5178 (message "%s is %s" mess (if (symbol-value var-sym) "on" "off")) | |
5179 (pr-menu-lock entry index horizontal state path)) | |
5180 | |
5181 | |
5182 (defun pr-ps-utility-args (n-up-sym infile-sym outfile-sym prompt) | |
5183 ;; n-up | |
5184 (or (symbol-value n-up-sym) | |
5185 (set n-up-sym (pr-interactive-n-up prompt))) | |
5186 (and (eq (symbol-value infile-sym) t) | |
5187 (set infile-sym (and (not (interactive-p)) | |
5188 (pr-ps-infile-preprint prompt)))) | |
5189 ;; input file | |
5190 (or (symbol-value infile-sym) | |
5191 (error "%s: input PostScript file name is missing" prompt)) | |
5192 (set infile-sym (pr-dosify-path (symbol-value infile-sym))) | |
5193 ;; output file | |
5194 (and (eq (symbol-value outfile-sym) t) | |
5195 (set outfile-sym (and (not (interactive-p)) | |
5196 current-prefix-arg | |
5197 (pr-ps-outfile-preprint prompt)))) | |
5198 (and (symbol-value outfile-sym) | |
5199 (set outfile-sym (pr-dosify-path (symbol-value outfile-sym)))) | |
5200 (pr-ps-file (symbol-value outfile-sym))) | |
5201 | |
5202 | |
5203 (defun pr-ps-utility-process (n-up infile outfile) | |
5204 (let (item) | |
5205 (and (stringp infile) (file-exists-p infile) | |
5206 (setq item (cdr (assq pr-ps-utility pr-ps-utility-alist))) | |
5207 (pr-shell-command | |
5208 (concat (pr-command (nth 0 item)) " " | |
5209 (pr-switches-string (nth 1 item) | |
5210 "pr-ps-utility-alist entry") | |
5211 " " | |
5212 (pr-switches-string (nth 8 item) | |
5213 "pr-ps-utility-alist entry") | |
5214 " " | |
5215 (and (nth 2 item) | |
5216 (format (nth 2 item) ps-paper-type)) | |
5217 " " (format (nth 3 item) n-up) " " | |
5218 (and pr-file-landscape (nth 4 item)) " " | |
5219 (and pr-file-duplex (nth 5 item)) " " | |
5220 (and pr-file-tumble (nth 6 item)) | |
5221 " \"" (pr-expand-file-name infile) "\" " | |
5222 (nth 7 item) | |
5223 " \"" (pr-expand-file-name outfile) "\""))))) | |
5224 | |
5225 | |
5226 (defun pr-shell-command (command) | |
5227 (let ((shell-file-name pr-shell-file-name)) | |
5228 (shell-command command))) | |
5229 | |
5230 | |
5231 (defun pr-txt-print (from to) | |
5232 (let ((lpr-command (pr-command pr-txt-command)) | |
5233 (lpr-switches (pr-switches pr-txt-switches "pr-txt-switches")) | |
5234 (printer-name pr-txt-printer)) | |
5235 (lpr-region from to))) | |
5236 | |
5237 | |
5238 (defun pr-switches-string (switches mess) | |
5239 (mapconcat 'identity (pr-switches switches mess) " ")) | |
5240 | |
5241 | |
5242 (defun pr-switches (switches mess) | |
5243 (or (listp switches) | |
5244 (error "%S should have a list of strings." mess)) | |
5245 (ps-flatten-list ; dynamic evaluation | |
5246 (mapcar 'ps-eval-switch switches))) | |
5247 | |
5248 | |
5249 (defun pr-ps-preview (kind n-up filename mess) | |
5250 (pr-set-n-up-and-filename 'n-up 'filename mess) | |
5251 (let ((file (pr-ps-file filename))) | |
5252 (pr-text2ps kind n-up file) | |
5253 (or pr-spool-p (pr-ps-file-preview file)))) | |
5254 | |
5255 | |
5256 (defun pr-ps-using-ghostscript (kind n-up filename mess) | |
5257 (pr-set-n-up-and-filename 'n-up 'filename mess) | |
5258 (let ((file (pr-ps-file filename))) | |
5259 (pr-text2ps kind n-up file) | |
5260 (unless (or pr-spool-p filename) | |
5261 (pr-ps-file-using-ghostscript file) | |
5262 (pr-delete-file file)))) | |
5263 | |
5264 | |
5265 (defun pr-ps-print (kind n-up filename mess) | |
5266 (pr-set-n-up-and-filename 'n-up 'filename mess) | |
5267 (let ((file (pr-ps-file filename))) | |
5268 (pr-text2ps kind n-up file) | |
5269 (unless (or pr-spool-p filename) | |
5270 (pr-ps-file-print file) | |
5271 (pr-delete-file file)))) | |
5272 | |
5273 | |
5274 (defun pr-ps-file (&optional filename) | |
5275 (pr-dosify-path (or filename | |
5276 (convert-standard-filename | |
5277 (expand-file-name pr-ps-temp-file pr-temp-dir))))) | |
5278 | |
5279 | |
5280 (defun pr-interactive-n-up (mess) | |
5281 (or (stringp mess) (setq mess "*")) | |
5282 (save-match-data | |
5283 (let* ((fmt-prompt "%s[%s] N-up printing: (default 1) ") | |
5284 (prompt "") | |
5285 (str (pr-f-read-string (format fmt-prompt prompt mess) "1" nil "1")) | |
5286 int) | |
5287 (while (if (string-match "^\\s *[0-9]+$" str) | |
5288 (setq int (string-to-int str) | |
5289 prompt (cond ((< int 1) "Integer below 1; ") | |
5290 ((> int 100) "Integer above 100; ") | |
5291 (t nil))) | |
5292 (setq prompt "Invalid integer syntax; ")) | |
5293 (ding) | |
5294 (setq str | |
5295 (pr-f-read-string (format fmt-prompt prompt mess) str nil "1"))) | |
5296 int))) | |
5297 | |
5298 | |
5299 (defun pr-interactive-dir (mess) | |
5300 (let* ((dir-name (file-name-directory (or (buffer-file-name) | |
5301 default-directory))) | |
5302 (fmt-prompt (concat "%s[" mess "] Directory to print: ")) | |
5303 (dir (read-file-name (format fmt-prompt "") | |
5304 "" dir-name nil dir-name)) | |
5305 prompt) | |
5306 (while (cond ((not (file-directory-p dir)) | |
5307 (ding) | |
5308 (setq prompt "It's not a directory! ")) | |
5309 ((not (file-readable-p dir)) | |
5310 (ding) | |
5311 (setq prompt "Directory is unreadable! ")) | |
5312 (t nil)) | |
5313 (setq dir-name (file-name-directory dir) | |
5314 dir (read-file-name (format fmt-prompt prompt) | |
5315 "" dir-name nil dir-name))) | |
5316 (file-name-as-directory dir))) | |
5317 | |
5318 | |
5319 (defun pr-interactive-regexp (mess) | |
5320 (pr-f-read-string (format "[%s] File regexp to print: " mess) "" nil "")) | |
5321 | |
5322 | |
5323 (defun pr-interactive-dir-args (mess) | |
5324 (list | |
5325 ;; get directory argument | |
5326 (pr-interactive-dir mess) | |
5327 ;; get file name regexp | |
5328 (pr-interactive-regexp mess))) | |
5329 | |
5330 | |
5331 (defun pr-interactive-ps-dir-args (mess) | |
5332 (list | |
5333 ;; get n-up argument | |
5334 (pr-interactive-n-up mess) | |
5335 ;; get directory argument | |
5336 (pr-interactive-dir mess) | |
5337 ;; get file name regexp | |
5338 (pr-interactive-regexp mess) | |
5339 ;; get output file name | |
5340 (and (not pr-spool-p) | |
5341 (ps-print-preprint current-prefix-arg)))) | |
5342 | |
5343 | |
5344 (defun pr-interactive-n-up-file (mess) | |
5345 (list | |
5346 ;; get n-up argument | |
5347 (pr-interactive-n-up mess) | |
5348 ;; get output file name | |
5349 (and (not pr-spool-p) | |
5350 (ps-print-preprint current-prefix-arg)))) | |
5351 | |
5352 | |
5353 (defun pr-interactive-n-up-inout (mess) | |
5354 (list | |
5355 ;; get n-up argument | |
5356 (pr-interactive-n-up mess) | |
5357 ;; get input file name | |
5358 (pr-ps-infile-preprint (concat mess " ")) | |
5359 ;; get output file name | |
5360 (ps-print-preprint current-prefix-arg))) | |
5361 | |
5362 | |
5363 (defun pr-set-outfilename (filename-sym) | |
5364 (and (not pr-spool-p) | |
5365 (eq (symbol-value filename-sym) t) | |
5366 (set filename-sym (and (not (interactive-p)) | |
5367 current-prefix-arg | |
5368 (ps-print-preprint current-prefix-arg)))) | |
5369 (and (symbol-value filename-sym) | |
5370 (set filename-sym (pr-dosify-path (symbol-value filename-sym))))) | |
5371 | |
5372 | |
5373 (defun pr-set-n-up-and-filename (n-up-sym filename-sym mess) | |
5374 ;; n-up | |
5375 (or (symbol-value n-up-sym) | |
5376 (set n-up-sym (pr-interactive-n-up mess))) | |
5377 ;; output file | |
5378 (pr-set-outfilename filename-sym)) | |
5379 | |
5380 | |
5381 (defun pr-set-dir-args (dir-sym regexp-sym mess) | |
5382 ;; directory | |
5383 (or (symbol-value dir-sym) | |
5384 (set dir-sym (pr-interactive-dir mess))) | |
5385 ;; file name regexp | |
5386 (or (symbol-value regexp-sym) | |
5387 (set regexp-sym (pr-interactive-regexp mess)))) | |
5388 | |
5389 | |
5390 (defun pr-set-ps-dir-args (n-up-sym dir-sym regexp-sym filename-sym mess) | |
5391 ;; n-up | |
5392 (or (symbol-value n-up-sym) | |
5393 (set n-up-sym (pr-interactive-n-up mess))) | |
5394 ;; directory & file name regexp | |
5395 (pr-set-dir-args dir-sym regexp-sym mess) | |
5396 ;; output file | |
5397 (pr-set-outfilename filename-sym)) | |
5398 | |
5399 | |
5400 (defun pr-find-buffer-visiting (file) | |
5401 (if (not (file-directory-p file)) | |
5402 (find-buffer-visiting (if ps-windows-system | |
5403 (downcase file) | |
5404 file)) | |
5405 (let ((truename (file-truename file)) | |
5406 (blist (buffer-list)) | |
5407 found) | |
5408 (while (and (not found) blist) | |
5409 (save-excursion | |
5410 (set-buffer (car blist)) | |
5411 (and (eq major-mode 'dired-mode) | |
5412 (save-excursion | |
5413 (goto-char (point-min)) | |
5414 (string= (buffer-substring-no-properties | |
5415 (+ (point-min) 2) | |
5416 (progn | |
5417 (end-of-line) | |
5418 (1- (point)))) | |
5419 truename)) | |
5420 (setq found (car blist)))) | |
5421 (setq blist (cdr blist))) | |
5422 found))) | |
5423 | |
5424 | |
5425 (defun pr-file-list (dir file-regexp fun) | |
5426 (mapcar #'(lambda (file) | |
5427 (and (or pr-list-directory | |
5428 (not (file-directory-p file))) | |
5429 (let ((buffer (pr-find-buffer-visiting file)) | |
5430 pop-up-windows | |
5431 pop-up-frames) | |
5432 (and (or buffer | |
5433 (file-readable-p file)) | |
5434 (save-excursion | |
5435 (set-buffer (or buffer | |
5436 (find-file-noselect file))) | |
5437 (funcall fun) | |
5438 (or buffer | |
5439 (kill-buffer (current-buffer)))))))) | |
5440 (directory-files dir t file-regexp))) | |
5441 | |
5442 | |
5443 (defun pr-delete-file-if-exists (filename) | |
5444 (and (not pr-spool-p) (stringp filename) (file-exists-p filename) | |
5445 (delete-file filename))) | |
5446 | |
5447 | |
5448 (defun pr-ps-file-list (n-up dir file-regexp filename) | |
5449 (pr-delete-file-if-exists (setq filename (pr-expand-file-name filename))) | |
5450 (let ((pr-spool-p t)) | |
5451 (pr-file-list dir file-regexp | |
5452 #'(lambda () | |
5453 (if (pr-auto-mode-p) | |
5454 (pr-ps-mode n-up filename) | |
5455 (pr-text2ps 'buffer n-up filename))))) | |
5456 (or pr-spool-p | |
5457 (pr-despool-print filename))) | |
5458 | |
5459 | |
5460 (defun pr-text2ps (kind n-up filename &optional from to) | |
5461 (let ((ps-n-up-printing n-up) | |
5462 (ps-spool-config (and (eq ps-spool-config 'setpagedevice) | |
5463 'setpagedevice))) | |
5464 (pr-delete-file-if-exists filename) | |
5465 (cond (pr-faces-p | |
5466 (cond (pr-spool-p | |
5467 ;; pr-faces-p and pr-spool-p | |
5468 ;; here FILENAME arg is ignored | |
5469 (cond ((eq kind 'buffer) | |
5470 (ps-spool-buffer-with-faces)) | |
5471 ((eq kind 'region) | |
5472 (ps-spool-region-with-faces (or from (point)) | |
5473 (or to (mark)))) | |
5474 )) | |
5475 ;; pr-faces-p and not pr-spool-p | |
5476 ((eq kind 'buffer) | |
5477 (ps-print-buffer-with-faces filename)) | |
5478 ((eq kind 'region) | |
5479 (ps-print-region-with-faces (or from (point)) | |
5480 (or to (mark)) filename)) | |
5481 )) | |
5482 (pr-spool-p | |
5483 ;; not pr-faces-p and pr-spool-p | |
5484 ;; here FILENAME arg is ignored | |
5485 (cond ((eq kind 'buffer) | |
5486 (ps-spool-buffer)) | |
5487 ((eq kind 'region) | |
5488 (ps-spool-region (or from (point)) (or to (mark)))) | |
5489 )) | |
5490 ;; not pr-faces-p and not pr-spool-p | |
5491 ((eq kind 'buffer) | |
5492 (ps-print-buffer filename)) | |
5493 ((eq kind 'region) | |
5494 (ps-print-region (or from (point)) (or to (mark)) filename)) | |
5495 ))) | |
5496 | |
5497 | |
5498 (defun pr-command (command) | |
5499 "Return absolute file name specification for COMMAND. | |
5500 | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5501 If COMMAND is an empty string, return it. |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5502 |
49646 | 5503 If COMMAND is already an absolute file name specification, return it. |
5504 Else it uses `pr-path-alist' to find COMMAND, if find it then return it; | |
5505 otherwise, gives an error. | |
5506 | |
5507 When using `pr-path-alist' to find COMMAND, the entries `cygwin', `windows' and | |
5508 `unix' are used (see `pr-path-alist' for documentation). | |
5509 | |
5510 If Emacs is running on Windows 95/98/NT/2000, tries to find COMMAND, | |
5511 COMMAND.exe, COMMAND.bat and COMMAND.com in this order." | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5512 (if (string= command "") |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5513 command |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5514 (pr-dosify-path |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5515 (or (pr-find-command command) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5516 (pr-path-command (cond (pr-cygwin-system 'cygwin) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5517 (ps-windows-system 'windows) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5518 (t 'unix)) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5519 (file-name-nondirectory command) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5520 nil) |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5521 (error "Command not found: %s" |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5522 (file-name-nondirectory command)))))) |
49646 | 5523 |
5524 | |
5525 (defun pr-path-command (symbol command sym-list) | |
5526 (let ((lpath (cdr (assq symbol pr-path-alist))) | |
5527 cmd) | |
5528 ;; PATH expansion | |
5529 (and (eq symbol 'PATH) (null lpath) | |
5530 (setq lpath (parse-colon-path (getenv "PATH")))) | |
5531 (while (and lpath | |
5532 (not | |
5533 (setq cmd | |
5534 (let ((path (car lpath))) | |
5535 (cond | |
5536 ;; symbol expansion | |
5537 ((symbolp path) | |
5538 (and (not (memq path sym-list)) | |
5539 (pr-path-command path command | |
5540 (cons path sym-list)))) | |
5541 ;; normal path | |
5542 ((stringp path) | |
5543 (pr-find-command | |
5544 (expand-file-name | |
5545 (substitute-in-file-name | |
5546 (concat (file-name-as-directory path) | |
5547 command))))) | |
5548 ))))) | |
5549 (setq lpath (cdr lpath))) | |
5550 cmd)) | |
5551 | |
5552 | |
5553 (defun pr-find-command (cmd) | |
5554 (if ps-windows-system | |
5555 ;; windows system | |
5556 (let ((ext (cons (file-name-extension cmd t) | |
5557 (list ".exe" ".bat" ".com"))) | |
5558 found) | |
5559 (setq cmd (file-name-sans-extension cmd)) | |
5560 (while (and ext | |
5561 (setq found (concat cmd (car ext))) | |
5562 (not (and (file-regular-p found) | |
5563 (file-executable-p found)))) | |
5564 (setq ext (cdr ext) | |
5565 found nil)) | |
5566 found) | |
5567 ;; non-windows systems | |
5568 (and (file-regular-p cmd) | |
5569 (file-executable-p cmd) | |
5570 cmd))) | |
5571 | |
5572 | |
5573 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
5574 ;; Printing Interface (inspired on ps-print-interface.el) | |
5575 | |
5576 | |
5577 (require 'widget) | |
5578 (require 'wid-edit) | |
5579 (require 'cus-edit) | |
5580 | |
5581 | |
5582 (defvar pr-i-window-configuration nil) | |
5583 | |
5584 (defvar pr-i-buffer nil) | |
5585 (defvar pr-i-region nil) | |
5586 (defvar pr-i-mode nil) | |
5587 (defvar pr-i-despool nil) | |
5588 (defvar pr-i-ps-as-is t) | |
5589 (defvar pr-i-n-up 1) | |
5590 (defvar pr-i-directory "./") | |
5591 (defvar pr-i-regexp "") | |
5592 (defvar pr-i-ps-file "") | |
5593 (defvar pr-i-out-file "") | |
5594 (defvar pr-i-answer-yes nil) | |
5595 (defvar pr-i-process 'buffer) | |
5596 (defvar pr-i-ps-send 'printer) | |
5597 | |
5598 | |
5599 (defvar pr-interface-map nil | |
5600 "Keymap for pr-interface.") | |
5601 | |
5602 (if pr-interface-map | |
5603 nil | |
5604 (setq pr-interface-map (make-sparse-keymap)) | |
5605 (cond ((eq ps-print-emacs-type 'xemacs) ; XEmacs | |
5606 (pr-f-set-keymap-parents pr-interface-map (list widget-keymap)) | |
5607 (pr-f-set-keymap-name pr-interface-map 'pr-interface-map)) | |
5608 ((eq ps-print-emacs-type 'emacs) ; GNU Emacs | |
5609 (pr-f-set-keymap-parents pr-interface-map widget-keymap))) | |
5610 (define-key pr-interface-map "q" 'pr-interface-quit) | |
5611 (define-key pr-interface-map "?" 'pr-interface-help)) | |
5612 | |
5613 | |
5614 (defmacro pr-interface-save (&rest body) | |
5615 `(save-excursion | |
5616 (set-buffer pr-i-buffer) | |
5617 ,@body)) | |
5618 | |
5619 | |
5620 (defun pr-create-interface () | |
5621 "Create the front end for printing package." | |
5622 (setq pr-i-buffer (buffer-name (current-buffer)) | |
5623 pr-i-region (ps-mark-active-p) | |
5624 pr-i-mode (pr-mode-alist-p) | |
5625 pr-i-window-configuration (current-window-configuration)) | |
5626 | |
5627 (put 'pr-i-process 'pr-widget-list nil) | |
5628 (put 'pr-i-ps-send 'pr-widget-list nil) | |
5629 | |
5630 (delete-other-windows) | |
5631 (kill-buffer (get-buffer-create pr-buffer-name)) | |
5632 (switch-to-buffer (get-buffer-create pr-buffer-name)) | |
5633 | |
5634 ;; header | |
5635 (let ((versions (concat "printing v" pr-version | |
5636 " ps-print v" ps-print-version))) | |
5637 (widget-insert (make-string (- 79 (length versions)) ?\ ) versions)) | |
5638 (pr-insert-italic "\nCurrent Directory : " 1) | |
5639 (pr-insert-italic default-directory) | |
5640 | |
5641 (pr-insert-section-1) ; 1. Print | |
5642 (pr-insert-section-2) ; 2. PostScript Printer | |
5643 (pr-insert-section-3) ; 3. Text Printer | |
5644 | |
5645 ;; separator | |
5646 (widget-insert "\n\n " (make-string 77 ?-)) | |
5647 | |
5648 (pr-insert-section-4) ; 4. Settings | |
5649 (pr-insert-section-5) ; 5. Customize | |
5650 (pr-insert-section-6) ; 6. Show Settings | |
5651 (pr-insert-section-7) ; 7. Help | |
5652 | |
5653 (use-local-map pr-interface-map) | |
5654 (widget-setup) | |
5655 (goto-char (point-min)) | |
5656 | |
5657 (and pr-i-region ; let region activated | |
5658 (pr-keep-region-active))) | |
5659 | |
5660 | |
5661 (defun pr-insert-section-1 () | |
5662 ;; 1. Print: | |
5663 (pr-insert-italic "\nPrint :" 1) | |
5664 | |
5665 ;; 1a. Buffer: | |
5666 ;; 1a. Buffer: Buffer List | |
5667 (pr-insert-radio-button 'pr-i-process 'buffer) | |
5668 (pr-insert-menu "Buffer List" 'pr-i-buffer | |
5669 (let ((blist (buffer-list)) | |
5670 case-fold-search choices) | |
5671 (while blist | |
5672 (let ((name (buffer-name (car blist))) | |
5673 (ignore pr-buffer-name-ignore) | |
5674 found) | |
5675 (setq blist (cdr blist)) | |
5676 (while (and ignore (not found)) | |
5677 (setq found (string-match (car ignore) name) | |
5678 ignore (cdr ignore))) | |
5679 (or found | |
5680 (setq choices | |
5681 (cons (list 'quote | |
5682 (list 'choice-item | |
5683 :format "%[%t%]" | |
5684 name)) | |
5685 choices))))) | |
5686 (nreverse choices)) | |
5687 " Buffer : " nil | |
5688 '(progn | |
5689 (pr-interface-save | |
5690 (setq pr-i-region (ps-mark-active-p) | |
5691 pr-i-mode (pr-mode-alist-p))) | |
5692 (pr-update-checkbox 'pr-i-region) | |
5693 (pr-update-checkbox 'pr-i-mode))) | |
5694 ;; 1a. Buffer: Region | |
5695 (put 'pr-i-region 'pr-widget | |
5696 (pr-insert-checkbox | |
5697 "\n " | |
5698 'pr-i-region | |
5699 #'(lambda (widget &rest ignore) | |
5700 (let ((region-p (pr-interface-save | |
5701 (ps-mark-active-p)))) | |
5702 (cond ((null (widget-value widget)) ; widget is nil | |
5703 (setq pr-i-region nil)) | |
5704 (region-p ; widget is true and there is a region | |
5705 (setq pr-i-region t) | |
5706 (widget-value-set widget t) | |
5707 (widget-setup)) ; MUST be called after widget-value-set | |
5708 (t ; widget is true and there is no region | |
5709 (ding) | |
5710 (message "There is no region active") | |
5711 (setq pr-i-region nil) | |
5712 (widget-value-set widget nil) | |
5713 (widget-setup))))) ; MUST be called after widget-value-set | |
5714 " Region")) | |
5715 ;; 1a. Buffer: Mode | |
5716 (put 'pr-i-mode 'pr-widget | |
5717 (pr-insert-checkbox | |
5718 " " | |
5719 'pr-i-mode | |
5720 #'(lambda (widget &rest ignore) | |
5721 (let ((mode-p (pr-interface-save | |
5722 (pr-mode-alist-p)))) | |
5723 (cond | |
5724 ((null (widget-value widget)) ; widget is nil | |
5725 (setq pr-i-mode nil)) | |
5726 (mode-p ; widget is true and there is a `mode' | |
5727 (setq pr-i-mode t) | |
5728 (widget-value-set widget t) | |
5729 (widget-setup)) ; MUST be called after widget-value-set | |
5730 (t ; widget is true and there is no `mode' | |
5731 (ding) | |
5732 (message | |
5733 "This buffer isn't in a mode that printing treats specially.") | |
5734 (setq pr-i-mode nil) | |
5735 (widget-value-set widget nil) | |
5736 (widget-setup))))) ; MUST be called after widget-value-set | |
5737 " Mode\n")) | |
5738 | |
5739 ;; 1b. Directory: | |
5740 (pr-insert-radio-button 'pr-i-process 'directory) | |
5741 (widget-create | |
5742 'directory | |
5743 :size 58 | |
5744 :format " Directory : %v" | |
5745 :notify 'pr-interface-directory | |
5746 :action (lambda (widget &optional event) | |
5747 (if (pr-interface-directory widget) | |
5748 (pr-widget-field-action widget event) | |
5749 (ding) | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5750 (message "Please specify a readable directory"))) |
49646 | 5751 pr-i-directory) |
5752 ;; 1b. Directory: File Regexp | |
5753 (widget-create 'regexp | |
5754 :size 58 | |
5755 :format "\n File Regexp : %v\n" | |
5756 :notify (lambda (widget &rest ignore) | |
5757 (setq pr-i-regexp (widget-value widget))) | |
5758 pr-i-regexp) | |
5759 ;; 1b. Directory: List Directory Entry | |
5760 (widget-insert " ") | |
5761 (pr-insert-toggle 'pr-list-directory " List Directory Entry\n") | |
5762 | |
5763 ;; 1c. PostScript File: | |
5764 (pr-insert-radio-button 'pr-i-process 'file) | |
5765 (widget-create | |
5766 'file | |
5767 :size 51 | |
5768 :format " PostScript File : %v" | |
5769 :notify 'pr-interface-infile | |
5770 :action (lambda (widget &rest event) | |
5771 (if (pr-interface-infile widget) | |
5772 (pr-widget-field-action widget event) | |
5773 (ding) | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5774 (message "Please specify a readable PostScript file"))) |
49646 | 5775 pr-i-ps-file) |
5776 ;; 1c. PostScript File: PostScript Utility | |
5777 (pr-insert-menu "PostScript Utility" 'pr-ps-utility | |
5778 (pr-choice-alist pr-ps-utility-alist) | |
5779 "\n PostScript Utility : " | |
5780 " ") | |
54210
602769168263
Replace "As Is..." in PostScript file print/preview by "No Preprocessing...".
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54209
diff
changeset
|
5781 ;; 1c. PostScript File: No Preprocessing |
602769168263
Replace "As Is..." in PostScript file print/preview by "No Preprocessing...".
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54209
diff
changeset
|
5782 (pr-insert-toggle 'pr-i-ps-as-is " No Preprocessing")) |
49646 | 5783 |
5784 | |
5785 (defun pr-insert-section-2 () | |
5786 ;; 2. PostScript Printer: | |
5787 ;; 2. PostScript Printer: PostScript Printer List | |
5788 (pr-insert-italic "\n\nPostScript Printer : " 2 20) | |
5789 (pr-insert-menu "PostScript Printer" 'pr-ps-name | |
5790 (pr-choice-alist pr-ps-printer-alist)) | |
5791 ;; 2. PostScript Printer: Despool | |
5792 (put 'pr-i-despool 'pr-widget | |
5793 (pr-insert-checkbox | |
5794 " " | |
5795 'pr-i-despool | |
5796 #'(lambda (widget &rest ignore) | |
5797 (if pr-spool-p | |
5798 (setq pr-i-despool (not pr-i-despool)) | |
5799 (ding) | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5800 (message "Can despool only when spooling is actually selected") |
49646 | 5801 (setq pr-i-despool nil)) |
5802 (widget-value-set widget pr-i-despool) | |
5803 (widget-setup)) ; MUST be called after widget-value-set | |
5804 " Despool ")) | |
5805 ;; 2. PostScript Printer: Preview Print Quit | |
5806 (pr-insert-button 'pr-interface-preview "Preview" " ") | |
5807 (pr-insert-button 'pr-interface-ps-print "Print" " ") | |
5808 (pr-insert-button 'pr-interface-quit "Quit") | |
5809 ;; 2. PostScript Printer: Send to Printer/Temporary File | |
5810 (pr-insert-radio-button 'pr-i-ps-send 'printer) | |
5811 (widget-insert " Send to Printer/Temporary File") | |
5812 ;; 2. PostScript Printer: Send to File | |
5813 (pr-insert-radio-button 'pr-i-ps-send 'file) | |
5814 (widget-create | |
5815 'file | |
5816 :size 57 | |
5817 :format " Send to File : %v" | |
5818 :notify 'pr-interface-outfile | |
5819 :action (lambda (widget &rest event) | |
5820 (if (and (pr-interface-outfile widget) | |
5821 (or (not (file-exists-p pr-i-out-file)) | |
5822 (setq pr-i-answer-yes | |
5823 (y-or-n-p "File exists; overwrite? ")))) | |
5824 (pr-widget-field-action widget event) | |
5825 (ding) | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5826 (message "Please specify a writable PostScript file"))) |
49646 | 5827 pr-i-out-file) |
5828 ;; 2. PostScript Printer: N-Up | |
5829 (widget-create | |
5830 'integer | |
5831 :size 3 | |
5832 :format "\n N-Up : %v" | |
5833 :notify (lambda (widget &rest ignore) | |
5834 (let ((value (if (string= (widget-apply widget :value-get) "") | |
5835 0 | |
5836 (widget-value widget)))) | |
5837 (if (and (integerp value) | |
5838 (<= 1 value) (<= value 100)) | |
5839 (progn | |
5840 (message " ") | |
5841 (setq pr-i-n-up value)) | |
5842 (ding) | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5843 (message "Please specify an integer between 1 and 100")))) |
49646 | 5844 pr-i-n-up)) |
5845 | |
5846 | |
5847 (defun pr-insert-section-3 () | |
5848 ;; 3. Text Printer: | |
5849 (pr-insert-italic "\n\nText Printer : " 2 14) | |
5850 (pr-insert-menu "Text Printer" 'pr-txt-name | |
5851 (pr-choice-alist pr-txt-printer-alist) | |
5852 nil " ") | |
5853 (pr-insert-button 'pr-interface-printify "Printify" " ") | |
5854 (pr-insert-button 'pr-interface-txt-print "Print" " ") | |
5855 (pr-insert-button 'pr-interface-quit "Quit")) | |
5856 | |
5857 | |
5858 (defun pr-insert-section-4 () | |
5859 ;; 4. Settings: | |
5860 ;; 4. Settings: Landscape Auto Region Verbose | |
5861 (pr-insert-checkbox "\n\n " 'ps-landscape-mode | |
5862 #'(lambda (&rest ignore) | |
5863 (setq ps-landscape-mode (not ps-landscape-mode) | |
5864 pr-file-landscape ps-landscape-mode)) | |
5865 " Landscape ") | |
5866 (pr-insert-toggle 'pr-auto-region " Auto Region ") | |
5867 (pr-insert-toggle 'pr-buffer-verbose " Verbose\n ") | |
5868 | |
5869 ;; 4. Settings: Print Header Auto Mode | |
5870 (pr-insert-toggle 'ps-print-header " Print Header ") | |
5871 (pr-insert-toggle 'pr-auto-mode " Auto Mode\n ") | |
5872 | |
5873 ;; 4. Settings: Print Header Frame Menu Lock | |
5874 (pr-insert-toggle 'ps-print-header-frame " Print Header Frame ") | |
5875 (pr-insert-toggle 'pr-menu-lock " Menu Lock\n ") | |
5876 | |
5877 ;; 4. Settings: Line Number | |
5878 (pr-insert-toggle 'ps-line-number " Line Number\n ") | |
5879 | |
5880 ;; 4. Settings: Zebra Stripes Spool Buffer | |
5881 (pr-insert-toggle 'ps-zebra-stripes " Zebra Stripes") | |
5882 (pr-insert-checkbox " " | |
5883 'pr-spool-p | |
5884 #'(lambda (&rest ignore) | |
5885 (setq pr-spool-p (not pr-spool-p)) | |
5886 (unless pr-spool-p | |
5887 (setq pr-i-despool nil) | |
5888 (pr-update-checkbox 'pr-i-despool))) | |
5889 " Spool Buffer") | |
5890 | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5891 ;; 4. Settings: Duplex Print with faces |
49646 | 5892 (pr-insert-checkbox "\n " |
5893 'ps-spool-duplex | |
5894 #'(lambda (&rest ignore) | |
5895 (setq ps-spool-duplex (not ps-spool-duplex) | |
5896 pr-file-duplex ps-spool-duplex)) | |
5897 " Duplex ") | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5898 (pr-insert-toggle 'pr-faces-p " Print with faces") |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5899 |
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5900 ;; 4. Settings: Tumble Print via Ghostscript |
49646 | 5901 (pr-insert-checkbox "\n " |
5902 'ps-spool-tumble | |
5903 #'(lambda (&rest ignore) | |
5904 (setq ps-spool-tumble (not ps-spool-tumble) | |
5905 pr-file-tumble ps-spool-tumble)) | |
5906 " Tumble ") | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5907 (pr-insert-toggle 'pr-print-using-ghostscript " Print via Ghostscript\n ") |
49646 | 5908 |
5909 ;; 4. Settings: Upside-Down Page Parity | |
54209
c312c950b64d
Adjust buffer interface.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54146
diff
changeset
|
5910 (pr-insert-toggle 'ps-print-upside-down " Upside-Down") |
c312c950b64d
Adjust buffer interface.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54146
diff
changeset
|
5911 (pr-insert-italic "\n\nSelect Pages : " 2 14) |
49646 | 5912 (pr-insert-menu "Page Parity" 'ps-even-or-odd-pages |
5913 (mapcar #'(lambda (alist) | |
5914 (list 'quote | |
5915 (list 'choice-item | |
5916 :format "%[%t%]" | |
5917 :tag (cdr alist) | |
5918 :value (car alist)))) | |
5919 pr-even-or-odd-alist))) | |
5920 | |
5921 | |
5922 (defun pr-insert-section-5 () | |
5923 ;; 5. Customize: | |
5924 (pr-insert-italic "\n\nCustomize : " 2 11) | |
5925 (pr-insert-button 'pr-customize "printing" " ") | |
5926 (pr-insert-button #'(lambda (&rest ignore) (ps-print-customize)) | |
5927 "ps-print" " ") | |
5928 (pr-insert-button 'lpr-customize "lpr")) | |
5929 | |
5930 | |
5931 (defun pr-insert-section-6 () | |
5932 ;; 6. Show Settings: | |
5933 (pr-insert-italic "\nShow Settings : " 1 14) | |
5934 (pr-insert-button 'pr-show-pr-setup "printing" " ") | |
5935 (pr-insert-button 'pr-show-ps-setup "ps-print" " ") | |
5936 (pr-insert-button 'pr-show-lpr-setup "lpr")) | |
5937 | |
5938 | |
5939 (defun pr-insert-section-7 () | |
5940 ;; 7. Help: | |
5941 (pr-insert-italic "\nHelp : " 1 5) | |
5942 (pr-insert-button 'pr-interface-help "Interface Help" " ") | |
5943 (pr-insert-button 'pr-help "Menu Help" " ") | |
5944 (pr-insert-button 'pr-interface-quit "Quit" "\n ") | |
5945 (pr-insert-button 'pr-kill-help "Kill All Printing Help Buffer")) | |
5946 | |
5947 | |
5948 (defun pr-kill-help (&rest ignore) | |
5949 "Kill all printing help buffer." | |
5950 (interactive) | |
5951 (let ((help '("*Printing Interface Help*" "*Printing Help*" | |
5952 "*LPR Setup*" "*PR Setup*" "*PS Setup*"))) | |
5953 (while help | |
5954 (let ((buffer (get-buffer (car help)))) | |
5955 (setq help (cdr help)) | |
5956 (when buffer | |
5957 (delete-windows-on buffer) | |
5958 (kill-buffer buffer))))) | |
5959 (recenter (- (window-height) 2))) | |
5960 | |
5961 | |
5962 (defun pr-interface-quit (&rest ignore) | |
5963 "Kill the printing buffer interface and quit." | |
5964 (interactive) | |
5965 (kill-buffer pr-buffer-name) | |
5966 (set-window-configuration pr-i-window-configuration)) | |
5967 | |
5968 | |
5969 (defun pr-interface-help (&rest ignore) | |
5970 "printing buffer interface help." | |
5971 (interactive) | |
5972 (pr-show-setup pr-interface-help-message "*Printing Interface Help*")) | |
5973 | |
5974 | |
5975 (defun pr-interface-txt-print (&rest ignore) | |
5976 "Print using lpr package." | |
5977 (interactive) | |
5978 (condition-case data | |
5979 (cond | |
5980 ((eq pr-i-process 'directory) | |
5981 (pr-i-directory) | |
5982 (pr-interface-save | |
5983 (pr-txt-directory pr-i-directory pr-i-regexp))) | |
5984 ((eq pr-i-process 'buffer) | |
5985 (pr-interface-save | |
5986 (cond (pr-i-region | |
5987 (let ((pr-auto-mode pr-i-mode)) | |
5988 (pr-txt-region))) | |
5989 (pr-i-mode | |
5990 (let (pr-auto-region) | |
5991 (pr-txt-mode))) | |
5992 (t | |
5993 (let (pr-auto-mode pr-auto-region) | |
5994 (pr-txt-buffer))) | |
5995 ))) | |
5996 ((eq pr-i-process 'file) | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5997 (error "Please specify a text file")) |
49646 | 5998 (t |
5999 (error "Internal error: `pr-i-process' = %S" pr-i-process)) | |
6000 ) | |
6001 ;; handlers | |
6002 ((quit error) | |
6003 (ding) | |
6004 (message (error-message-string data))))) | |
6005 | |
6006 | |
6007 (defun pr-interface-printify (&rest ignore) | |
6008 "Printify a buffer." | |
6009 (interactive) | |
6010 (condition-case data | |
6011 (cond | |
6012 ((eq pr-i-process 'directory) | |
6013 (pr-i-directory) | |
6014 (pr-interface-save | |
6015 (pr-printify-directory pr-i-directory pr-i-regexp))) | |
6016 ((eq pr-i-process 'buffer) | |
6017 (pr-interface-save | |
6018 (if pr-i-region | |
6019 (pr-printify-region) | |
6020 (pr-printify-buffer)))) | |
6021 ((eq pr-i-process 'file) | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6022 (error "Cannot printify a PostScript file")) |
49646 | 6023 (t |
6024 (error "Internal error: `pr-i-process' = %S" pr-i-process)) | |
6025 ) | |
6026 ;; handlers | |
6027 ((quit error) | |
6028 (ding) | |
6029 (message (error-message-string data))))) | |
6030 | |
6031 | |
6032 (defun pr-interface-ps-print (&rest ignore) | |
6033 "Print using ps-print package." | |
6034 (interactive) | |
6035 (pr-interface-ps 'pr-despool-ps-print 'pr-ps-directory-ps-print | |
6036 'pr-ps-file-ps-print 'pr-ps-file-up-ps-print | |
6037 'pr-ps-region-ps-print 'pr-ps-mode-ps-print | |
6038 'pr-ps-buffer-ps-print)) | |
6039 | |
6040 | |
6041 (defun pr-interface-preview (&rest ignore) | |
6042 "Preview a PostScript file." | |
6043 (interactive) | |
6044 (pr-interface-ps 'pr-despool-preview 'pr-ps-directory-preview | |
6045 'pr-ps-file-preview 'pr-ps-file-up-preview | |
6046 'pr-ps-region-preview 'pr-ps-mode-preview | |
6047 'pr-ps-buffer-preview)) | |
6048 | |
6049 | |
6050 (defun pr-interface-ps (ps-despool ps-directory ps-file ps-file-up ps-region | |
6051 ps-mode ps-buffer) | |
6052 (condition-case data | |
6053 (let ((outfile (or (and (eq pr-i-process 'file) pr-i-ps-as-is) | |
6054 (pr-i-ps-send)))) | |
6055 (cond | |
6056 ((and pr-i-despool pr-spool-p) | |
6057 (pr-interface-save | |
6058 (funcall ps-despool outfile)) | |
6059 (setq pr-i-despool nil) | |
6060 (pr-update-checkbox 'pr-i-despool)) | |
6061 ((eq pr-i-process 'directory) | |
6062 (pr-i-directory) | |
6063 (pr-interface-save | |
6064 (funcall ps-directory | |
6065 pr-i-n-up pr-i-directory pr-i-regexp outfile))) | |
6066 ((eq pr-i-process 'file) | |
6067 (cond ((or (file-directory-p pr-i-ps-file) | |
6068 (not (file-readable-p pr-i-ps-file))) | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6069 (error "Please specify a readable PostScript file")) |
49646 | 6070 (pr-i-ps-as-is |
6071 (pr-interface-save | |
6072 (funcall ps-file pr-i-ps-file))) | |
6073 (t | |
6074 (pr-interface-save | |
6075 (funcall ps-file-up pr-i-n-up pr-i-ps-file outfile))) | |
6076 )) | |
6077 ((eq pr-i-process 'buffer) | |
6078 (pr-interface-save | |
6079 (cond (pr-i-region | |
6080 (let ((pr-auto-mode pr-i-mode)) | |
6081 (funcall ps-region pr-i-n-up outfile))) | |
6082 (pr-i-mode | |
6083 (let (pr-auto-region) | |
6084 (funcall ps-mode pr-i-n-up outfile))) | |
6085 (t | |
6086 (let (pr-auto-mode pr-auto-region) | |
6087 (funcall ps-buffer pr-i-n-up outfile))) | |
6088 ))) | |
6089 (t | |
6090 (error "Internal error: `pr-i-process' = %S" pr-i-process)) | |
6091 )) | |
6092 ;; handlers | |
6093 ((quit error) | |
6094 (ding) | |
6095 (message (error-message-string data))))) | |
6096 | |
6097 | |
6098 (defun pr-i-ps-send () | |
6099 (cond ((eq pr-i-ps-send 'printer) | |
6100 nil) | |
6101 ((not (eq pr-i-ps-send 'file)) | |
6102 (error "Internal error: `pr-i-ps-send' = %S" pr-i-ps-send)) | |
6103 ((or (file-directory-p pr-i-out-file) | |
6104 (not (file-writable-p pr-i-out-file))) | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6105 (error "Please specify a writable PostScript file")) |
49646 | 6106 ((or (not (file-exists-p pr-i-out-file)) |
6107 pr-i-answer-yes | |
6108 (setq pr-i-answer-yes | |
6109 (y-or-n-p (format "File `%s' exists; overwrite? " | |
6110 pr-i-out-file)))) | |
6111 pr-i-out-file) | |
6112 (t | |
6113 (error "File already exists")))) | |
6114 | |
6115 | |
6116 (defun pr-i-directory () | |
6117 (or (and (file-directory-p pr-i-directory) | |
6118 (file-readable-p pr-i-directory)) | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6119 (error "Please specify be a readable directory"))) |
49646 | 6120 |
6121 | |
6122 (defun pr-interface-directory (widget &rest ignore) | |
6123 (and pr-buffer-verbose | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6124 (message "You can use M-TAB or ESC TAB for file completion")) |
49646 | 6125 (let ((dir (widget-value widget))) |
6126 (and (file-directory-p dir) | |
6127 (file-readable-p dir) | |
6128 (setq pr-i-directory dir)))) | |
6129 | |
6130 | |
6131 (defun pr-interface-infile (widget &rest ignore) | |
6132 (and pr-buffer-verbose | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6133 (message "You can use M-TAB or ESC TAB for file completion")) |
49646 | 6134 (let ((file (widget-value widget))) |
6135 (and (not (file-directory-p file)) | |
6136 (file-readable-p file) | |
6137 (setq pr-i-ps-file file)))) | |
6138 | |
6139 | |
6140 (defun pr-interface-outfile (widget &rest ignore) | |
6141 (setq pr-i-answer-yes nil) | |
6142 (and pr-buffer-verbose | |
54146
2a5eca2838d1
A lot of doc fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6143 (message "You can use M-TAB or ESC TAB for file completion")) |
49646 | 6144 (let ((file (widget-value widget))) |
6145 (and (not (file-directory-p file)) | |
6146 (file-writable-p file) | |
6147 (setq pr-i-out-file file)))) | |
6148 | |
6149 | |
6150 (defun pr-widget-field-action (widget event) | |
6151 (and (get-buffer "*Completions*") ; clean frame window | |
6152 (delete-windows-on "*Completions*")) | |
6153 (message " ") ; clean echo area | |
6154 (widget-field-action widget event)) | |
6155 | |
6156 | |
6157 (defun pr-insert-italic (str &optional from to) | |
6158 (let ((len (length str))) | |
6159 (put-text-property (if from (max from 0) 0) | |
6160 (if to (max to len) len) | |
6161 'face 'italic str) | |
6162 (widget-insert str))) | |
6163 | |
6164 | |
6165 (defun pr-insert-checkbox (before var-sym fun label) | |
6166 (widget-insert before) | |
6167 (prog1 | |
6168 (widget-create 'checkbox | |
6169 :notify fun | |
6170 (symbol-value var-sym)) | |
6171 (widget-insert label))) | |
6172 | |
6173 | |
6174 (defun pr-insert-toggle (var-sym label) | |
6175 (widget-create 'checkbox | |
6176 :notify `(lambda (&rest ignore) | |
6177 (setq ,var-sym (not ,var-sym))) | |
6178 (symbol-value var-sym)) | |
6179 (widget-insert label)) | |
6180 | |
6181 | |
6182 (defun pr-insert-button (fun label &optional separator) | |
6183 (widget-create 'push-button | |
6184 :notify fun | |
6185 label) | |
6186 (and separator | |
6187 (widget-insert separator))) | |
6188 | |
6189 | |
6190 (defun pr-insert-menu (tag var-sym choices &optional before after &rest body) | |
6191 (and before (widget-insert before)) | |
6192 (eval `(widget-create 'menu-choice | |
6193 :tag ,tag | |
6194 :format "%v" | |
6195 :inline t | |
6196 :value ,var-sym | |
6197 :notify (lambda (widget &rest ignore) | |
6198 (setq ,var-sym (widget-value widget)) | |
6199 ,@body) | |
6200 :void '(choice-item :format "%[%t%]" | |
6201 :tag "Can not display value!") | |
6202 ,@choices)) | |
6203 (and after (widget-insert after))) | |
6204 | |
6205 | |
6206 (defun pr-insert-radio-button (var-sym sym) | |
6207 (widget-insert "\n") | |
6208 (let ((wid-list (get var-sym 'pr-widget-list)) | |
6209 (wid (eval `(widget-create | |
6210 'radio-button | |
6211 :format " %[%v%]" | |
6212 :value (eq ,var-sym (quote ,sym)) | |
6213 :notify (lambda (&rest ignore) | |
6214 (setq ,var-sym (quote ,sym)) | |
6215 (pr-update-radio-button (quote ,var-sym))))))) | |
6216 (put var-sym 'pr-widget-list (cons (cons wid sym) wid-list)))) | |
6217 | |
6218 | |
6219 (defun pr-update-radio-button (var-sym) | |
6220 (let ((wid-list (get var-sym 'pr-widget-list))) | |
6221 (while wid-list | |
6222 (let ((wid (car (car wid-list))) | |
6223 (value (cdr (car wid-list)))) | |
6224 (setq wid-list (cdr wid-list)) | |
6225 (widget-value-set wid (eq (symbol-value var-sym) value)))) | |
6226 (widget-setup))) | |
6227 | |
6228 | |
6229 (defun pr-update-checkbox (var-sym) | |
6230 (let ((wid (get var-sym 'pr-widget))) | |
6231 (when wid | |
6232 (widget-value-set wid (symbol-value var-sym)) | |
6233 (widget-setup)))) | |
6234 | |
6235 | |
6236 (defun pr-choice-alist (alist) | |
6237 (let ((max (apply 'max (mapcar #'(lambda (alist) | |
6238 (length (symbol-name (car alist)))) | |
6239 alist)))) | |
6240 (mapcar #'(lambda (alist) | |
6241 (let* ((sym (car alist)) | |
6242 (name (symbol-name sym))) | |
6243 (list | |
6244 'quote | |
6245 (list | |
6246 'choice-item | |
6247 :format "%[%t%]" | |
6248 :tag (concat name | |
6249 (make-string (- max (length name)) ?_)) | |
6250 :value sym)))) | |
6251 alist))) | |
6252 | |
6253 | |
6254 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
6255 | |
6256 | |
6257 (pr-update-menus t) | |
6258 | |
6259 | |
6260 (provide 'printing) | |
6261 | |
6262 | |
52401 | 6263 ;;; arch-tag: 9ce9ac3f-0f60-4370-900b-1943215d9d18 |
49646 | 6264 ;;; printing.el ends here |