New plugin: SessionMgr

1 2 3 .. 5 > >> (Page 1 of 5)
  • Mike Foster

    Mike Foster - 2011-08-03

    This is my first Notepad++ plugin. If you give it a try please let me know what you think about it.

    SessionMgr - documentation and download

    Thanks very much to everyone who contributes to this project. Notepad++ is awesome!

  • Mike Foster

    Mike Foster - 2011-08-03

    hmmm, when I said "contributes to this project" I didn't mean my plugin, I meant the developers of Notepad++, Scintilla and the plugins, the forum moderators, wiki maintainers, etc. What a great project and a wonderful editor. Kudos!  :-)

  • Mike Foster

    Mike Foster - 2011-08-06

    I notice my plugin got posted at Plugin Central. Cool! Thanks very much to whoever did that!

  • Dan Rathbun

    Dan Rathbun - 2011-08-30

    Problem…. after unzipping the plugin and putting the files where they go…

    NotePad++ will not start, because I do not have "msvcp100.dll" on my machine. (And I'm not sure I can. All updates for VS and .NET crapout on my machine. I would have to do a complete manual uninstall of all of these packages, and then reinstall them all.)

    You neglected to mention any dependencies on your website.

    Do you think it would compile with VS2005 ??

    And I take it that it's not compatible with NppPluginMgr ??

  • Mike Foster

    Mike Foster - 2011-08-30

    Hi danrathbun, thanks very much for your feedback. I have noted the dependency on the SessionMgr web page and provided the following link:

    Microsoft Visual C++ 2010 Redistributable Package

    This does not require an MS "update", it simply copies ".dll" files into the appropriate folder and registers them.

    I don't have VS2005 so I don't know if it would compile with it or not. Sorry about that.

    I would be glad to try to make it compatible with the Plugin Manager, but I do not know how to do so. I will search the wiki again to try to find this information.


  • Vera

    Vera - 2011-08-30

    Hello mike

    I searched a bit and found that this library only seems to be needed on WIN-7 but not on previous versions.

    Besides I came across this compiling tip to use static links to include the dll - (but no idea if it works the same when creating a dll itself):
    Avoiding the MSVCR100.dll or MSVCR100D.dll is missing error

    ps: I wouldn't like to be forced to install extra libraries just because of a single plugin.

  • Dan Rathbun

    Dan Rathbun - 2011-08-30

    OK I d/l'd the VC2010 Redistro-Package. No errors on install. (Keeping fingers crossed.)

    Moved your plugin DLL back into the NPP "plugins" dir, and started NPP.

    Got this error popup:

    "app_readSesDir failed with error 3: The system cannot find the path specified."

    I DO have the "SessionMgr" folder beneath the "Config" folder, and the "sessions" folder beneath the former.

    Note.. that I had already (before I knew of your plugin,) decided to use the extension ".npps" for NPP session files, and had manually registered this new ".npps" extension with Windows. I had also manually edited the "config.model.xml" file to set the "sessionExt" attribute to "npps".

    Did you account for the possibility, that this attribute may be something other than empty, at first run of the plugin ??

  • Dan Rathbun

    Dan Rathbun - 2011-08-30

    OK.. we have success.
    And yes.. XP needs this DLL for VS2010 executables, if it has not been installed.

    The problem is… Mike…  I did not do Installation item #3 (because I thought wrongly my plugin config data was under the program path.)

    I manually created the folders in the %APPDATA% path, and the "cannot find path" error(s) no longer occurs.

    However it does come back, if the user neglects to end the "SesDir" path with a "**".
    Some people are not used to doing this (especially Ruby programmers.)

    I would suggest next update, to have the plugin add it to the end of the path in the ini file, to avoid the popup. (Users are likely to copy and paste paths from the FileExplorer location bar, which does not put a "**" at the end of paths. Which is what I myself did.)

  • Dan Rathbun

    Dan Rathbun - 2011-08-30

    Next Update… It would be nice to have a "Browse" for folder button on the settings dialog.

  • Dan Rathbun

    Dan Rathbun - 2011-08-30

    More Feature Update Ideas:

    * Make Settings dialog sizable (and save user size & position,) so we can see the whole Dir path.

    * Make Sessions dialog sizable (and save user size & position.) This is likely to be a future "wish" also as the length of session files get longer and more descriptive.

    * Inject (or better yet replace,) the "Session" Menu items on the NPP "File" menu, with the SessionMgr submenu.

    Mike.. do you have anything against your plugin being added into NPP, as a standard part of core application ??

  • Dan Rathbun

    Dan Rathbun - 2011-09-01

    BUG 1 : With a Session open.. trying to create a New "empty" session fails with error:

    Copy failed with error 2: The system cannot find the file specified.

    A User Template has not been created at this point. So I try this feature.
    I go thru the menu, and select "Edit Session Template"
    A popup appears saying something like "A session template does not exist , Create one now?"
    I say yes, and it's created.
    Two problems:
    BUG 2 : The file is created in the %APPDATA% path, not in the custom Session Directory.
    BUG 3 : The template file is totally BLANK, EMPTY and WORTHLESS.

    OK, so I says, to myself, I say, "I'm a geek, I can help the plugin out by copying an existing session file with only one file in the mainView, and give it a default path to my 'dev' directory, with a default lang 'Ruby', and the name 'untitled.rb', and that should work.

    It does not.
    BUG 4 : The new session opens with a name "new " (not so bad,) but the current path is not my 'dev' directory, it's the SessionMgr %APPDATA% path. (The lang type is correct, however I feel this is because of my default lang setting in the NPP settings.)
    When I open the session file (that should have copied the template,) it's devoid of any useful information:

        <Session activeView="0">
            <mainView activeIndex="0" />
            <subView activeIndex="0" />

    The workaround, was to create a copy of the new template, put it in my custom session directory with a "_" prefix, ie: "_template.npps", and use the last option "Copy session file" for creating new sessions. In addition I had to set the default directory to my "dev' directory in the main NPP Preferences. (This is not ideal, as I prefer that setting to "Follow current file path.")

    So basically the first 2 options for creating New sessions, are unusable.

    Lastly, it would help if there was a "Refresh" button on the "Sessions" dialog. (And even better if the dialog routine would refresh the Session List automatically each time it is opened.) I was surprised when a manually copied session file did not show in the list. I was forced to close the dialog, go back through the menu, refresh the list from a menu item, then back through the menu again, to reopen the dialog.

  • Dave Brotherstone

    You should definitely compile your plugin with /MT, not only as it avoids the need for the runtime, but also because Notepad++ itself is compiled with /MT, and mixing and matching /MD and /MT is at best not recommended, at worst not supported (depending on the calls you and N++ make). 

    I'm in the process of listing this in the Plugin Manager, however I get an error on startup: "app_readSesDir failed with error 2: The system cannot find the file specified" when the sessions directory contains no .npp-session files.  This is completely reproducible, just empty your sessions folder and start n++.

    For now, I'll list the plugin with this stability caveat.  If you can get a new version, compiled with /MT and with this little bug fixed (even if there's a sample session in the zip… although it's not the greatest fix!), then we can remove the stability tag (the other fixes reported by danrathbun look like functionality issues, rather than error messages, so that's up to you…).

    Otherwise, looks like a really nice plugin - be nice to have the sessions dialog dockable, or maybe a dockable mini version with a drop down. 

    Please remember to change the download URL (ie. a different filename) when you release a new version, otherwise plugin manager will tell people the file is bad and should not be installed… :)


  • Dan Rathbun

    Dan Rathbun - 2011-09-06

    @dave & mike : It will be nice to be able to update SessionMgr with the Plugin Manager !!

    @mike, perhaps if you put the code up on github… others could help you fix, maintain, and extend it …

  • Dan Rathbun

    Dan Rathbun - 2011-09-07

    BUG 5 : When creating a New Session (using copy,) If the user neglects to enter a String in the session name box, the plugin actually creates a new session file with a name consisting of only ".sessionFileExt"…

    … a little input validation is needed, I think.

  • nofun

    nofun - 2011-09-18

    Thanks for your effort to do what really should be done a long time ago, Mike!
    When no session loaded («There is no “current” session») couldn't Session Manager treat all open tabs as a special hidden session, which could be saved afterwards or restored automatically (contrary to N++ itself) after crash?
    For now inability to save a bunch of already open tabs as a session is a major problem with the plugin for me. Or have I missed something?

  • Mike Foster

    Mike Foster - 2011-09-18

    Wow, I didn't realize there had been posts here. Sorry about that. I'm reading them now and will reply ASAP. Thanks very much to everyone!

  • Dan Rathbun

    Dan Rathbun - 2011-09-19

    @Mike: At the top of the thread, just after the title "New plugin: SessionMgr", is the toggle link "Monitor".

    If you click it, the forum will email forward daily digests of postings (if any occur.)

    There is also a post-by-post Monitor checkbox, in the reply form (just above the "Add Reply" button.)

  • Dan Rathbun

    Dan Rathbun - 2011-09-19

    Agree with nofun69… the "Save Current Session" menu option, could save a session file (if there is "no current session",) named.. (drumroll…) "Current.sessionFileExt" or use a DateTimeString as the name.

    On a subsequent load… a "Restore Previous Session" menu item could reload it.

  • Mike Foster

    Mike Foster - 2011-09-21

    Thanks! again for the great feedback, and I apologize again for my late reply.

    I categorized and summarized the items from the above posts…

    Bugs and code improvements:

    1. lessen dependencies - compile with /MT
    2. use "sessionExt" attribute from NPP config
    3. detect %APPDATA% or install path?
    4. check paths for trailing slash (better validate all user input)
    5. create templates if not found?
    6. first 2 options for creating New sessions need work - I need to read this "BUG 4" comment more and better understand it
    7. handle the case of an empty session directory
    8. put the code up on github

    New features:

    1. "Browse" for folder button on the settings dialog
    2. Make Sessions and Settings dialogs sizable (and save user size & position)
    3. Inject (or better yet replace,) the "Session" Menu items on the NPP "File" menu, with the SessionMgr submenu
    4. "Refresh" button on the "Sessions" dialog. (And even better if the dialog routine would refresh the Session List automatically each time it is opened
    5. sessions dialog dockable, or maybe a dockable mini version with a drop down
    6. if there is no current session, use "Current.sessionFileExt" or a DateTimeString. On a subsequent load… a "Restore Previous Session" menu item could reload it.

  • nofun

    nofun - 2011-09-21

    Mike, won't you complement "Save current session" menu item with the button in the "Sessions…" dialog, please? That would allow to manage with only one shortcut to the dialog. (I'm short of free meaningful/memorizable key combinations already.)

    Also I'm almost certain that when I need to switch to a new task I'll forget to create new session manifestly and instead clear workspace with "Close All" command as I usually do, so if "Auto Save" is enabled the "current" session will be actually lost. That's why I'm not planning to use that option, but I'd like to have unsessioned open tabs autosaved anyway for a case of crash. In fact there's an old  request on this at IdeaTorrent.

  • Dan Rathbun

    Dan Rathbun - 2011-09-22

    The summary "to do" list for #3 needs the item "create %APPDATA% dirs if they do not exist, and are needed." added.
    On first start, if they do not exist, prompt the user where they wish to save the plugin's data: You might give options, "AppData" (opens the explore in the user's AppData path,) "User Documents" (opens explore in the user's Documents path,) and "Other" (opens explore in MyComputer.) The user then creates the dirs needed, and closes the dialog, which should return the path (created and) chosen.

  • nofun

    nofun - 2011-09-23

    Another glitch… If some file is passed to Notepad++ as a commandline parameter it will be closed by autoloading session.

  • Dan Rathbun

    Dan Rathbun - 2011-09-23

    It's NPP itself that is doing the session autoload.. correct ??

    And NPP itself that is parsing the command line arguments… correct ??

    So how can this be a SessionMgr bug ?? .. it's a core NPP bug, then.

  • nofun

    nofun - 2011-09-24

    It's NPP itself that is doing the session autoload.. correct ??

    No, I meant SessionManager's "Auto Load" option enabled.
    What's going on here I think is this: Notepad++ does everything right and opens the file passed via command line, but then Session Manager closes it to load the session selected as 'current'. Here the option "Load without closing open files" could take action, but I checked and, alas, that's not the case.
    I'm not saying it's a bug after all. I see this as undesired behavior introduced by Session Manager with particular option set. Which however should be corrected if possible.

1 2 3 .. 5 > >> (Page 1 of 5)