aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/events.lua10
-rw-r--r--core/gui.lua12
-rw-r--r--core/init.lua6
3 files changed, 12 insertions, 16 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
diff --git a/core/gui.lua b/core/gui.lua
index e317ecd6..9f49be19 100644
--- a/core/gui.lua
+++ b/core/gui.lua
@@ -61,12 +61,12 @@ function gui.switch_buffer()
end
local out =
gui.dialog('filteredlist',
- '--title', locale.SWITCH_BUFFERS,
- '--button1', 'gtk-ok',
- '--button2', 'gtk-cancel',
- '--no-newline',
- '--columns', 'Name', 'File',
- '--items', unpack(items))
+ '--title', locale.SWITCH_BUFFERS,
+ '--button1', 'gtk-ok',
+ '--button2', 'gtk-cancel',
+ '--no-newline',
+ '--columns', 'Name', 'File',
+ '--items', unpack(items))
local i = tonumber(out:match('%-?%d+$'))
if i and i >= 0 then view:goto_buffer(i + 1, true) end
end
diff --git a/core/init.lua b/core/init.lua
index cb880579..dda18806 100644
--- a/core/init.lua
+++ b/core/init.lua
@@ -26,8 +26,8 @@ if f then
end
if not _THEME:find('[/\\]') then
local theme = _THEME
- _THEME = _HOME..'/themes/'..theme
- if not lfs.attributes(_THEME) then _THEME = _USERHOME..'/themes/'..theme end
+ _THEME = _USERHOME..'/themes/'..theme
+ if not lfs.attributes(_THEME) then _THEME = _HOME..'/themes/'..theme end
end
require 'iface'
@@ -36,8 +36,6 @@ require 'events'
require 'file_io'
require 'gui'
-rawset = nil -- do not allow modifications which could compromise stability
-
-- LuaDoc is in core/._G.lua.
function _G.user_dofile(filename)
if lfs.attributes(_USERHOME..'/'..filename) then