diff options
author | 2013-08-31 00:47:12 -0400 | |
---|---|---|
committer | 2013-08-31 00:47:12 -0400 | |
commit | d633a4c74e824113f5d242cb18573fed3015bc27 (patch) | |
tree | 41c05e5b83036493d61e68871dc3b011dd71bf03 /modules/textadept/keys.lua | |
parent | a54200e99b529d2fbbee6e27fabcb2e8de908c19 (diff) | |
download | textadept-d633a4c74e824113f5d242cb18573fed3015bc27.tar.gz textadept-d633a4c74e824113f5d242cb18573fed3015bc27.zip |
Allow user scripts to handle `BUFFER_NEW` and `VIEW_NEW` events on startup.
A side effect is more efficient event emission during startup.
Diffstat (limited to 'modules/textadept/keys.lua')
-rw-r--r-- | modules/textadept/keys.lua | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua index 95f182ab..27f44c86 100644 --- a/modules/textadept/keys.lua +++ b/modules/textadept/keys.lua @@ -289,6 +289,11 @@ M.utils = { buffer:cut() end } + +local keys, buffer, view = keys, buffer, view +local editing, utils = textadept.editing, M.utils +local OSX, CURSES = OSX, CURSES + -- The following buffer functions need to be constantized in order for menu -- items to identify the key associated with the functions. local menu_buffer_functions = { @@ -296,16 +301,7 @@ local menu_buffer_functions = { 'select_all', 'upper_case', 'lower_case', 'move_selected_lines_up', 'move_selected_lines_down', 'zoom_in', 'zoom_out', 'colourise' } -local function constantize_menu_buffer_functions() - local buffer = buffer - for _, f in ipairs(menu_buffer_functions) do buffer[f] = buffer[f] end -end -events.connect(events.BUFFER_NEW, constantize_menu_buffer_functions) -constantize_menu_buffer_functions() -- for the first buffer - -local keys, buffer, view = keys, buffer, view -local editing, utils = textadept.editing, M.utils -local OSX, CURSES = OSX, CURSES +for _, f in ipairs(menu_buffer_functions) do buffer[f] = buffer[f] end -- Windows and Linux key bindings. -- |