From 29808b6c6224d22a2f36b1d1a573b23001a0638c Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Wed, 8 Jul 2009 21:18:27 -0400 Subject: Better session management. Can load and save from the menu now as well. --- core/file_io.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'core/file_io.lua') diff --git a/core/file_io.lua b/core/file_io.lua index 4cb9210f..b0131aa1 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -374,6 +374,7 @@ function load_session(filename, only_pm) end f:close() textadept.views[current_view]:focus() + textadept.session_file = filename or ta_session return true end @@ -382,7 +383,8 @@ end -- Saves split views, opened buffers, cursor information, and project manager -- details. -- @param filename The absolute path to the session file to save. Defaults to --- $HOME/.textadept/session if not specified. +-- either the current session file or $HOME/.textadept/session if not +-- specified. -- @usage textadept.io.save_session(filename) function save_session(filename) local session = {} @@ -444,7 +446,7 @@ function save_session(filename) ("pm: %d %s %s"):format(pm.width, pm.cursor or '0', pm.entry_text) -- Write the session. local ta_session = _USERHOME..'/session' - local f = io.open(filename or ta_session, 'wb') + local f = io.open(filename or textadept.session_file or ta_session, 'wb') if f then f:write(table.concat(session, '\n')) f:close() -- cgit v1.2.3