changeset 24380:6ef51f9beabc

(handwrite): Require ps-print, and use ps-printer-name and ps-lpr-command. Call ps-print-region-function if it's defined, instead of forking ps-lpr-command unconditionally.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 22 Feb 1999 13:37:10 +0000
parents 18002ef8ce0d
children b3c0f3ad64d8
files lisp/play/handwrite.el
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/play/handwrite.el	Mon Feb 22 12:46:52 1999 +0000
+++ b/lisp/play/handwrite.el	Mon Feb 22 13:37:10 1999 +0000
@@ -1,4 +1,4 @@
-;;; handwrite.el --- turns your emacs buffer into a handwritten document.
+;;; handwrite.el --- turns your emacs buffer into a handwritten document -*- coding: iso-latin-1; -*-
 
 ;; (C) Copyright 1996 Free Software Foundation, Inc.
 
@@ -330,8 +330,17 @@
       (replace-match "" nil t) )
     (untabify textp (point-max))	; this may result in strange tabs
     (if (y-or-n-p "Send this to the printer? ")
-	(call-process-region (point-min)
-			     (point-max) lpr-command nil nil nil))
+	(progn
+	  (require 'ps-print)
+	  (let* ((coding-system-for-write 'raw-text-unix)
+		 (ps-printer-name (or ps-printer-name
+				      (and (boundp 'printer-name)
+					   printer-name)))
+		 (ps-lpr-switches
+		  (if (stringp ps-printer-name)
+		      (list (concat "-P" ps-printer-name)))))
+	    (apply (or ps-print-region-function 'call-process-region)
+		   (point-min) (point-max) ps-lpr-command nil nil nil))))
     (message "")
     (bury-buffer ())
     (switch-to-buffer cur-buf)