changeset 5267:f7ea27a729b8

(lpr-headers-switches): Treat hpux like usg-unix-v. (print-region-1): Adjust start, end after running pr. (lpr-command): Use dgux, not dgux-unix. (print-region-new-buffer): Rename args to OSTART and OEND. (lpr-headers-switches): New variable. (print-region-1): Use it. (lpr-add-options): New variable. (print-region-1): Obey that.
author Richard M. Stallman <rms@gnu.org>
date Thu, 23 Dec 1993 03:14:40 +0000
parents 0581b0d428e9
children 9043d8936335
files lisp/lpr.el
diffstat 1 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/lpr.el	Thu Dec 23 03:06:30 1993 +0000
+++ b/lisp/lpr.el	Thu Dec 23 03:14:40 1993 +0000
@@ -31,14 +31,20 @@
 
 ;;;###autoload
 (defvar lpr-switches nil 
-  "*List of strings to pass as extra switch args to lpr when it is invoked.")
+  "*List of strings to pass as extra switch args to `lpr' when it is invoked.")
+
+(defvar lpr-add-options (eq system-type 'berkeley-unix)
+  "*Non-nil means construct -T and -J options for the `lpr'.")
 
 ;;;###autoload
 (defvar lpr-command
-  (if (memq system-type '(usg-unix-v dgux-unix hpux irix))
+  (if (memq system-type '(usg-unix-v dgux hpux irix))
       "lp" "lpr")
   "*Shell command for printing a file")
 
+(defvar lpr-headers-switches (or (memq system-type '(usg-unix-v hpux)) "-p")
+  "*List of strings to use as options for `lpr' to request page headings.")
+
 (defvar print-region-function nil
   "Function to call to print the region on a printer.
 See definition of `print-region-1' for calling conventions.")
@@ -85,16 +91,16 @@
 	      (setq end (point-marker)))
 	    (untabify (point-min) (point-max))))
       (if page-headers
-	  (if (eq system-type 'usg-unix-v)
-	      (progn
-		(print-region-new-buffer start end)
-		(call-process-region start end "pr" t t nil))
-	    ;; On BSD, use an option to get page headers.
-	    (setq switches (cons "-p" switches))))
+	  (if lpr-headers-switches
+	      ;; On BSD, use an option to get page headers.
+	      (setq switches (append lpr-headers-switches switches))
+	    (print-region-new-buffer start end)
+	    (call-process-region start end "pr" t t nil)
+	    (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 (eq system-type 'berkeley-unix)
+		    (nconc (and lpr-add-options
 				(list "-J" name "-T" name))
 			   switches)))
       (if (markerp end)
@@ -105,12 +111,12 @@
 ;; into a new buffer, makes that buffer current,
 ;; and sets start and end to the buffer bounds.
 ;; start and end are used free.
-(defun print-region-new-buffer (start end)
+(defun print-region-new-buffer (ostart oend)
   (or (string= (buffer-name) " *spool temp*")
       (let ((oldbuf (current-buffer)))
 	(set-buffer (get-buffer-create " *spool temp*"))
 	(widen) (erase-buffer)
-	(insert-buffer-substring oldbuf start end)
+	(insert-buffer-substring oldbuf ostart oend)
 	(setq start (point-min) end (point-max)))))
 
 (defun printify-region (begin end)