aboutsummaryrefslogtreecommitdiff
path: root/modules/lua/init.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 /modules/lua/init.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 'modules/lua/init.lua')
-rw-r--r--modules/lua/init.lua12
1 files changed, 5 insertions, 7 deletions
diff --git a/modules/lua/init.lua b/modules/lua/init.lua
index 9abe2277..de9c7450 100644
--- a/modules/lua/init.lua
+++ b/modules/lua/init.lua
@@ -24,13 +24,13 @@ local M = {}
-- from *`_USERHOME`/modules/lua/api*.
module('_M.lua')]]
-local m_editing, m_run = _M.textadept.editing, _M.textadept.run
-- Comment string tables use lexer names.
-m_editing.comment_string.lua = '--'
+_M.textadept.editing.comment_string.lua = '--'
+
-- Compile and Run command tables use file extensions.
-m_run.compile_command.lua = 'luac %(filename)'
-m_run.run_command.lua = 'lua %(filename)'
-m_run.error_detail.lua = {
+_M.textadept.run.compile_command.lua = 'luac %(filename)'
+_M.textadept.run.run_command.lua = 'lua %(filename)'
+_M.textadept.run.error_detail.lua = {
pattern = '^lua: (.-):(%d+): (.+)$',
filename = 1, line = 2, message = 3
}
@@ -109,7 +109,6 @@ local control_structure_patterns = {
-- @see control_structure_patterns
-- @name try_to_autocomplete_end
function M.try_to_autocomplete_end()
- local buffer = buffer
local line_num = buffer:line_from_position(buffer.current_pos)
local line = buffer:get_line(line_num)
local line_indentation = buffer.line_indentation
@@ -133,7 +132,6 @@ end
-- Show syntax errors as annotations.
events.connect(events.FILE_AFTER_SAVE, function()
if buffer:get_lexer() ~= 'lua' then return end
- local buffer = buffer
buffer:annotation_clear_all()
local text = buffer:get_text():gsub('^#![^\n]+', '') -- ignore shebang line
local f, err = load(text)