diff options
| author | Geoff Voelker | 1998-12-02 23:01:50 +0000 |
|---|---|---|
| committer | Geoff Voelker | 1998-12-02 23:01:50 +0000 |
| commit | 36f22224e1b22e6a45448ba634cd6ea57e44e152 (patch) | |
| tree | c0375cb168e7efdb151c050e25de63882b218bd5 | |
| parent | 83c75055bc8fc08b34422b2976d442f7f8127cc8 (diff) | |
| download | emacs-36f22224e1b22e6a45448ba634cd6ea57e44e152.tar.gz emacs-36f22224e1b22e6a45448ba634cd6ea57e44e152.zip | |
(direct-print-region-function): Try to ensure that
printer-name is expanded to a file name on a local drive;
sometimes printing a file loaded from a network volume fails.
(direct-print-region-function): Add a function to
write-region-annotate-functions to append a formfeed character to
the region being printed, if the region doesn't end with a
formfeed already. This avoids creating a second print job
containing a blank page when print spooling is enabled on Windows.
| -rw-r--r-- | lisp/dos-w32.el | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/lisp/dos-w32.el b/lisp/dos-w32.el index 4adeb7752b4..624519b6ff7 100644 --- a/lisp/dos-w32.el +++ b/lisp/dos-w32.el | |||
| @@ -273,21 +273,29 @@ START and END." | |||
| 273 | (let* ((coding coding-system-for-write) | 273 | (let* ((coding coding-system-for-write) |
| 274 | (coding-base | 274 | (coding-base |
| 275 | (if (null coding) 'undecided (coding-system-base coding))) | 275 | (if (null coding) 'undecided (coding-system-base coding))) |
| 276 | (eol-type (coding-system-eol-type coding-base))) | 276 | (eol-type (coding-system-eol-type coding-base)) |
| 277 | (write-region-annotate-functions | ||
| 278 | (cons | ||
| 279 | (lambda (start end) | ||
| 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 | `((,end . "\f")))) | ||
| 284 | write-region-annotate-functions))) | ||
| 277 | (or (eq coding-system-for-write 'no-conversion) | 285 | (or (eq coding-system-for-write 'no-conversion) |
| 278 | (setq coding-system-for-write | 286 | (setq coding-system-for-write |
| 279 | (aref eol-type 1))) ; force conversion to DOS EOLs | 287 | (aref eol-type 1))) ; force conversion to DOS EOLs |
| 280 | (write-region start end | 288 | (let ((printer (or (and (boundp 'dos-printer) |
| 281 | (or (and (boundp 'dos-printer) dos-printer) | 289 | (stringp (symbol-value 'dos-printer)) |
| 282 | printer-name) | 290 | (symbol-value 'dos-printer)) |
| 283 | t 0) | 291 | printer-name)) |
| 284 | ;; Make each print-out start on a new page, but don't waste | 292 | ;; It seems that we must be careful about the directory name |
| 285 | ;; paper if there was a form-feed at the end of this file. | 293 | ;; that gets added by write-region when using the standard |
| 286 | (if (not (char-equal (char-after (1- end)) ?\C-l)) | 294 | ;; "PRN" or "LPTx" ports. The call can fail if the directory |
| 287 | (write-region "\f" nil | 295 | ;; is on a network drive. |
| 288 | (or (and (boundp 'dos-printer) dos-printer) | 296 | (safe-dir (or (getenv "windir") (getenv "TMPDIR") "c:/"))) |
| 289 | printer-name) | 297 | (write-region start end |
| 290 | t 0)))) | 298 | (expand-file-name printer safe-dir) t 0)))) |
| 291 | 299 | ||
| 292 | ;; Set this to nil if you have a port of the `lpr' program and | 300 | ;; Set this to nil if you have a port of the `lpr' program and |
| 293 | ;; you want to use it for printing. If the default setting is | 301 | ;; you want to use it for printing. If the default setting is |