aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/args.lua4
-rw-r--r--core/events.lua8
-rw-r--r--core/file_io.lua4
-rw-r--r--core/gui.lua6
-rw-r--r--core/init.lua2
-rw-r--r--core/keys.lua12
-rw-r--r--modules/cpp/init.lua6
-rw-r--r--modules/lua/init.lua6
-rw-r--r--modules/textadept/adeptsense.lua2
-rw-r--r--modules/textadept/bookmarks.lua2
-rw-r--r--modules/textadept/command_entry.lua4
-rw-r--r--modules/textadept/editing.lua4
-rw-r--r--modules/textadept/filter_through.lua4
-rw-r--r--modules/textadept/find.lua10
-rw-r--r--modules/textadept/keys.lua4
-rw-r--r--modules/textadept/menu.lua8
-rw-r--r--modules/textadept/mime_types.lua4
-rw-r--r--modules/textadept/run.lua4
-rw-r--r--modules/textadept/session.lua2
-rw-r--r--modules/textadept/snapopen.lua2
-rw-r--r--modules/textadept/snippets.lua14
21 files changed, 56 insertions, 56 deletions
diff --git a/core/args.lua b/core/args.lua
index 173ef914..f59a52cd 100644
--- a/core/args.lua
+++ b/core/args.lua
@@ -56,9 +56,9 @@ end
-- Shows all registered command line switches in a help dialog.
local function show_help()
- _G.print('Usage: textadept [args] [filenames]')
+ print('Usage: textadept [args] [filenames]')
local line = " %s [%d args]: %s"
- for k, v in pairs(switches) do _G.print(line:format(k, unpack(v, 2))) end
+ for k, v in pairs(switches) do print(line:format(k, unpack(v, 2))) end
os.exit()
end
register('-h', '--help', 0, show_help, 'Displays this')
diff --git a/core/events.lua b/core/events.lua
index 022ccad1..6b8ac99b 100644
--- a/core/events.lua
+++ b/core/events.lua
@@ -1,6 +1,6 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = _G.locale.localize
+local L = locale.localize
---
-- Textadept's core event structure and handlers.
@@ -132,9 +132,9 @@ module('events', package.seeall)
-- * `find_text`: The text to search for.
-- * `repl_text`: The text to replace found text with.
-- * `RESET_AFTER`: Called after resetting the Lua state. This is triggered by
--- `_G.reset()`.
+-- `reset()`.
-- * `RESET_BEFORE`: Called before resetting the Lua state. This is triggered by
--- `_G.reset()`.
+-- `reset()`.
-- * `SAVE_POINT_LEFT`: Called when a save point is left.
-- * `SAVE_POINT_REACHED`: Called when a save point is entered.
-- * `UPDATE_UI`: Called when either the text or styling of the buffer has
@@ -211,7 +211,7 @@ function emit(event, ...)
if not event then error(L('Undefined event name')) end
local h = handlers[event]
if not h then return end
- local pcall, unpack, type = _G.pcall, _G.unpack, _G.type
+ local pcall, unpack, type = pcall, unpack, type
for i = 1, #h do
local ok, result = pcall(h[i], unpack{...})
if not ok then
diff --git a/core/file_io.lua b/core/file_io.lua
index 016b66da..c7ca424f 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -1,7 +1,7 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = _G.locale.localize
-local events = _G.events
+local L = locale.localize
+local events = events
---
-- Extends Lua's io package to provide file input/output routines for Textadept.
diff --git a/core/gui.lua b/core/gui.lua
index 36c25165..24a68de9 100644
--- a/core/gui.lua
+++ b/core/gui.lua
@@ -1,7 +1,7 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = _G.locale.localize
-local gui = _G.gui
+local L = locale.localize
+local gui = gui
-- LuaDoc is in core/.gui.luadoc.
function gui.check_focused_buffer(buffer)
@@ -87,7 +87,7 @@ function gui.switch_buffer()
if i then view:goto_buffer(i + 1, true) end
end
-local connect = _G.events.connect
+local connect = events.connect
-- Sets default properties for a Scintilla window.
connect(events.VIEW_NEW, function()
diff --git a/core/init.lua b/core/init.lua
index f5eb769c..8bebca32 100644
--- a/core/init.lua
+++ b/core/init.lua
@@ -29,7 +29,7 @@ if not _THEME:find('[/\\]') then
end
-- LuaDoc is in core/._G.luadoc.
-function _G.user_dofile(filename)
+function user_dofile(filename)
if not lfs.attributes(_USERHOME..'/'..filename) then return false end
local ok, err = pcall(dofile, _USERHOME..'/'..filename)
if not ok then gui.print(err) end
diff --git a/core/keys.lua b/core/keys.lua
index bdd146ad..1fe62b17 100644
--- a/core/keys.lua
+++ b/core/keys.lua
@@ -1,6 +1,6 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = _G.locale.localize
+local L = locale.localize
---
-- Manages key commands in Textadept.
@@ -92,12 +92,12 @@ local ALT = 'a'..ADD
-- end settings
-- Optimize for speed.
-local string = _G.string
+local string = string
local string_char = string.char
-local xpcall = _G.xpcall
-local next = _G.next
-local type = _G.type
-local unpack = _G.unpack
+local xpcall = xpcall
+local next = next
+local type = type
+local unpack = unpack
local no_args = {}
local getmetatable = getmetatable
local error = function(e) events.emit(events.ERROR, e) end
diff --git a/modules/cpp/init.lua b/modules/cpp/init.lua
index 168699b4..a610528e 100644
--- a/modules/cpp/init.lua
+++ b/modules/cpp/init.lua
@@ -81,7 +81,7 @@ end
-- Container for C/C++-specific key commands.
-- @class table
-- @name _G.keys.cpp
-_G.keys.cpp = {
+keys.cpp = {
al = {
m = { io.open_file,
(_HOME..'/modules/cpp/init.lua'):iconv('UTF-8', _CHARSET) },
@@ -101,8 +101,8 @@ _G.keys.cpp = {
-- Container for C/C++-specific snippets.
-- @class table
-- @name _G.snippets.cpp
-if type(_G.snippets) == 'table' then
- _G.snippets.cpp = {
+if type(snippets) == 'table' then
+ snippets.cpp = {
rc = 'reinterpret_cast<%1>(%2(%<selected_text>))',
sc = 'static_cast<%1>(%2(%<selected_text>))',
cc = 'const_cast<%1>(%2(%<selected_text>))',
diff --git a/modules/lua/init.lua b/modules/lua/init.lua
index cf43934e..198aed3c 100644
--- a/modules/lua/init.lua
+++ b/modules/lua/init.lua
@@ -170,7 +170,7 @@ events.connect(events.FILE_AFTER_SAVE,
-- Container for Lua-specific key commands.
-- @class table
-- @name _G.keys.lua
-_G.keys.lua = {
+keys.lua = {
al = {
m = { io.open_file,
(_HOME..'/modules/lua/init.lua'):iconv('UTF-8', _CHARSET) },
@@ -183,12 +183,12 @@ _G.keys.lua = {
-- Snippets.
-if type(_G.snippets) == 'table' then
+if type(snippets) == 'table' then
---
-- Container for Lua-specific snippets.
-- @class table
-- @name _G.snippets.lua
- _G.snippets.lua = {
+ snippets.lua = {
l = "local %1(expr)%2( = %3(value))",
p = "print(%0)",
f = "function %1(name)(%2(args))\n\t%0\nend",
diff --git a/modules/textadept/adeptsense.lua b/modules/textadept/adeptsense.lua
index f7166660..cadbebcb 100644
--- a/modules/textadept/adeptsense.lua
+++ b/modules/textadept/adeptsense.lua
@@ -610,7 +610,7 @@ function show_apidoc(sense)
if apidocs.pos < 1 then apidocs.pos = #apidocs end
buffer:call_tip_show(buffer.current_pos, apidocs[apidocs.pos])
end)
- _G.timeout(1, function()
+ timeout(1, function()
if pcall(buffer.call_tip_active, buffer) then return true end
events.disconnect(events.CALL_TIP_CLICK, event_id)
end)
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua
index d4f01cf0..57e3da64 100644
--- a/modules/textadept/bookmarks.lua
+++ b/modules/textadept/bookmarks.lua
@@ -1,6 +1,6 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = _G.locale.localize
+local L = locale.localize
---
-- Bookmarks for the textadept module.
diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua
index 6eaf8daa..f0c771ed 100644
--- a/modules/textadept/command_entry.lua
+++ b/modules/textadept/command_entry.lua
@@ -1,8 +1,8 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-- Modified by Jay Gould.
-local L = _G.locale.localize
-local events = _G.events
+local L = locale.localize
+local events = events
-- Environment for abbreviated commands.
-- @class table
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index cf61af71..16ead02b 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -1,7 +1,7 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = _G.locale.localize
-local events = _G.events
+local L = locale.localize
+local events = events
local K = keys.KEYSYMS
---
diff --git a/modules/textadept/filter_through.lua b/modules/textadept/filter_through.lua
index 8f6b70db..a0cc0072 100644
--- a/modules/textadept/filter_through.lua
+++ b/modules/textadept/filter_through.lua
@@ -1,7 +1,7 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = _G.locale.localize
-local events = _G.events
+local L = locale.localize
+local events = events
---
-- Filter-Through for the textadept module.
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index 4010a5d6..a4298d67 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -1,7 +1,7 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = _G.locale.localize
-local events = _G.events
+local L = locale.localize
+local events = events
local find = gui.find
local c = _SCINTILLA.constants
@@ -165,7 +165,7 @@ function find.find_incremental()
end
events.connect(events.COMMAND_ENTRY_KEYPRESS, function(code)
- local K = _G.keys.KEYSYMS
+ local K = keys.KEYSYMS
if find.incremental then
if K[code] == 'esc' then
find.incremental = nil
@@ -190,8 +190,8 @@ events.connect(events.COMMAND_ENTRY_COMMAND, function(text)
end, 1) -- place before command_entry.lua's handler (if necessary)
-- Optimize for speed.
-local loadstring = _G.loadstring
-local pcall = _G.pcall
+local loadstring = loadstring
+local pcall = pcall
-- Runs the given code.
-- This function is passed to string.gsub() in the replace() function.
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index b4da1271..634e61e8 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -1,13 +1,13 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = _G.locale.localize
+local L = locale.localize
---
-- Defines key commands for Textadept.
-- This set of key commands is pretty standard among other text editors.
module('_m.textadept.keys', package.seeall)
-local keys = _G.keys
+local keys = keys
local _buffer, _view = buffer, view
local gui, m_textadept = gui, _m.textadept
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index 9343efaa..3cab568d 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -1,9 +1,9 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-- Modified by Robert Gieseke.
-local L = _G.locale.localize
-local events = _G.events
-local gui = _G.gui
+local L = locale.localize
+local events = events
+local gui = gui
---
-- Provides dynamic menus for Textadept.
@@ -317,7 +317,7 @@ end
-- entry is another table that corresponds to a particular menu. A menu can
-- have a 'title' key with string value. Each menu item is either a submenu
-- (another menu table) or a table consisting of two items: string menu text
--- and an action table just like `_G.keys`'s action table. If the menu text is
+-- and an action table just like `keys`'s action table. If the menu text is
-- 'separator', a menu separator is created and no action table is required.
function set_menubar(menubar)
menu_actions = {}
diff --git a/modules/textadept/mime_types.lua b/modules/textadept/mime_types.lua
index dcc7f404..a7a4f4e1 100644
--- a/modules/textadept/mime_types.lua
+++ b/modules/textadept/mime_types.lua
@@ -1,7 +1,7 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = _G.locale.localize
-local events = _G.events
+local L = locale.localize
+local events = events
---
-- Handles file-specific settings.
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index f95b56f7..34171ce2 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -1,7 +1,7 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = _G.locale.localize
-local events = _G.events
+local L = locale.localize
+local events = events
---
-- Module for running/executing source files.
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua
index a92ceb3e..f22307d6 100644
--- a/modules/textadept/session.lua
+++ b/modules/textadept/session.lua
@@ -1,6 +1,6 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = _G.locale.localize
+local L = locale.localize
---
-- Session support for the textadept module.
diff --git a/modules/textadept/snapopen.lua b/modules/textadept/snapopen.lua
index a155d74d..17979a2d 100644
--- a/modules/textadept/snapopen.lua
+++ b/modules/textadept/snapopen.lua
@@ -1,6 +1,6 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = _G.locale.localize
+local L = locale.localize
---
-- Snapopen for the textadept module.
diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua
index a3cfa313..a89931d1 100644
--- a/modules/textadept/snippets.lua
+++ b/modules/textadept/snippets.lua
@@ -1,6 +1,6 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = _G.locale.localize
+local L = locale.localize
---
-- Provides Lua-style snippets for Textadept.
@@ -104,9 +104,9 @@ module('_m.textadept.snippets', package.seeall)
--
-- ## Example
--
--- _G.snippets.snippet = '_G.snippets.%1 = \'%0\''
--- _G.snippets.file = '%<buffer.filename>'
--- _G.snippets.lua = {
+-- snippets.snippet = 'snippets.%1 = \'%0\''
+-- snippets.file = '%<buffer.filename>'
+-- snippets.lua = {
-- f = 'function %1(name)(%2(args))\n\t%0\nend'
-- }
--
@@ -182,7 +182,7 @@ function _insert(text)
local lexer = buffer:get_lexer()
trigger = buffer:text_range(buffer:word_start_position(buffer.current_pos),
buffer.current_pos)
- local snip = _G.snippets
+ local snip = snippets
text = snip[trigger]
if type(snip) == 'table' and snip[lexer] then snip = snip[lexer] end
text = snip[trigger] or text
@@ -215,14 +215,14 @@ end
function _select()
local list = {}
local table_concat, type = table.concat, type
- for trigger, text in pairs(_G.snippets) do
+ for trigger, text in pairs(snippets) do
if type(text) == 'string' and
trigger ~= '_NAME' and trigger ~= '_PACKAGE' then
list[#list + 1] = table_concat({trigger, 'global', text }, '\0')
end
end
local lexer = buffer:get_lexer()
- for trigger, text in pairs(_G.snippets[lexer] or {}) do
+ for trigger, text in pairs(snippets[lexer] or {}) do
if type(text) == 'string' then
list[#list + 1] = table_concat({trigger, lexer, text }, '\0')
end