emacs-diffs
[Top][All Lists]
Advanced

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

master f0361c225c: Make handwrite.el printing use more of the ps-print s


From: Lars Ingebrigtsen
Subject: master f0361c225c: Make handwrite.el printing use more of the ps-print setup
Date: Tue, 31 May 2022 07:28:48 -0400 (EDT)

branch: master
commit f0361c225c7f340cd31f7873ac2f3f6c8df31404
Author: Antonio Ruiz <antonioruiz.math@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make handwrite.el printing use more of the ps-print setup
    
    * lisp/play/handwrite.el (handwrite): Allow ps-lpr-printer to be
    computed at runtime (bug#55733).
    
    Copyright-paperwork-exempt: yes
---
 lisp/play/handwrite.el | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/lisp/play/handwrite.el b/lisp/play/handwrite.el
index 14624ddce2..0b9f9fb2e6 100644
--- a/lisp/play/handwrite.el
+++ b/lisp/play/handwrite.el
@@ -58,10 +58,7 @@
 
 ;;; Code:
 
-;; From ps-print.el
-(defvar ps-printer-name)
-(defvar ps-lpr-command)
-(defvar ps-lpr-switches)
+(require 'ps-print)
 
 ;; Variables
 
@@ -235,20 +232,13 @@ Variables: `handwrite-linespace'     (default 12)
     (while (search-forward "\f" nil t)
       (replace-match "" nil t) )
     (untabify textp (point-max))       ; this may result in strange tabs
-    (if (y-or-n-p "Send this to the printer? ")
-       (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 (and (boundp 'ps-print-region-function)
-                           ps-print-region-function)
-                      'call-process-region)
-                  (point-min) (point-max) ps-lpr-command nil nil nil))))
+    (when (y-or-n-p "Send this to the printer? ")
+      (let* ((coding-system-for-write 'raw-text-unix)
+            (printer-name (or ps-printer-name printer-name))
+             (lpr-printer-switch ps-printer-name-option)
+             (print-region-function ps-print-region-function)
+             (lpr-command ps-lpr-command))
+        (lpr-print-region (point-min) (point-max) ps-lpr-switches nil)))
     (message "")
     (bury-buffer ())
     (switch-to-buffer cur-buf)



reply via email to

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