unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* passing data to process sentinel
@ 2006-09-15 11:17 Gordon Beaton
  2006-09-15 17:01 ` Kevin Rodgers
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Gordon Beaton @ 2006-09-15 11:17 UTC (permalink / raw)


I run tkdiff from emacs to compare the current buffer contents with
the corresponding saved file. tkdiff needs two filenames, so I start
by storing the buffer contents to a temporary file created by
make-temp-file.

I'd like to be able to pass the name of the temporary file to a
process sentinel so it can be cleaned up after tkdiff exits, for
example by attaching the filename to the process object itself where
it can be retrieved in the sentinel. To me this seems more elegant
than storing the filename elsewhere and looking it up.

One solution I'd like to see is something like this, but of course
neither set-process-sentinel nor the sentinel itself take the
additional argument:

  (set-process-sentinel
    (start-process "tkdiff" nil "tkdiff" (buffer-file-name) temp-file)
    'my-sentinel temp-file)

  (defun my-sentinel (process event mydata) 
    (if (file-exists-p mydata) (delete-file mydata)))
    
I was hoping that something like the following might work, but
temp-file doesn't seem to get bound in the lambda function:

  (set-process-sentinel
    (start-process "tkdiff" nil "tkdiff" (buffer-file-name) temp-file)
    (lambda (process event)
      (if (file-exists-p temp-file) (delete-file temp-file))))
  
Suggestions?

/gordon

-- 
[ don't email me support questions or followups ]
g o r d o n  +  n e w s  @  b a l d e r 1 3 . s e

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-09-18 13:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-15 11:17 passing data to process sentinel Gordon Beaton
2006-09-15 17:01 ` Kevin Rodgers
     [not found] ` <mailman.6985.1158339733.9609.help-gnu-emacs@gnu.org>
2006-09-16  7:37   ` Gordon Beaton
2006-09-18 12:42 ` Johan Bockgård
2006-09-18 13:45   ` Gordon Beaton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).