aboutsummaryrefslogtreecommitdiff
path: root/core/file_io.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2013-04-29 16:13:59 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2013-04-29 16:13:59 -0400
commit78990df4f114c45adc7fd2678ffaedf0c4124d95 (patch)
tree9e79e8f93aa07ee9384b5ddd8cc548dc3c8ea20f /core/file_io.lua
parent8407377bbe3800dbc4706f584285b7a7858efabc (diff)
downloadtextadept-78990df4f114c45adc7fd2678ffaedf0c4124d95.tar.gz
textadept-78990df4f114c45adc7fd2678ffaedf0c4124d95.zip
More code cleanup.
"local buffer = buffer" and similar optimizations are not needed since lexing the buffer is much more expensive and reaction time is limited by how fast the keyboard can submit key presses.
Diffstat (limited to 'core/file_io.lua')
-rw-r--r--core/file_io.lua8
1 files changed, 3 insertions, 5 deletions
diff --git a/core/file_io.lua b/core/file_io.lua
index 137463d9..145159a4 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -79,7 +79,7 @@ io.recent_files = {}
-- @class table
-- @name boms
io.boms = {
- ['UTF-16BE'] = '\254\255', ['UTF-16LE'] = '\255\254',
+ ['UTF-16BE'] = '\254\255', ['UTF-16LE'] = '\255\254',
['UTF-32BE'] = '\0\0\254\255', ['UTF-32LE'] = '\255\254\0\0'
}
@@ -346,7 +346,6 @@ end
-- of Textadept.
local function update_modified_file()
if not buffer.filename then return end
- local buffer = buffer
local utf8_filename = buffer.filename
local filename = utf8_filename:iconv(_CHARSET, 'UTF-8')
local mod_time = lfs.attributes(filename, 'modification')
@@ -373,7 +372,6 @@ events_connect(events.VIEW_AFTER_SWITCH, update_modified_file)
-- Set additional buffer functions.
events_connect(events.BUFFER_NEW, function()
- local buffer = buffer
buffer.reload = reload
buffer.save, buffer.save_as = save, save_as
buffer.close = close
@@ -382,8 +380,8 @@ end)
-- Close initial "Untitled" buffer.
events_connect(events.FILE_OPENED, function(utf8_filename)
- local b = _BUFFERS[1]
- if #_BUFFERS == 2 and not (b.filename or b._type or b.dirty) then
+ local buf = _BUFFERS[1]
+ if #_BUFFERS == 2 and not (buf.filename or buf._type or buf.dirty) then
view:goto_buffer(1)
buffer:close()
end