Author Topic: My modification of file() function - redundant?  (Read 1616 times)

MindprisM

  • Senior Community Member
  • Posts: 126
  • Hero Points: 8
My modification of file() function - redundant?
« on: March 22, 2013, 05:55:15 pm »
I have got C:\se17\macros\files.e file() function bound to F4, and I have always called this function with the intent that it means "close this buffer (any buffer) and all associated windows, saving as necessary", then I found out that it re-saves non-dirty files and also pops up a complaint if it is a non-dirty, read-only file.

In understanding that I want a function that means "make this go away" for all buffers (searches, file manager, etc) and save if it is one of my files and is dirty... I want to know if there is another function that does this, or if my hack here is complete.

Code: [Select]
_command int file(_str cmdline='',int flags= -1) name_info(','VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_READ_ONLY|VSARG2_ICON)
{
   int status;
   if (p_ReadOnly) {
     status=quit();
     return (status);
   }
   if ( p_modify && ! (p_buf_flags&VSBUFFLAG_THROW_AWAY_CHANGES) ) {
     status=save(cmdline,flags);
     if ( status==0 ) {
        status=quit();
     }
   }else{
     status=quit();
     //say('quit');
   }
   return(status);
}


I know the correct approach is to make my own wrapper, but anyhow, I suspect my hack is incomplete, though it does handle File manager listings and searches apparently.