nnn.1 | 7 +++++-- src/nnn.c | 7 +++++++ diff --git a/nnn.1 b/nnn.1 index aed98a5e204685b4b2cc377cfd2eecb939e13d4f..0593fcec07f3143193d0396928e862603c62bc88 100644 --- a/nnn.1 +++ b/nnn.1 @@ -197,6 +197,9 @@ When a session is loaded dynamically, the last working session is saved automatically to a dedicated -- "last session" -- session file. The "last session" is also used in persistent session mode. .Pp +Listing input stream is given a higher priority to persistent sessions. Use +session option \fIrestore\fR to restore the persistent session at runtime. +.Pp All the session files are located by session name in the directory .Pp \fB${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions\fR @@ -345,8 +348,8 @@ A temporary directory will be created containing symlinks to the given paths. Any action performed on these symlinks will be performed only on their targets, after which they might become invalid. .Pp -Right arrow or 'l' on a symlink in the listing dir takes to the target file. -Press '-' to return to the listing dir. Press 'Enter' to open the symlink. +Right arrow or 'l' on a symlink in the listing dir takes to the target +file. Press '-' to return to the listing dir. Press 'Enter' to open the symlink. .Sh UNITS The minimum file size unit is byte (B). The rest are K, M, G, T, P, E, Z, Y (powers of 1024), same as the default units in \fIls\fR. diff --git a/src/nnn.c b/src/nnn.c index 154a3303222a49bd3897afb33465c16c7b1bd84f..78c95468b0bafd581f92f9ca6f29de89b3b88278 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3955,6 +3955,10 @@ if (!sname[0]) return FALSE; mkpath(ssnpath, sname, spath); + + /* If user is explicitly loading the "last session", skip auto-save */ + if ((sname[0] == '@') && !sname[1]) + has_loaded_dynamically = FALSE; } else mkpath(ssnpath, "@", spath); @@ -7687,6 +7691,9 @@ return EXIT_FAILURE; /* We return to tty */ dup2(STDOUT_FILENO, STDIN_FILENO); + + if (session) + session = NULL; } home = getenv("HOME");