aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/events.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2010-06-16 18:10:13 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2010-06-16 18:10:13 -0400
commitc94eb63139d7ca800a05596157a65f560f610a91 (patch)
treedbfe3a8e3e48f2467fad3fe487fb0ac64aafce5c /core/events.lua
parent5245d1b62be50ebb2efc266eaf579b3d32a49e1f (diff)
Code and documentation cleanup.
Diffstat (limited to 'core/events.lua')
-rw-r--r--core/events.lua10
1 files changed, 4 insertions, 6 deletions
diff --git a/core/events.lua b/core/events.lua
index 3313d919..15c6f77c 100644
--- a/core/events.lua
+++ b/core/events.lua
@@ -143,8 +143,6 @@ module('events', package.seeall)
-- events.connect('my_event', my_event_handler)
-- events.emit('my_event', 'my message')
-local events = events
-
---
-- Adds a handler function to an event.
-- @param event The string event name. It is arbitrary and need not be defined
@@ -155,8 +153,8 @@ local events = events
-- @see disconnect
function connect(event, f, index)
local plural = event..'s'
- if not events[plural] then events[plural] = {} end
- local handlers = events[plural]
+ if not _M[plural] then _M[plural] = {} end
+ local handlers = _M[plural]
if index then
table.insert(handlers, index, f)
else
@@ -187,7 +185,7 @@ end
-- @return true or false if any handler explicitly returned such; nil otherwise.
function emit(event, ...)
local plural = event..'s'
- local handlers = events[plural]
+ local handlers = _M[plural]
if not handlers then return end
for _, f in ipairs(handlers) do
local result = f(unpack{...})
@@ -430,7 +428,7 @@ if MAC then
function(uri) return emit('uri_dropped', 'file://'..uri) end)
connect('buffer_new',
- function()
+ function() -- GTK-OSX has clipboard problems
buffer.paste = function()
local clipboard_text = gui.clipboard_text
if #clipboard_text > 0 then buffer:replace_sel(clipboard_text) end