aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/file_io.lua5
-rw-r--r--core/gui.lua3
-rw-r--r--core/keys.lua5
3 files changed, 4 insertions, 9 deletions
diff --git a/core/file_io.lua b/core/file_io.lua
index 35140c5a..602c0f19 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -250,13 +250,12 @@ end
-- Saves all dirty buffers to their respective files.
-- @usage io.save_all()
function save_all()
- local current_buffer, current_index = buffer, 1
+ local current_buffer = _BUFFERS[buffer]
for i, buffer in ipairs(_BUFFERS) do
view:goto_buffer(i)
- if buffer == current_buffer then current_index = i end
if buffer.filename and buffer.dirty then buffer:save() end
end
- view:goto_buffer(current_index)
+ view:goto_buffer(current_buffer)
end
-- LuaDoc is in core/.buffer.luadoc.
diff --git a/core/gui.lua b/core/gui.lua
index 3ebc63e5..4c9e26a1 100644
--- a/core/gui.lua
+++ b/core/gui.lua
@@ -272,8 +272,7 @@ connect(events.BUFFER_NEW, function() set_title(buffer) end)
connect(events.BUFFER_BEFORE_SWITCH, function()
local buffer = buffer
-- Save view state.
- buffer._anchor = buffer.anchor
- buffer._current_pos = buffer.current_pos
+ buffer._anchor, buffer._current_pos = buffer.anchor, buffer.current_pos
buffer._first_visible_line = buffer.first_visible_line
-- Save fold state.
buffer._folds = {}
diff --git a/core/keys.lua b/core/keys.lua
index a00beb7d..4d1ccf48 100644
--- a/core/keys.lua
+++ b/core/keys.lua
@@ -107,10 +107,7 @@ LANGUAGE_MODULE_PREFIX = (not OSX and CTRL or META)..'l'
local OSX = OSX
local string = string
local string_byte, string_char = string.byte, string.char
-local xpcall = xpcall
-local next = next
-local type = type
-local unpack = unpack
+local xpcall, next, type, unpack = xpcall, next, type, unpack
local no_args = {}
local getmetatable = getmetatable
local error = function(e) events.emit(events.ERROR, e) end