diff options
author | 2009-01-10 17:31:21 -0500 | |
---|---|---|
committer | 2009-01-10 17:31:21 -0500 | |
commit | ac698c5ea71d26e56289a18e664c6f8be1aa56c5 (patch) | |
tree | e683366e29ff29e8c0ebff54731ff505c201a6ff /core/file_io.lua | |
parent | 0194a626fcb17bcb037341fc6c2f586f54d26035 (diff) | |
download | textadept-ac698c5ea71d26e56289a18e664c6f8be1aa56c5.tar.gz textadept-ac698c5ea71d26e56289a18e664c6f8be1aa56c5.zip |
Various improvements to speed and readability of Lua code.
Added 'local textadept = _G.textadept' to all Lua modules, themes, etc.
Added more locals to core/ext/keys.lua for speed improvement.
Reformatted some Lua modules to the earlier standard committed.
Diffstat (limited to 'core/file_io.lua')
-rw-r--r-- | core/file_io.lua | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/file_io.lua b/core/file_io.lua index 943bc6f0..5e76e886 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -1,5 +1,7 @@ -- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE. +local textadept = _G.textadept + --- -- Provides file input/output routines for Textadept. -- Opens and saves files and sessions and reads API files. @@ -9,8 +11,6 @@ -- file_saved_as(filename) module('textadept.io', package.seeall) -local events = textadept.events - --- -- List of recently opened files. -- @class table @@ -34,7 +34,7 @@ local function open_helper(filename) end buffer.filename = filename buffer:set_save_point() - events.handle('file_opened', filename) + textadept.events.handle('file_opened', filename) recent_files[#recent_files + 1] = filename end @@ -92,7 +92,7 @@ function save(buffer) f:close() buffer:set_save_point() else - events.error(err) + textadept.events.error(err) end end @@ -115,7 +115,7 @@ function save_as(buffer, filename) if #filename > 0 then buffer.filename = filename buffer:save() - events.handle('file_saved_as', filename) + textadept.events.handle('file_saved_as', filename) end end @@ -179,7 +179,6 @@ end -- @return true if the session file was opened and read; false otherwise. -- @usage textadept.io.load_session(filename) function load_session(filename, only_pm) - local textadept = textadept local user_dir = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE') if not user_dir then return end local ta_session = user_dir..'/.ta_session' |