Function: w32-direct-print-region-function

w32-direct-print-region-function is a byte-compiled function defined in dos-w32.el.gz.

Signature

(w32-direct-print-region-function START END &optional LPR-PROG DELETE-TEXT BUF DISPLAY &rest REST)

Documentation

DOS/Windows-specific function to print the region on a printer.

Writes the region to the device or file which is a value of printer-name (which see), unless the value of lpr-command indicates a specific program should be invoked.

Aliases

direct-print-region-function (obsolete since 24.4)

Source Code

;; Defined in /usr/src/emacs/lisp/dos-w32.el.gz
(defun w32-direct-print-region-function (start end
                                               &optional lpr-prog
                                               delete-text buf display
                                               &rest rest)
  "DOS/Windows-specific function to print the region on a printer.
Writes the region to the device or file which is a value of
`printer-name' (which see), unless the value of `lpr-command'
indicates a specific program should be invoked."

  ;; DOS printers need the lines to end with CR-LF pairs, so make
  ;; sure it always happens that way, unless the buffer is binary.
  (let* ((coding coding-system-for-write)
	 (coding-base
	  (if (null coding) 'undecided (coding-system-base coding)))
	 (eol-type (coding-system-eol-type coding-base))
	 ;; Make each print-out eject the final page, but don't waste
	 ;; paper if the file ends with a form-feed already.
	 (write-region-annotate-functions
	  (cons
	   (lambda (_start end)
	     (if (not (char-equal (char-before end) ?\f))
		 `((,end . "\f"))))
	   write-region-annotate-functions))
	 (printer (or (and (boundp 'dos-printer)
			   (stringp (symbol-value 'dos-printer))
			   (symbol-value 'dos-printer))
		      printer-name
		      (default-printer-name))))
    (or (eq coding-system-for-write 'no-conversion)
	(setq coding-system-for-write
	      (aref eol-type 1)))	; force conversion to DOS EOLs
    (w32-direct-print-region-helper printer start end lpr-prog
                                    delete-text buf display rest)))