> I use gvim 7.2 on Windows. > > I noticed this unexpected behavior regarding read-only files.
Please don't take this the wrong way... I think it's "unexpected" because you have a strange expectation. If you read the docs (which are incredible by the way!) I think you'd understand things a bit better. > If I open a file, that is open by another process, gvim marks it as > "read-only" and refuses saving changes, unless "w!" is used. > (funny, if I close the gvim window, it will ask to save and if > answered "yes" it will save without any complaints) :h 'readonly' Not funny... expected (and good) behaviour. > The funny thing: > - open a file, that is not used by other processes > - saving changes work > - open the same file with another process > - gvim detects this and complains on save, that it is a read only > file* > - the other process stops using the file > - the "weird" part: gvim still refuses to save changes to the > file, even if now there is no reason for that Why isn't there a reason for it? If you wrote the file in process 1 then your buffer in process 2 is stale, and if you now write the file from process 2 you blow away the changes you made in the process 1. It's readonly for a reason. You'd probably be *much* less happy if you made a ton of changes in process 1 and Vim happily blew them all away because you accidentally wrote the older version of the file in process 2. > additional note: > * - I think applications should not second guess if a file is > read-only or not. If it is, the OS will refuse any write access. > If the OS allows write, then the application (gvim in this case) > should not prevent the user from doing so. The only OS that I know of that has this (annoying) behaviour of locking a file like that, is Windows. Vim runs on tons of platforms that don't have this and the solution is (thankfully) universal. I don't want to debate that the locking is a good or bad thing - the bottom line is that it's not a universal thing and Vim employs a universal solution. And even if Vim relied on windows for the locking, you'd still accidentally blow the file contents away with your process 2 write, as above - and boy would that be bad... Regs, Derek --------------------------------------------------------------------- This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
