diff options
| author | Richard M. Stallman | 1996-01-15 22:50:00 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-01-15 22:50:00 +0000 |
| commit | 868c7abd7c409fa70570f9e342ee8719ad0914a4 (patch) | |
| tree | 734a44ad66434bc25f916b3110d6422c2d70bc22 | |
| parent | 7d93ae3cc30a5d31ed1e30e912012f16076e7ad9 (diff) | |
| download | emacs-868c7abd7c409fa70570f9e342ee8719ad0914a4.tar.gz emacs-868c7abd7c409fa70570f9e342ee8719ad0914a4.zip | |
(ps-lpr-switches, ps-lpr-command): Just setq them;
duplicate defvar is a bad idea.
(dos-printer): New variable, the local printer device.
(dos-print-region-function): New function, used for `print-region-function'.
(dos-ps-printer): New variable; if a string, it's the name of the
local printer device.
(ps-lpr-command, ps-lpr-switches): Set them properly for Ghostscript.
(lpr-headers-switches): Set to non-nil, to disable page headers'
support under MS-DOS.
| -rw-r--r-- | lisp/dos-fns.el | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/lisp/dos-fns.el b/lisp/dos-fns.el index b85bea9e076..b7202d9c2c7 100644 --- a/lisp/dos-fns.el +++ b/lisp/dos-fns.el | |||
| @@ -192,3 +192,71 @@ against the file name, and TYPE is nil for text, t for binary.") | |||
| 192 | (defun select-frame (frame &optional no-enter) | 192 | (defun select-frame (frame &optional no-enter) |
| 193 | "Select FRAME for input events." | 193 | "Select FRAME for input events." |
| 194 | (selected-frame)) | 194 | (selected-frame)) |
| 195 | |||
| 196 | ;; Support for printing under MS-DOS, see lpr.el and ps-print.el. | ||
| 197 | (defvar dos-printer "PRN" | ||
| 198 | "*The name of a local MS-DOS device to which data is sent for printing. | ||
| 199 | \(Note that PostScript files are sent to `dos-ps-printer', which see.\) | ||
| 200 | |||
| 201 | Typical non-default settings would be \"LPT1\" to \"LPT3\" for | ||
| 202 | parallel printers, or \"COM1\" to \"COM4\" or \"AUX\" for serial | ||
| 203 | printers. You can also set it to a name of a file, in which | ||
| 204 | case the output gets appended to that file. | ||
| 205 | If you want to discard the printed output, set this to \"NUL\".") | ||
| 206 | |||
| 207 | (defun dos-print-region-function (start end | ||
| 208 | &optional lpr-prog | ||
| 209 | delete-text buf display rest) | ||
| 210 | "MS-DOS-specific function to print the region on a printer. | ||
| 211 | Writes the region to the device or file which is a value of | ||
| 212 | `dos-printer' \(which see\). Ignores any arguments beyond | ||
| 213 | START and END." | ||
| 214 | |||
| 215 | (write-region start end dos-printer t 0) | ||
| 216 | ;; Make each print-out start on a new page, but don't waste | ||
| 217 | ;; paper if there was a form-feed at the end of this file. | ||
| 218 | (if (not (char-equal (char-after (1- end)) ?\C-l)) | ||
| 219 | (write-region "\f" nil dos-printer t 0))) | ||
| 220 | |||
| 221 | ;; Set this to nil if you have a port of the `lpr' program and | ||
| 222 | ;; you want to use it for printing. If the default setting is | ||
| 223 | ;; in effect, `lpr-command' and its switches are ignored when | ||
| 224 | ;; printing with `lpr-xxx' and `print-xxx'. | ||
| 225 | (setq print-region-function 'dos-print-region-function) | ||
| 226 | |||
| 227 | ;; Set this to nil if you have a port of the `pr' program | ||
| 228 | ;; (e.g., from GNU Textutils), or if you have an `lpr' | ||
| 229 | ;; program (see above) that can print page headers. | ||
| 230 | ;; If `lpr-headers-switches' is non-nil (the default) and | ||
| 231 | ;; `print-region-function' is set to `dos-print-region-function', | ||
| 232 | ;; then requests to print page headers will be silently | ||
| 233 | ;; ignored, and `print-buffer' and `print-region' produce | ||
| 234 | ;; the same output as `lpr-buffer' and `lpr-region', accordingly. | ||
| 235 | (setq lpr-headers-switches "(page headers are not supported)") | ||
| 236 | |||
| 237 | (defvar dos-ps-printer "PRN" | ||
| 238 | "*Method for printing PostScript files under MS-DOS. | ||
| 239 | |||
| 240 | If the value is a string, then it is taken as the name of the | ||
| 241 | device to which PostScript files are written. By default it | ||
| 242 | is the default printer device; typical non-default settings | ||
| 243 | would be \"LPT1\" to \"LPT3\" for parallel printers, or \"COM1\" | ||
| 244 | to \"COM4\" or \"AUX\" for serial printers. You can also set it | ||
| 245 | to a name of a file, in which case the output gets appended | ||
| 246 | to that file. \(Note that `ps-print' package already has | ||
| 247 | facilities for printing to a file, so you might as well use | ||
| 248 | them instead of changing the setting of this variable.\) If | ||
| 249 | you want to silently discard the printed output, set this to \"NUL\". | ||
| 250 | |||
| 251 | If the value is anything but a string, PostScript files will be | ||
| 252 | piped to the program given by `ps-lpr-command', with switches | ||
| 253 | given by `ps-lpr-switches', which see.") | ||
| 254 | |||
| 255 | (setq ps-lpr-command "gs") | ||
| 256 | |||
| 257 | (setq ps-lpr-switches '("-q" "-dNOPAUSE" "-sDEVICE=epson" "-r240x60" | ||
| 258 | "-sOutputFile=LPT1" "-")) | ||
| 259 | |||
| 260 | (provide 'dos-fns) | ||
| 261 | |||
| 262 | ; dos-fns.el ends here | ||