[comp.emacs] how to not lock-buffer?

wjc@ho5cad.ATT.COM (Bill Carpenter) (05/19/89)

(Using 18.54 on a SUN)

GNUemacs uses the two functions "lock-buffer" and "unlock-buffer" to
watch out for two GNUemacses editing the same file (on systems that
support its scheme for noticing it).  I once saw someplace (sorry,
don't remember where) the advice that to disable file locking, just do
something like this:

  (fset 'lock-buffer 'ignore)
  (fset 'unlock-buffer 'ignore)

I tried it.  Trouble is, the lock still happens.  (I've even tried
using "beep" instead of "ignore"; same result, no beep.)  I also tried
making a new defun for "lock-buffer" to try to clobber the old one,
but no luck.  The original definition shines through (probably
something to do with it being defined in C instead of lisp
[src/filelock.c]).

So, does anyone know of a way to turn file-locking on and off?  Yes, I
know I can compile it out when I build GNUemacs.  I also know I can
define the lockfile directory as something impossible or with
unwritable perms at compile time.  But I only want to get rid of it
for me, and then only when I say so ... not all the time or for all
users.

(I also know I can track down all the occurences of (lock-buffer) in
the elisp and clobber them, but you know that's not the kind of
solution I'm looking for.  If I were, I'd rather change the DEFUN of
lock-file in the C code to lock-file-really-really and then put an
(fset 'lock-file 'lock-file-really-really) someplace in the preloaded
stuff.  Then the original scheme would work, I think.)
--
   Bill Carpenter         att!ho5cad!wjc  or  attmail!bill

tale@pawl.rpi.edu (David C Lawrence) (05/20/89)

The problem with what you want is that the calls to lock-buffer are
apparently happening in the C code (I haven't checked on this).  If
this is the case then no matter what you do with elisp the original
filelock information tthat was compiled in at build-time will always
shine through, though any elisp functions will use the new definition.

You can witness somehing similar to this by redefining y-or-n-p to do
something of your own preference (like allowing a recursive edit so
you can bounce around in windows and buffers to be sure of your
answer).  Any function you use that has y-or-n-p called from elisp
will use your function, but any function that called in a C function
will use the original definiton.

Dave
--
 (setq mail '("tale@pawl.rpi.edu" "tale@itsgw.rpi.edu" "tale@rpitsmts.bitnet"))
 (error "UUCP not spoken here.  Long bang paths unlikely to get mail replies.")