diff options
author | 2011-07-11 17:41:06 -0400 | |
---|---|---|
committer | 2011-07-11 17:41:06 -0400 | |
commit | edd1a1c4f1bfb976177faab9390532fe66850f47 (patch) | |
tree | 1f6538fe19dbdad3a9e706cd70892f0f26db9553 /core/file_io.lua | |
parent | cf160f145890be7f5dd18c63421ed9fb40522063 (diff) | |
download | textadept-edd1a1c4f1bfb976177faab9390532fe66850f47.tar.gz textadept-edd1a1c4f1bfb976177faab9390532fe66850f47.zip |
Allow buffer functions to omit buffer argument.
This is primarily for key and menu commands to avoid creating too many
unnecessary tables.
Diffstat (limited to 'core/file_io.lua')
-rw-r--r-- | core/file_io.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/file_io.lua b/core/file_io.lua index 7079776f..750f0827 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -187,6 +187,7 @@ end -- LuaDoc is in core/.buffer.luadoc. local function reload(buffer) + if not buffer then buffer = _G.buffer end gui.check_focused_buffer(buffer) if not buffer.filename then return end local pos, first_visible_line = buffer.current_pos, buffer.first_visible_line @@ -224,6 +225,7 @@ end -- LuaDoc is in core/.buffer.luadoc. local function save(buffer) + if not buffer then buffer = _G.buffer end gui.check_focused_buffer(buffer) if not buffer.filename then return buffer:save_as() end events.emit(events.FILE_BEFORE_SAVE, buffer.filename) @@ -245,6 +247,7 @@ end -- LuaDoc is in core/.buffer.luadoc. local function save_as(buffer, utf8_filename) + if not buffer and not utf8_filename then buffer = _G.buffer end gui.check_focused_buffer(buffer) if not utf8_filename then utf8_filename = gui.dialog('filesave', @@ -277,6 +280,7 @@ end -- LuaDoc is in core/.buffer.luadoc. local function close(buffer) + if not buffer then buffer = _G.buffer end gui.check_focused_buffer(buffer) if buffer.dirty and gui.dialog('msgbox', |