Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!ginosko!uunet!hsi!aati!mlfarm!ron From: ron@mlfarm.UUCP (Ronald Florence) Newsgroups: comp.emacs Subject: using a subprocess for printing Message-ID: <337@mlfarm.UUCP> Date: 7 Oct 89 13:54:37 GMT Organization: Maple Lawn Farm, Stonington, CT Lines: 44 I would welcome suggestions on how to start a subprocess to run troff on the contents of a GNU Emacs buffer. Currently, I use the following code (defun troff-buffer (&optional copies) "Typeset region contents after formatting with `troff -mm -rN2'. Optional prefix argument specifies number of copies." (interactive "P") (let ((buffer (get-buffer-create "*printer command output*"))) (save-excursion (set-buffer buffer) (erase-buffer)) (message "Spooling...") (if (null copies) (setq copies "1")) (call-process-region (point-min) (point-max) "emacstroff" nil buffer nil (concat "-n" copies)) (if (> (buffer-size) 0) (progn (set-buffer buffer) (goto-char (point-min)) (end-of-line) (message "%s" (buffer-substring 1 (point)))) (message "(Printer command failed)"))) (kill-buffer "*printer command output*")) The "emacstroff" is a shell script with printer and troff options : #! /bin/sh # emacstroff troff -t -mm -rN2 | lp -ot $1 It works, but I sit and twiddle my thumbs, staring at the "Spooling..." message while troff formats. Is there a way to use a subprocess to do this? We are running Emacs 18.50 with Xenix 2.3.2, using the select() call. There are plenty of free ptys for subprocesses. Thanks in advance for any suggestions. -- Ronald Florence {hsi,rayssd}!mlfarm!ron