nedit-ng icon indicating copy to clipboard operation
nedit-ng copied to clipboard

File modification indicator

Open marilmanen opened this issue 5 years ago • 9 comments

Here is a description of a new feature that I would like to have (I had it in the old NEdit).

When a user starts to modify a file, an empty file with additional identification is created to the same directory (in case the user has write permission to the directory). When the user saves changes, cancels modifications or saves the file with a new name, the empty file is removed. Identification could be for example -nedit- to reduce risk of overwriting some real file.

Usage example: I use automatic source file handling to collect files from different locations. If I have modified a file, but forget to save it, the automatic source file handling tool checks if those empty files exist and issues a warning. This feature has saved me a lot of time as non-saved changes can cause a lot of confusion and are many times a bit difficult to find.

marilmanen avatar May 26 '19 12:05 marilmanen

You say that you had it in the old NEdit, but I am unaware of this feature. Was it a 3rd party patch?

eteran avatar May 28 '19 13:05 eteran

It was a modification that I did on the source files, but I was not confident enough to publish the change. Now this sounds stupid as the feature has proven to be very useful.

marilmanen avatar May 29 '19 03:05 marilmanen

Revisiting feature requests.

If I understand this correctly, you are basically asking for a "lock file", right? The idea is that the file serves as a marker that an editor is already editing that file.

Likewise, if you aren't using nc, nedit could detect the presence of this lock file and warn the user that an instance of nedit already has that file open.

Do I have that right?

eteran avatar Dec 27 '20 22:12 eteran

Just having a file open in nedit should not create the modification indicator file. I would like to have a indicator file only when I have made modifications to a file, but have not yet saved the modifications. When the modifications are saved (or canceled by undo) the modification indicator file should be removed. Practically the modification indicator file should exists at the same time when the editor window title indicator has the "(modified)" label.

marilmanen avatar Dec 28 '20 05:12 marilmanen

So kinda like the vim .swp files then?

eteran avatar Dec 28 '20 05:12 eteran

I get the .swp file as soon as I open a file in write mode and I want the file only when the file is under modification. The swp file is also not just an empty file, so I think it could also have issues when handling large files.

marilmanen avatar Dec 28 '20 05:12 marilmanen

Gotcha, I think I understand what you're looking for now.

eteran avatar Dec 28 '20 06:12 eteran

Could this just be the backup file (~<filename> on my systems)? I'm not sure exactly when it gets created but it sounds like almost the same behavior to me.

anjohnson avatar Dec 28 '20 19:12 anjohnson

Issue with the backup files is that they are not empty (cause slowness when handling large files and thus should not be enabled by default) and those are not always immediately removed when a file modification status changes back to unmodified state.

I'm having many times much more speed than I can handle and thus I forget to save some of the files I've modified. Then I compile my HDL files and run simulation and spend long hours debugging and wondering why the modification I just did had not the expected impact. After all possible causes have been checked I get back to the source file and notice that I have not saved the file and at this stage I'm not very happy with myself. To avoid those days I have created a pre compile and simulate script which gives a warning if any modification indicator files exist for the source files I'm about to compile or simulate.

marilmanen avatar Dec 29 '20 05:12 marilmanen