diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-05-06 13:38:02 -0300 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-05-06 13:38:02 -0300 |
commit | 6c19f744bb93693e848d4045891733688cbcb9eb (patch) | |
tree | 58afbf43275ff479fdec3d5e599658abdb577cb5 /lisp/lpr.el | |
parent | af4c0e284957da53404fbdd7c80fe0f5c22f8599 (diff) | |
download | emacs-6c19f744bb93693e848d4045891733688cbcb9eb.tar.gz |
* lisp/lpr.el (print-region-1): Echo lpr-program's output, so error messages
and warnings are not silently discarded (e.g. use "-d" instead of "-P").
Diffstat (limited to 'lisp/lpr.el')
-rw-r--r-- | lisp/lpr.el | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/lisp/lpr.el b/lisp/lpr.el index 709f992b2b8..76c69f3308c 100644 --- a/lisp/lpr.el +++ b/lisp/lpr.el @@ -29,6 +29,8 @@ ;;; Code: +(eval-when-compile (require 'cl)) + ;;;###autoload (defvar lpr-windows-system (memq system-type '(ms-dos windows-nt))) @@ -258,21 +260,30 @@ for further customization of the printer command." lpr-page-header-switches))) (setq start (point-min) end (point-max)))) - (apply (or print-region-function 'call-process-region) - (nconc (list start end lpr-command - nil nil nil) - (and lpr-add-switches - (list "-J" name)) - ;; These belong in pr if we are using that. - (and lpr-add-switches lpr-headers-switches - (list "-T" title)) - (and (stringp printer-name) - (list (concat lpr-printer-switch - printer-name))) - nswitches)) - (if (markerp end) - (set-marker end nil)) - (message "Spooling%s...done" switch-string)))) + (let ((buf (current-buffer))) + (with-temp-buffer + (let ((tempbuf (current-buffer))) + (with-current-buffer buf + (apply (or print-region-function 'call-process-region) + (nconc (list start end lpr-command + nil tempbuf nil) + (and lpr-add-switches + (list "-J" name)) + ;; These belong in pr if we are using that. + (and lpr-add-switches lpr-headers-switches + (list "-T" title)) + (and (stringp printer-name) + (list (concat lpr-printer-switch + printer-name))) + nswitches)))) + (if (markerp end) + (set-marker end nil)) + (message "Spooling%s...done%s%s" switch-string + (case (count-lines (point-min) (point-max)) + (0 "") + (1 ": ") + (t ":\n")) + (buffer-string))))))) ;; This function copies the text between start and end ;; into a new buffer, makes that buffer current. |