emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r104142: * lisp/lpr.el (print-region-


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104142: * lisp/lpr.el (print-region-1): Echo lpr-program's output, so error messages
Date: Fri, 06 May 2011 13:38:02 -0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104142
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2011-05-06 13:38:02 -0300
message:
  * 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").
modified:
  lisp/ChangeLog
  lisp/lpr.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-05-06 07:14:30 +0000
+++ b/lisp/ChangeLog    2011-05-06 16:38:02 +0000
@@ -1,3 +1,8 @@
+2011-05-06  Stefan Monnier  <address@hidden>
+
+       * 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").
+
 2011-05-06  Glenn Morris  <address@hidden>
 
        * calendar/appt.el (appt-message-warning-time): Doc fix.

=== modified file 'lisp/lpr.el'
--- a/lisp/lpr.el       2011-01-26 08:36:39 +0000
+++ b/lisp/lpr.el       2011-05-06 16:38:02 +0000
@@ -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 @@
                             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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]