Re: mcedit file locking



Hello!

> I've found quite nice approach in JED editor sources (it is called
> 'Emacs locking' there, so maybe it is more universal):

I really appreciate that you looked what other editors do.  I think it's a
good idea to respect an established protocol.  There are some issues with
creating files in the same directory as the file (i.e. there will be stale
locks is mc is killed, write access to the directory is required), but I
believe that following a standard adopted by other editors is more
important.

> /* The basic idea here is quite simple.  Whenever a buffer is attached
> to * a file, and that buffer is modified, then attempt to lock the *
> file. Moreover, before writing to a file for any reason, lock the *
> file. The lock is really a protocol respected and not a real lock.

Sounds very good.  Some users open files in the editor just to view the
file and take advantage of syntax highlighting.  If the file has not been
modified, the lock shouldn't be held.

On the other hand, if the user uses "Save as", the file should be locked
only for the time when it's being written.

I think that's what mc should do.

-- 
Regards,
Pavel Roskin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]