From: eneafsey@lucpul.it.luc.edu (E. J. Neafsey)
Subject: demacs, file locking, set TZ=CST-9
Summary: observations on demacs's file locking problems and set TZ
Keywords: demacs
Organization: Loyola University Chicago
Date: Wed, 23 Dec 1992 12:45:16 GMT

   When the demacs environment variable TZ (time zone) is set in your
emacs.bat file or autoexec.bat file according to Manabu and Hirano's
original instructions as SET TZ=XST-9, where X stands for your own
time zone (CST for me), demacs keeps correct time.  You can
demonstrate this if you type (current-time-string) in a buffer, put
point after it, and then type C-x C-e.  However, for some strange
reason the -9 in the SET TZ statement causes demacs to behave
strangely when you visit a previously created file which is specified
from the command line (for example, "emacs junk.txt").  If you try to
change the file, demacs won't let you do it because of "userlock."  I
have found you can "fix" this by simply asking emacs to revert-buffer;
say "yes" to the prompt (OK, since you just visited the file and no
changes have taken place yet).

   The -9 part of the SET TZ statement seems to be at fault since when
you remove it (SET TZ=XST), none of the "userlock" problems occur.
This is described in question 10 of David Steibel's demacs.faq, which
can be obtained from archive.cs.umbc.edu in /pub/demacs.  However,
when you leave the -9 out, demacs's time is all wrong, as you can see
if you try the (current-time-string) trick.  For me, demacs's time is
14 hours ahead (demacs says 8:00 PM when it's really 6:00 AM);
interestingly, this is the correct time in Japan.  This incorrect time
means that files are labeled with incorrect timestamps and that
calendar programs don't work correctly either.  

   I have found that when SET TZ=CST-9 is set and time is correct, I
can avoid the "userlock" problem by simply starting emacs WITHOUT
specifying a file on the command line.  If I then find the file with
C-x C-f, I have no trouble editing the file.  Perhaps someone who
knows what emacs does when it starts up can figure out a way to solve
the "userlock" problem that shows up when you specify the file on the
command line.  I tried using a command line switch ("emacs junk.txt -f
revert-buffer"), but it didn't work.

   I think for now I'll just start demacs cleanly from my autoexec.bat
file and use C-x C-f to load all files.

   I hope this is helpful, since the userlock is the only "serious"
problem I have had with demacs.  This is especially true after I found
a more recent version of go32.exe (from djdev108.zip or 109; renamed
as demacs.exe) which allowed me to load and edit large (>1MB) text
files.  Thanks to Kevin Gallagher for his tip on this.

-----------------------------------------------------------------------
E.J. Neafsey, Ph.D. // Director, Neuroscience Graduate Program         
Department of Cell Biology, Neurobiology & Anatomy                     
Loyola University Medical Center, 2160 S. First Ave., Maywood, IL 60153
Internet: eneafsey@lucpul.it.luc.edu // Bitnet:#m01ejn@luccpua.bitnet  
Phone: +1 708 2163355                                                  
-----------------------------------------------------------------------