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