bard@THEORY.LCS.MIT.EDU (Bard Bloom) (01/28/88)
Is there a hook which GNU emacs runs when a buffer is killed? I am trying to write some functions which prevent more than one person from editing a file at a given time. There are some primitives (lock-buffer and friends), but it looks as if I have to write some commands to manipulate them. I can set up the locks without trouble, but I'd like to be able to take them off when the person stops editing the file -- preferably without forcing the person to leave emacs. Thanks, Bard
shirono@grasp.cis.upenn.edu (Roberto Shironoshita) (02/01/88)
In article <8801271613.AA02607@RAVEN.LCS.MIT.EDU> bard@THEORY.LCS.MIT.EDU (Bard Bloom) writes: > Is there a hook which GNU emacs runs when a buffer is killed? No. kill-buffer is a primitive (i.e. written in C) defined in buffer.c, and does not include a run-hooks. > I am trying to write some functions which prevent more than one > person from editing a file at a given time. There are some > primitives (lock-buffer and friends), but it looks as if I have to > write some commands to manipulate them. I can set up the locks > without trouble, but I'd like to be able to take them off when the > person stops editing the file -- preferably without forcing the > person to leave emacs. I have just been browsing through buffer.c, and noticed that the DEFUN of kill-buffer has the following code: #ifdef CLASH_DETECTION /* Unlock this buffer's file, if it is locked. */ unlock_buffer (b); #endif /* CLASH_DETECTION */ So, since you mention you can lock files, I would presume kill-buffer is already doing what you want. Roberto Shironoshita ----------------------------------------------------------------------- Disclaimer 1: The opinions expressed here are my own. The University need not share them, or even be aware of them. Disclaimer 2: Like most humans, I'm bound to err at times. I believe what I have said, but agree that I may be wrong. @@@@@@@@@\ Full Name: Roberto Shironoshita @@ @@ Occupation: BSE candidate in Computer Science @@ @@ Organization: University of Pennsylvania @@@@@@@@/ @@ Network Address: @@ PENNnet: shirono@eniac.seas @@@@ Internet: shirono@eniac.seas.upenn.edu