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