[comp.emacs] get-process-buffer

drw@culdev1.UUCP (Dale Worley) (11/13/87)

There's a function "set-process-buffer", but there's no complementary
"get-process-buffer".  Is there another way to do this?

I want to set a sentinal on the process "shell", so that when it
finishes, the modification-flag of its buffer can be cleared.  This
isn't too hard:

(defun sent (process change)
  (if (string-equal change "finished\C-j")
      (save-excursion
	(set-buffer (get-buffer "*shell*"))
	(not-modified))))

(set-process-sentinel (get-process "shell") 'sent)

But, if I have more than one shell, the function "sent" is only given
the process, not the associated buffer, so it can't figure out which
modified flag to clear.

Clearly, I could make up an a-list of processes and buffers, but there
should be an easier way to get the information (name, buffer, state)
associated with a process.

Dale
-- 
Dale Worley    Cullinet Software      ARPA: culdev1!drw@eddie.mit.edu
UUCP: ...!seismo!harvard!mit-eddie!culdev1!drw
If you get fed twice a day, how bad can life be?

maa@sei.cmu.edu (Mark Ardis) (11/16/87)

The function you want is "process-buffer":

process-buffer:
Return the buffer PROCESS is associated with.
Output from PROCESS is inserted in this buffer
unless PROCESS has a filter.
--
Mark A. Ardis
Software Engineering Institute
Carnegie-Mellon University
Pittsburgh, PA 15213
(412) 268-7636
maa@sei.cmu.edu

lewis@rocky.STANFORD.EDU (Bil Lewis) (11/16/87)

Posting-Front-End: GNU Emacs 18.36.1 of Fri Feb  6 1987 on rocky (berkeley-unix)



Dale,
  Could this be what you're after?

(process-buffer (get-process "shell"))
=> #<buffer *shell*>

  It's true that naming conventions are violated on occaision.  I can't say
why.

-Bil

--