]> code.delx.au - gnu-emacs/blobdiff - lisp/lpr.el
*** empty log message ***
[gnu-emacs] / lisp / lpr.el
index a6fe0459e73775b265af8f0efb67e0186330f1b5..21a1ed24f817f00d6f096a67167b23e1f09854fb 100644 (file)
@@ -115,7 +115,7 @@ See definition of `print-region-1' for calling conventions."
 
 ;; Berkeley systems support -F, and GNU pr supports both -f and -F,
 ;; So it looks like -F is a better default.
-(defcustom lpr-page-header-switches '("-F")
+(defcustom lpr-page-header-switches '("-h" "-F")
   "*List of strings to use as options for the page-header-generating program.
 The variable `lpr-page-header-program' specifies the program to use."
   :type '(repeat string)
@@ -216,20 +216,23 @@ for further customization of the printer command."
              (setq start (car new-coords) end (cdr new-coords)))
            (apply 'call-process-region start end lpr-page-header-program
                                 t t nil
-                                (nconc (list "-h" title)
-                                       lpr-page-header-switches))
+                                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)
-                   (nconc (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 "-P" printer-name)))
-                          switches)))
+      (let ((printer-name-switch (if (memq system-type
+                                          '(usg-unix-v dgux hpux irix))
+                                    "-d" "-P")))
+       (apply (or print-region-function 'call-process-region)
+              (nconc (list start end lpr-command
+                           nil nil nil)
+                     (nconc (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 printer-name-switch
+                                               printer-name)))
+                            switches))))
       (if (markerp end)
          (set-marker end nil))
       (message "Spooling%s...done" switch-string))))