From: Antonio Ruiz Date: Tue, 31 May 2022 11:27:28 +0000 (+0200) Subject: Make handwrite.el printing use more of the ps-print setup X-Git-Tag: emacs-29.0.90~1910^2~317 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f0361c225c7f340cd31f7873ac2f3f6c8df31404;p=emacs.git 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 --- diff --git a/lisp/play/handwrite.el b/lisp/play/handwrite.el index 14624ddce23..0b9f9fb2e6c 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)