From: "Michael B. Haynie" Sender: "Michael B. Haynie" To: ntemacs-users@cs.washington.edu Subject: Marginal hacks for printing on NTEmacs Date: Fri, 2 Feb 96 10:23:13 Thanks for the quick responses about getting printing to work on Emacs. Given the description of the real problem (no stdinput print programs...) Here is a marginal hack to the existing printing facilities in lpr.el and ps-print.el that should be compatable with the existing stuff, and still support printing under NT. I won't claim that it is good enough for the distribution, but someone clever may be able to make it good enough to be included... This could be added to an nt specific file, or your _emacs --------------------------->8--------------------------------- (defvar *ntemacs-print-hack-filename* "D:\\temp\\ntemacs-spool.txt") (defun nt-print-region-function (ostart oend program-name deletep outputbuffer displayp &rest program-args) (save-excursion (let ((oldbuf (current-buffer))) (set-buffer (get-buffer-create " *NTEmacs lpr hack buffer*")) (widen) (erase-buffer) (insert-buffer-substring oldbuf ostart oend) (write-file *ntemacs-print-hack-filename*) (shell-command (apply 'concat (append (list program-name " ") program-args (list " " *ntemacs-print-hack-filename*))))))) ---->8---This belongs in your _emacs ------------------------ (setq lpr-command "print" lpr-switches '(" /D:\\\\servername\\printername ") ; your printer device here print-region-function #'nt-print-region-function) ---->8---This replaces the function in ps-print.el------------- (defun ps-do-despool (filename) (if (or (not (boundp 'ps-spool-buffer)) (not ps-spool-buffer)) (message "No spooled PostScript to print") (ps-end-file) (ps-flush-output) (if filename (save-excursion (if ps-razzle-dazzle (message "Saving...")) (set-buffer ps-spool-buffer) (setq filename (expand-file-name filename)) (write-region (point-min) (point-max) filename) (if ps-razzle-dazzle (message "Wrote %s" filename))) ;; Else, spool to the printer (if ps-razzle-dazzle (message "Printing...")) (save-excursion (set-buffer ps-spool-buffer) ;; Here is the only change -- used to just run call-process-region ;; I just allowed print-region-function from the lpr package to be ;; called instead, if it is defined. I hope that this isn't *too* ;; badly broken ;-) (apply (or print-region-function 'call-process-region) (point-min) (point-max) ps-lpr-command nil 0 nil ps-lpr-switches)) (if ps-razzle-dazzle (message "Printing...done"))) (kill-buffer ps-spool-buffer))) ---------------->8----------------------------- Hope this helps. ____/| Michael Haynie \ o.O| ACK! Union Switch & Signal =(_)= THPHTH! U mbhaynie@switch.com