aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/dos-w32.el32
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