Top

Sessions


By default, information about your editing session is saved so that when you restart j, things come back more or less as you left them: the same buffers will be open (except for remote and transient buffers), and the current location in each buffer will be the same.

J also provides support for named sessions with the commands saveSession and loadSession.

saveSession saves information about the current editing session in a named session file. If no named session is active yet, you will be prompted for a name for the current session; subsequent saves will go to that session file without further prompting.

loadSession loads a previously saved named session, which then becomes the active named session as far as saveSession is concerned. All currently open buffers are closed before the new session is loaded.

If a named session is active, you can save the current session under a new name by using executeCommand to invoke saveSession with the new name as an argument (e.g. Alt X, "saveSession foo"). If you do this, subsequent saves will go to the new session file by default.

When a named session is active, the session name appears in the title bar of the top-level window, enclosed in brackets.

By default, the information in a named session file is only updated when you explicitly invoke saveSession. This allows you to exercise better control over the contents of named session files. If you'd like named session information to be updated automatically, add this line to ~/.j/prefs or C:\.j\prefs:

    autosaveNamedSessions = true

You can use "-session" on the command line to start j with a specific named session:

    j -session foo
or
    java -jar j.jar -session foo

When you start j without specifying a named session on the command line, the previous session is restored, but no named session is active until you do saveSession or loadSession.

Named session files are stored in the directory ~/.j/sessions (or C:\.j\sessions). You might want to visit that directory on your day off and delete session files that are no longer needed.