aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/session.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2013-02-05 15:39:19 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2013-02-05 15:39:19 -0500
commit8e45692099dd22635bb06764ef281e858784565f (patch)
tree5b6df9019a667be63f6ac9ff557ce2762e0b4bfe /modules/textadept/session.lua
parent86ad9c9f1cf93704f12e760eb4b396f40d55d404 (diff)
downloadtextadept-8e45692099dd22635bb06764ef281e858784565f.tar.gz
textadept-8e45692099dd22635bb06764ef281e858784565f.zip
Added command line switches for loading sessions on startup.
Diffstat (limited to 'modules/textadept/session.lua')
-rw-r--r--modules/textadept/session.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua
index b09c2b54..05b7ff58 100644
--- a/modules/textadept/session.lua
+++ b/modules/textadept/session.lua
@@ -198,12 +198,19 @@ function M.save(filename)
f:close()
end
end
--- Save session on quit.
+-- Saves session on quit.
events.connect(events.QUIT, function()
if M.SAVE_ON_QUIT then M.save(M.DEFAULT_SESSION) end
end, 1)
+-- Does not save session on quit.
local function no_session() M.SAVE_ON_QUIT = false end
args.register('-n', '--nosession', 0, no_session, 'No session functionality')
+-- Loads the given session on startup.
+local function load_session(name)
+ if lfs.attributes(name) then M.load(name) return end
+ M.load(_USERHOME..'/'..name)
+end
+args.register('-s', '--session', 1, load_session, 'Load session')
return M