Re: File locking
- From: Adam Byrtek / alpha <alpha informatica agh edu pl>
- To: mc-devel gnome org
- Cc: Dmitry Semyonov oktet ru
- Subject: Re: File locking
- Date: Wed, 4 Feb 2004 23:16:20 +0100
On Thu, Jan 15, 2004 at 08:37:32PM +0300, Dmitry Semyonov wrote:
> I think it should be mentioned in the NEWS file.
Yes, it should be. Pavel?
> Also locking mechanism should be described in man pages or/and
> editor help.
I'll try to document it when I will find some time.
> Create a file named test.txt
> Open mc on two consoles --> mc1 and mc2.
> mc1: select test.txt, F4 (edit), type "mc1", F2 (save).
> mc2: select test.txt, F4 (edit), type "mc2", F2 (save).
> mc1: type " rules", F2 (save).
> mc1: F10 (exit from editor).
> mc2: F10 (exit from editor).
File locking as implemented in mcedit (based on and compatibile with
emacs and jed) demands cooperation of both sides, it prevents
*editing* contents of two files at the same time (lock warning is
invoked *before* the first edit command on locked file). Your problem
is a bit different case (edits don't happen at the same time) and have
to be coped with in a different way.
AFAIS your problem is fixed in jed by checking file mtime on the first
edit command, and warning if the file was changed by some other
program (not neccessarily other mcedit!) during current editor
My idea of implementation:
1) Edit lock stay as they are now
2) On the first edit command check if (file_mtime>open_time)
- if yes, warn that the file was modified on disk (OK/Cancel)
- if no, continue
3) On file save: open_time=save_time
If we all agree on this I will implement it.
> Another thing: I don't understand the real meaning of "Grab lock" and
> "Ignore lock" buttons of "File locked" dialog without experiments.
Do you have any easier to understand alternative? Yes, there should be
help page with info about file locking.
/foofile is locked by alpha mentat 1907 (S)teal, (P)roceed, (A)bort?
/foofile locked by alpha mentat (pid 1907): (s, q, p, ?)?
It has been detected that you want to modify a file that someone else
has already started modifying in EMACS.
You can <s>teal the file; The other user becomes the
intruder if (s)he ever unmodifies the file and then changes it again.
You can <p>roceed; you edit at your own (and the other user's) risk.
You can <q>uit; don't modify this file.
Now I see it would be wise to have an 'Abort' option in mcedit, but
I'm not sure if it is possible to implement this easily...
> By the way, what if I press Esc+Esc for the dialog?
Ignore, it should be intuitive: Cancel=Ignore.
Thanks for your mail!
_.|._ |_ _. : Adam Byrtek /alpha alpha debian org
(_|||_)| |(_| : pgp 0xB25952C0
] [Thread Prev