diff options
| author | Richard M. Stallman | 1998-07-03 19:54:01 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-07-03 19:54:01 +0000 |
| commit | 5a0aa6443e4e04d351fb97872ddc44e81e74b272 (patch) | |
| tree | eaf821d00df42f406103a363af1effb44bf405a8 | |
| parent | 3efcc61ef6c46a84e5715e0a9cdd99a325f30760 (diff) | |
| download | emacs-5a0aa6443e4e04d351fb97872ddc44e81e74b272.tar.gz emacs-5a0aa6443e4e04d351fb97872ddc44e81e74b272.zip | |
(direct-print-region-function): Renamed from
dos-print-region-function. Added &rest keyword.
(print-region-function): Set to direct-print-region-function.
(lpr-headers-switches): Initialize.
(ps-lpr-command): Initialize.
(ps-lpr-switches): Initialize.
| -rw-r--r-- | lisp/dos-w32.el | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/lisp/dos-w32.el b/lisp/dos-w32.el index b2f2fb138ad..b945dca075f 100644 --- a/lisp/dos-w32.el +++ b/lisp/dos-w32.el | |||
| @@ -252,6 +252,62 @@ filesystem mounted on drive Z:, FILESYSTEM could be \"Z:\"." | |||
| 252 | '(raw-text-dos . raw-text-dos) | 252 | '(raw-text-dos . raw-text-dos) |
| 253 | '(undecided-dos . undecided-dos))) | 253 | '(undecided-dos . undecided-dos))) |
| 254 | 254 | ||
| 255 | ;; Support for printing under DOS/Windows, see lpr.el and ps-print.el. | ||
| 256 | (defvar printer-name) | ||
| 257 | |||
| 258 | (defun direct-print-region-function (start end | ||
| 259 | &optional lpr-prog | ||
| 260 | delete-text buf display | ||
| 261 | &rest rest) | ||
| 262 | "DOS/Windows-specific function to print the region on a printer. | ||
| 263 | Writes the region to the device or file which is a value of | ||
| 264 | `printer-name' \(which see\). Ignores any arguments beyond | ||
| 265 | START and END." | ||
| 266 | |||
| 267 | ;; DOS printers need the lines to end with CR-LF pairs, so make | ||
| 268 | ;; sure it always happens that way, unless the buffer is binary. | ||
| 269 | (let* ((coding coding-system-for-write) | ||
| 270 | (coding-base | ||
| 271 | (if (null coding) 'undecided (coding-system-base coding))) | ||
| 272 | (eol-type (coding-system-eol-type coding-base))) | ||
| 273 | (or (eq coding-system-for-write 'no-conversion) | ||
| 274 | (setq coding-system-for-write | ||
| 275 | (aref eol-type 1))) ; force conversion to DOS EOLs | ||
| 276 | (write-region start end | ||
| 277 | (or (and (boundp 'dos-printer) dos-printer) | ||
| 278 | printer-name) | ||
| 279 | t 0) | ||
| 280 | ;; Make each print-out start on a new page, but don't waste | ||
| 281 | ;; paper if there was a form-feed at the end of this file. | ||
| 282 | (if (not (char-equal (char-after (1- end)) ?\C-l)) | ||
| 283 | (write-region "\f" nil | ||
| 284 | (or (and (boundp 'dos-printer) dos-printer) | ||
| 285 | printer-name) | ||
| 286 | t 0)))) | ||
| 287 | |||
| 288 | ;; Set this to nil if you have a port of the `lpr' program and | ||
| 289 | ;; you want to use it for printing. If the default setting is | ||
| 290 | ;; in effect, `lpr-command' and its switches are ignored when | ||
| 291 | ;; printing with `lpr-xxx' and `print-xxx'. | ||
| 292 | (setq print-region-function 'direct-print-region-function) | ||
| 293 | |||
| 294 | ;; Set this to nil if you have a port of the `pr' program | ||
| 295 | ;; (e.g., from GNU Textutils), or if you have an `lpr' | ||
| 296 | ;; program (see above) that can print page headers. | ||
| 297 | ;; If `lpr-headers-switches' is non-nil (the default) and | ||
| 298 | ;; `print-region-function' is set to `dos-print-region-function', | ||
| 299 | ;; then requests to print page headers will be silently | ||
| 300 | ;; ignored, and `print-buffer' and `print-region' produce | ||
| 301 | ;; the same output as `lpr-buffer' and `lpr-region', accordingly. | ||
| 302 | (setq lpr-headers-switches "(page headers are not supported)") | ||
| 303 | |||
| 304 | (defvar ps-printer-name) | ||
| 305 | |||
| 306 | (setq ps-lpr-command "gs") | ||
| 307 | |||
| 308 | (setq ps-lpr-switches '("-q" "-dNOPAUSE" "-sDEVICE=epson" "-r240x60" | ||
| 309 | "-sOutputFile=LPT1" "-")) | ||
| 310 | |||
| 255 | (provide 'dos-w32) | 311 | (provide 'dos-w32) |
| 256 | 312 | ||
| 257 | ;;; dos-w32.el ends here | 313 | ;;; dos-w32.el ends here |