diff options
| author | Andrew Innes | 1999-01-17 18:57:20 +0000 |
|---|---|---|
| committer | Andrew Innes | 1999-01-17 18:57:20 +0000 |
| commit | 52cf535f30ce1451cf6370af483f73a05fd5cfe9 (patch) | |
| tree | 5b425e76918a0743bccd0c5c71a270e502f94a92 | |
| parent | 1ccaea525e5580acbd88624ecc9554d2a6b7d641 (diff) | |
| download | emacs-52cf535f30ce1451cf6370af483f73a05fd5cfe9.tar.gz emacs-52cf535f30ce1451cf6370af483f73a05fd5cfe9.zip | |
(ps-printer-name): Update docstring about usage on
MS-DOS and MS-Windows.
(ps-lpr-command): Update docstring as for lpr-command.
(ps-print-region-function): New variable.
(ps-do-despool): Use it.
(ps-do-despool) [ms-dos, windows-nt]: Remove special case code for
DOS/Windows.
| -rw-r--r-- | lisp/ps-print.el | 77 |
1 files changed, 36 insertions, 41 deletions
diff --git a/lisp/ps-print.el b/lisp/ps-print.el index 995c6b5f386..1b3f3855d41 100644 --- a/lisp/ps-print.el +++ b/lisp/ps-print.el | |||
| @@ -1027,28 +1027,33 @@ For more information about PostScript document comments, see: | |||
| 1027 | "*The name of a local printer for printing PostScript files. | 1027 | "*The name of a local printer for printing PostScript files. |
| 1028 | 1028 | ||
| 1029 | On Unix-like systems, a string value should be a name understood by | 1029 | On Unix-like systems, a string value should be a name understood by |
| 1030 | lpr's -P option; otherwise the value should be nil. | 1030 | lpr's -P option; a value of nil means use the value of `printer-name' |
| 1031 | 1031 | instead. Any other value will be ignored. | |
| 1032 | On MS-DOS and MS-Windows systems, if the value is a string, then it is | 1032 | |
| 1033 | taken as the name of the device to which PostScript files are written. | 1033 | On MS-DOS and MS-Windows systems, a string value is taken as the name of |
| 1034 | By default it is the same as `printer-name'; typical non-default | 1034 | the printer device or port to which PostScript files are written, |
| 1035 | settings would be \"LPT1\" to \"LPT3\" for parallel printers, or | 1035 | provided `ps-lpr-command' is \"\". By default it is the same as |
| 1036 | \"COM1\" to \"COM4\" or \"AUX\" for serial printers, or | 1036 | `printer-name'; typical non-default settings would be \"LPT1\" to |
| 1037 | \"//hostname/printer\" for a shared network printer. You can also set | 1037 | \"LPT3\" for parallel printers, or \"COM1\" to \"COM4\" or \"AUX\" for |
| 1038 | it to a name of a file, in which case the output gets appended to that | 1038 | serial printers, or \"//hostname/printer\" for a shared network printer. |
| 1039 | file. \(Note that `ps-print' package already has facilities for | 1039 | You can also set it to a name of a file, in which case the output gets |
| 1040 | printing to a file, so you might as well use them instead of changing | 1040 | appended to that file. \(Note that `ps-print' package already has |
| 1041 | the setting of this variable.\) If you want to silently discard the | 1041 | facilities for printing to a file, so you might as well use them instead |
| 1042 | printed output, set this to \"NUL\". | 1042 | of changing the setting of this variable.\) If you want to silently |
| 1043 | 1043 | discard the printed output, set this to \"NUL\"." | |
| 1044 | On DOS/Windows, if the value is anything but a string, PostScript files | 1044 | :type '(choice file) |
| 1045 | will be piped to the program given by `ps-lpr-command', with switches | ||
| 1046 | given by `ps-lpr-switches', which see." | ||
| 1047 | :type '(choice file (other :tag "Pipe to ps-lpr-command" pipe)) | ||
| 1048 | :group 'ps-print) | 1045 | :group 'ps-print) |
| 1049 | 1046 | ||
| 1050 | (defcustom ps-lpr-command lpr-command | 1047 | (defcustom ps-lpr-command lpr-command |
| 1051 | "*The shell command for printing a PostScript file." | 1048 | "*Name of program for printing a PostScript file. |
| 1049 | |||
| 1050 | On MS-DOS and MS-Windows systems, if the value is an empty string then | ||
| 1051 | Emacs will write directly to the printer port named by `ps-printer-name'. | ||
| 1052 | The programs `print' and `nprint' (the standard print programs on Windows | ||
| 1053 | NT and Novell Netware respectively) are handled specially, using | ||
| 1054 | `ps-printer-name' as the destination for output; any other program is | ||
| 1055 | treated like `lpr' except that an explicit filename is given as the last | ||
| 1056 | argument." | ||
| 1052 | :type 'string | 1057 | :type 'string |
| 1053 | :group 'ps-print) | 1058 | :group 'ps-print) |
| 1054 | 1059 | ||
| @@ -1057,6 +1062,12 @@ given by `ps-lpr-switches', which see." | |||
| 1057 | :type '(repeat string) | 1062 | :type '(repeat string) |
| 1058 | :group 'ps-print) | 1063 | :group 'ps-print) |
| 1059 | 1064 | ||
| 1065 | (defcustom ps-print-region-function nil | ||
| 1066 | "Function to call to print the region on a PostScript printer. | ||
| 1067 | See definition of `ps-do-despool' for calling conventions." | ||
| 1068 | :type 'function | ||
| 1069 | :group 'ps-print) | ||
| 1070 | |||
| 1060 | ;;; Page layout | 1071 | ;;; Page layout |
| 1061 | 1072 | ||
| 1062 | ;; All page dimensions are in PostScript points. | 1073 | ;; All page dimensions are in PostScript points. |
| @@ -4229,28 +4240,12 @@ If FACE is not a valid face name, it is used default face." | |||
| 4229 | (and (stringp ps-printer-name) | 4240 | (and (stringp ps-printer-name) |
| 4230 | (list (concat "-P" ps-printer-name))) | 4241 | (list (concat "-P" ps-printer-name))) |
| 4231 | ps-lpr-switches))) | 4242 | ps-lpr-switches))) |
| 4232 | (if (and (memq system-type '(ms-dos windows-nt)) | 4243 | (apply (or ps-print-region-function 'call-process-region) |
| 4233 | (or (and (boundp 'dos-ps-printer) | 4244 | (point-min) (point-max) ps-lpr-command nil |
| 4234 | (stringp (symbol-value 'dos-ps-printer))) | 4245 | (and (fboundp 'start-process) 0) |
| 4235 | (stringp ps-printer-name))) | 4246 | nil |
| 4236 | (let ((printer (or (and (boundp 'dos-ps-printer) | 4247 | (ps-flatten-list ; dynamic evaluation |
| 4237 | (stringp (symbol-value 'dos-ps-printer)) | 4248 | (mapcar 'ps-eval-switch ps-lpr-switches))))) |
| 4238 | (symbol-value 'dos-ps-printer)) | ||
| 4239 | ps-printer-name)) | ||
| 4240 | ;; It seems that we must be careful about the | ||
| 4241 | ;; directory name that gets added by write-region | ||
| 4242 | ;; when using the standard "PRN" or "LPTx" ports. | ||
| 4243 | ;; The call can fail if the directory is on a | ||
| 4244 | ;; network drive. | ||
| 4245 | (safe-dir (or (getenv "windir") (getenv "TMPDIR") "c:/"))) | ||
| 4246 | (write-region (point-min) (point-max) | ||
| 4247 | (expand-file-name printer safe-dir) t 0)) | ||
| 4248 | (apply 'call-process-region | ||
| 4249 | (point-min) (point-max) ps-lpr-command nil | ||
| 4250 | (and (fboundp 'start-process) 0) | ||
| 4251 | nil | ||
| 4252 | (ps-flatten-list ; dynamic evaluation | ||
| 4253 | (mapcar 'ps-eval-switch ps-lpr-switches)))))) | ||
| 4254 | (and ps-razzle-dazzle (message "Printing...done"))) | 4249 | (and ps-razzle-dazzle (message "Printing...done"))) |
| 4255 | (kill-buffer ps-spool-buffer))) | 4250 | (kill-buffer ps-spool-buffer))) |
| 4256 | 4251 | ||