Author Topic: Is there a way to stop Slickedit from saving a file that hasn't changed?  (Read 839 times)

timur

  • Senior Community Member
  • Posts: 205
  • Hero Points: 3
I have this bad habit of sometimes hitting Ctrl-S on a file that I haven't edited.  Slickedit then proceeds to overwrite the file on disk, usually without changing anything.  The problem is that the timestamp of the file does change, and so when I do a build, the Makefile thinks the file has changed and sometimes triggers a full rebuild of the whole project.  That takes about 20-30 minutes.

Is there any way I can get Slickedit to detect that the file hasn't actually been edited by me, and either block or prompt the save?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
I added an option for this. It will be available in the next hot fix.

Tools>Options...>File Options>Save>Prompt if saving unmodified file which already exists on disk

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
mmm, that's what you call fast response.

@timur - In case the hotfix is delayed you could try the following code.  Bind ctrl S to this function instead of to the save function.

Code: [Select]
_command void save_if_modified() name_info(VSARG2_REQUIRES_EDITORCTL)
{
   if ( !_mdi.p_child.p_modify ) {
      result := _message_box("File is unmodified. Do you wish to save it?", '', IDYES|IDNO,IDNO);
      if ( result != IDYES ) {
         return;
      }
   }
   save();
}


timur

  • Senior Community Member
  • Posts: 205
  • Hero Points: 3
Thanks, I'm on v23, so I'll be using the macro.