Xref: utzoo comp.unix.questions:14836 comp.emacs:6462 Path: utzoo!attcan!uunet!cs.utexas.edu!csd4.milw.wisc.edu!bionet!apple!sun-barr!rutgers!gatech!uflorida!novavax!hcx1!bill From: bill@ssd.harris.com (Bill Leonard) Newsgroups: comp.unix.questions,comp.emacs Subject: Re: SCCS vs RCS under emacs Message-ID: Date: 10 Jul 89 13:36:50 GMT References: <19885@adm.BRL.MIL> <4750022@hpirs.HP.COM> Sender: news@hcx1.UUCP Organization: Harris Computer Systems Division Lines: 119 In-reply-to: bill@ssd.harris.com's message of 7 Jul 89 15:17:24 GMT Oops, there are two problems with my SCCS package I posted. One, it is NOT, repeat NOT, part of GNU Emacs. Two, it requires a package called "converse", which you may or may not have (I think it was posted before); anyway, I'll post it again (courtesy of Tom Horsley of Harris). To all of those who E-mailed me for the package, thanks for the response (there were about 20 in all). Hope you enjoy it. -------------------------------- cut here ---------------------------------- ;; Conversation support routines for interacting with a process. ;; ;; Author: tahorsley@SSD.HARRIS.COM (Tom Horsley) ;; Created: March 5, 1988 ;; ;; These routines provide support for the ability to automatically ;; interact with programs running as subprocesses. Applications ;; range from running file transfer programs to providing a full ;; screen interface to a sequential debugger. ;; ;; This is the second version. The first used process filter functions, ;; but that left emacs in a confused state about what the current buffer ;; is when a process filter did a switch-buffer command. This version ;; simply monitors the output of a process, which means you can't ;; do other work while waiting, but at least it behaves in a consistent ;; fashion. You can't have everything... (provide 'converse) (defun conversation-prompt-wait (process prompt) "Look at buffer associated with PROCESS and wait for PROMPT to show up." (set-buffer (process-buffer process)) (goto-char (marker-position (process-mark process))) (beginning-of-line) (while (not (looking-at prompt)) (accept-process-output process) (sit-for 0) (goto-char (marker-position (process-mark process))) (beginning-of-line) ) ) (defun conversation-doit (process command buffer prompt action) "In PROCESS run COMMAND with output to BUFFER, recognize command completion when PROMPT is seen and take ACTION. BUFFER may be a buffer or nil, if nil the output goes to the buffer associated with PROCESS. PROMPT is a regular expression - if line of output from PROCESS matches it, then the command is assumed to be done. ACTION is a lisp function to execute when the command is done. It is passed one argument (PROCESS). If ACTION is nil, no function is invoked on command completion. COMMAND may also be nil, in which case no command is sent, simply waits for prompt. PROMPT may also be nil, in which case it simply sends the command and returns without waiting for the prompt. Not all combinations of nil and non-nil commands make sense - make sure you call with sensible args, because no checking is done." (set-buffer (process-buffer process)) (goto-char (point-max)) (set-marker (process-mark process) (point)) (if command (let ( (comm-start (point)) comm-end ) (insert command) (setq conversation-start-output (point)) (setq comm-end (point)) (set-marker (process-mark process) comm-end) (process-send-region process comm-start comm-end) (if prompt (conversation-prompt-wait process prompt) ) (setq conversation-end-output (point)) (if buffer (let ( (procbuf (current-buffer)) (comm-outp (point)) ) (set-buffer buffer) (goto-char (point-max)) (insert-buffer-substring procbuf comm-end comm-outp) (set-buffer procbuf) ) ) (goto-char (point-max)) (if action (funcall action process) ) ) ; else no command (conversation-prompt-wait process prompt) ) ) (defun converse (process) "Initialize conversation processing on a process (passed as argument). The process is assumed to be in the ready state able to receive its first command. This routine sets up the buffer local variables that are required for conversations to take place, or are handy for the action functions to reference." (interactive) (set-buffer (process-buffer process)) (make-local-variable 'conversation-start-output) (setq conversation-start-output (point-max)) (make-local-variable 'conversation-end-output) (setq conversation-end-output (point-max)) ) (defun converse-off (process) "Terminate conversation mode on a process." (interactive) ) ------------------------------------------------------------------------------ -- Bill Leonard Harris Computer Systems Division 2101 W. Cypress Creek Road Fort Lauderdale, FL 33309 bill@ssd.harris.com or hcx1!bill@uunet.uu.net