aboutsummaryrefslogtreecommitdiff
path: root/core/file_io.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2009-07-08 21:18:27 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2009-07-08 21:18:27 -0400
commit29808b6c6224d22a2f36b1d1a573b23001a0638c (patch)
treef4009d66af4754efbbd1c9a902fbc35701b6c7c4 /core/file_io.lua
parent3c3401d47c364140d8e1ebe95f6cb2b9e188f698 (diff)
downloadtextadept-29808b6c6224d22a2f36b1d1a573b23001a0638c.tar.gz
textadept-29808b6c6224d22a2f36b1d1a573b23001a0638c.zip
Better session management.
Can load and save from the menu now as well.
Diffstat (limited to 'core/file_io.lua')
-rw-r--r--core/file_io.lua6
1 files changed, 4 insertions, 2 deletions
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()