Menu

Auto Save Plugin

2005-09-13
2013-04-16
  • Nobody/Anonymous

    I was wondering if anyone here had developed an autosave plugin for Notepad++ ?

    thanks

     
    • Chris Severance

      Chris Severance - 2005-09-14

      An autosave feature could cheat by asking N++ for the current file name WM_GET_FULLCURRENTPATH getting the text from Scintilla SCI_GETTEXT then write to file. This seems a bit dangerous to me since there is no proof that the "current edit window" goes with the "current file name" and this kind of feature may need to wait until Don Ho gives us more access to the internals of N++.

       
      • Don HO

        Don HO - 2005-09-14

        Do you mean the message "Save Current Document" to send to Notepad++ from the plugin?

        Don Ho

         
        • Drake Christensen

          I did a search, and this appears to be the only discussion of this feature.  I know the discussion is old, but I'd like to throw out another request for it.  I've used Multi-Edit for years, so the various facets I'm looking for with this feature are based on what they did, which I liked.

          - It should definitely be an option.  I would have it turned on by default, with a 120 second interval.  The Golden Rule of Programing: Never Lose the User's Data.  But since that would change the behavior of the program for current Notepad++ users, maybe it can be turned off in an upgrade situation.

          - I would want autosave to save *all* the documents.  When programming, I usually jump around between a few files.  So, an autosave that saves only the current document is insufficient.

          - Along the same lines, I'd like an option for an autosave when Notepad++ loses focus.  It's hard to convey how convenient it is to make changes to some files and then just switch to the compiler or FTP program and not have to worry about them grabbing an old version.  A conscious decision to save can break my train of thought and knock me out of the zone.

          - Undo/Redo should extend past autosaves/saves.  There's no reason to dump the undo queue just because a file has been saved.

          Drake Christensen

           
          • Nobody/Anonymous

            I concur with Drake that autosave is one of the features that will make our daily work more reliable and it will prevent a lot of trouble with lost work in case of crashes. Please implement this feature in a lower 4.x release and make the autosave time interval and backup directory configurable. I also like the initial idea to include all open files especially those which just exist in memory (new/temporary docs).
            And of course this post is due to a recent data loss - my collegue just lost some data due to an unexpected reboot caused by an electrostatic discharge...

            Rainer

             
    • Nobody/Anonymous

      My though was that when a file was changed (tab turns red)
      that event would start a counter (10 min?)  Any further changes to the file would reset the timer.  When the timer expires the file would be saved.

      (just my 2 cents worth)

       
    • Chris Severance

      Chris Severance - 2005-09-14

      From a plugin, the timer would be started by a  SCI_GETMODIFY checked during an SCNotification event. Then, during later SCNotification events, check to see if the time has run out and tell N++ to save.

      >"Save Current Document"

      I could root through the menus for the  "File-Save" MenuItem-ID and post a message to N++ to force the menu item to run? That wouldn't be too hard since I already have code that hunts for menu items. There isn't a WM_SAVECURRENTDOCUMENT in Windows, Scintilla, or N++ header files.

      Autosave doesn't work well as a plugin since the user would like to specify a timeout value and plugin authors like me would rather not bother with creating dialog boxes. A better solution is to integrate autosave into N++.

      The best solution is for programmers to train themselves to use Alt-F-S before any unsafe operation. Programmers of all people know not to write code for hours at a time without saving, particularly before crashing their computer on a test run. Autosave is more appropriate for grandmothers who think the computer takes care of everything for them.

       
      • Paulius

        Paulius - 2005-09-14

        > The best solution is for programmers to train themselves to use Alt-F-S
        > before any unsafe operation. Programmers of all people know not to
        > write code for hours at a time without saving, particularly before
        > crashing their computer on a test run. Autosave is more appropriate
        > for grandmothers who think the computer takes care of everything
        > for them.
        I agree 100% to this. Except that i usualy hit Control+S, not Alt-S-F. Actually, it's almost a habit - every time i put semicolon in the end of a statement - hitting Control+S is almost as trivial as hitting Enter (to start a new line).

        As for my 10 cents...
        I dont think this Auto-save feature would be useful for programmers. But Auto-backup feature could be. I mean, everything works just like you described (at some intervals of time, a COPY of file is saved on the disk somewhere). Users would probably want to configure intervals - how often this event should be triggered, and how many backups to keep.

         
        • Nobody/Anonymous

          me too
          -save all (files that already have a filename (or all if easier))
          -allow undo's past the save point
          -default to 0 min (off)

           
    • Nobody/Anonymous

      If it's a notepad++ feature and a checkbox in options can turn it on/off, everyone would be pleased.

      Personally, I'd like this feature a lot. Control+F is a waste of a programmer's time.

       
  • Heinz

    Heinz - 2013-04-16

    I have tried to create an autosave plugin.
    The plugin will check all opened files for changes and if a file was changed it will save a copy with a timestamp like "c:\data\ToDo.txt.2013-04-15 21.29.14"
    The plugin is "beta"...so if somebody is interested to test it you can download it here:

    https://dl.dropboxusercontent.com/u/109029325/autosave2.dll

    In the "About" menu you will find my email adress for comments.

    basically, it is more a backup rather than an autosave because a COPY of the file is saved on the disk
    Heinz

     

    Last edit: Heinz 2013-04-16
  • cchris

    cchris - 2013-04-16

    Hi,
    Since there is already an AutoSave plugin by F. Stellari, perhaps you migh add something to the description of the plugin on NpWiki++ to tell how different it is. Also, there is a name conflict. Admittedly, creative naming is not too easy for specialised pieces of code like this.

    CChris