Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!rpi!tale From: tale@pawl.rpi.edu (David C Lawrence) Newsgroups: comp.emacs Subject: Re: using a subprocess for printing Message-ID: <1989Oct11.043450.2633@rpi.edu> Date: 11 Oct 89 04:34:50 GMT References: <337@mlfarm.UUCP> Organization: Rensselaer Polytechnic Institute, Troy NY Lines: 41 [Fourth UUCP bounce today. Blargh.] In <337@mlfarm.UUCP> ron@mlfarm.UUCP (Ronald Florence) writes: Ronald> I would welcome suggestions on how to start a subprocess to run troff Ronald> on the contents of a GNU Emacs buffer. Currently, I use the following Ronald> code Ronald> [Code deleted.] The problem here is that you are using call-process-region, which is designed to wait until the process returns. GNU Emacs has much more rich process handling ability as long as "subprocesses" was #defined and accurate for your system when Emacs was compiled. From what you said later about your system, this is probably the case. Based on the code you provided, the same results, but asynchronous execution of the script, could be accomplished using the following skeleton algorithm: (defun your-entry-command ... (interactive ...) (start-process ...) ;; pick up process-object here (set-process-sentinel process-object 'your-proc-sentinel) (process-send-region process-object (point-min) (point-max))) (defun your-proc-sentinel ... (if the process has exited ... ( ... do your clean-up stuff ...))) For the start-process you can get-buffer-create and erase-buffer an object based on " *emacstroff output*" or such. The leading space makes it a hidden buffer because the user shouldn't bother with the fact that it exists. The clean-up part is where you build your minibuffer message and kill the temporary buffer. For more information do an apropos (not command-apropos) on "process" and see what it turns up. Dave -- (setq mail '("tale@pawl.rpi.edu" "tale@itsgw.rpi.edu" "tale@rpitsmts.bitnet"))