From 8e45692099dd22635bb06764ef281e858784565f Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 5 Feb 2013 15:39:19 -0500 Subject: Added command line switches for loading sessions on startup. --- modules/textadept/session.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'modules/textadept/session.lua') 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 -- cgit v1.2.3