X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/7da17ab65f6f70bc1a4d12605dcbfdb092016bf4..3e56710f649d8c4c198c92e8047f60687e30ad23:/lisp/ps-print.el diff --git a/lisp/ps-print.el b/lisp/ps-print.el index 3a14bcc57f..6f18fd6857 100644 --- a/lisp/ps-print.el +++ b/lisp/ps-print.el @@ -923,6 +923,30 @@ Please send all bug fixes and enhancements to :group 'faces) +(defcustom ps-printer-name printer-name + "*The name of a local printer for printing PostScript files. + +On Unix-like systems, a string value should be a name understood by +lpr's -P option; otherwise the value should be nil. + +On MS-DOS and MS-Windows systems, if the value is a string, then it is +taken as the name of the device to which PostScript files are written. +By default it is the same as `printer-name'; typical non-default +settings would be \"LPT1\" to \"LPT3\" for parallel printers, or +\"COM1\" to \"COM4\" or \"AUX\" for serial printers, or +\"//hostname/printer\" for a shared network printer. You can also set +it to a name of a file, in which case the output gets appended to that +file. \(Note that `ps-print' package already has facilities for +printing to a file, so you might as well use them instead of changing +the setting of this variable.\) If you want to silently discard the +printed output, set this to \"NUL\". + +On DOS/Windows, if the value is anything but a string, PostScript files +will be piped to the program given by `ps-lpr-command', with switches +given by `ps-lpr-switches', which see." + :type '(choice file (other :tag "Pipe to ps-lpr-command" pipe)) + :group 'ps-print) + (defcustom ps-lpr-command lpr-command "*The shell command for printing a PostScript file." :type 'string @@ -1018,7 +1042,7 @@ Valid values are: Any other value is treated as nil." :type '(choice (const 8-bit) (const control-8-bit) - (const control) (const nil)) + (const control) (other :tag "nil" nil)) :group 'ps-print) (defcustom ps-number-of-columns (if ps-landscape-mode 2 1) @@ -3981,11 +4005,23 @@ If FACE is not a valid face name, it is used default face." (and ps-razzle-dazzle (message "Printing...")) (save-excursion (set-buffer ps-spool-buffer) - (let ((coding-system-for-write 'raw-text-unix)) - (if (and (eq system-type 'ms-dos) - (stringp (symbol-value 'dos-ps-printer))) + (let* ((coding-system-for-write 'raw-text-unix) + (ps-printer-name (or ps-printer-name printer-name)) + (ps-lpr-switches + (append + (and (stringp ps-printer-name) + (list (concat "-P" ps-printer-name))) + ps-lpr-switches))) + (if (and (memq system-type '(ms-dos windows-nt)) + (or (and (boundp 'dos-ps-printer) + (stringp (symbol-value 'dos-ps-printer))) + (stringp (symbol-value 'ps-printer-name)))) (write-region (point-min) (point-max) - (symbol-value 'dos-ps-printer) t 0) + (or (and (boundp 'dos-ps-printer) + (stringp (symbol-value 'dos-ps-printer)) + (symbol-value 'dos-ps-printer)) + (symbol-value 'ps-printer-name)) + t 0) (apply 'call-process-region (point-min) (point-max) ps-lpr-command nil (and (fboundp 'start-process) 0)