aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/events.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2009-01-23 22:26:00 -0500
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2009-01-23 22:26:00 -0500
commit8e7cd820df1e7b8f0c392d446592590c9a1d010f (patch)
treec68b4cd5563b36ad331409d708ddf14ec6895e02 /core/events.lua
parentc3fa652dc8386f4165469df2c45d0789bfae74bc (diff)
Allow _THEME to be a directory path, not just a name in themes/; core/events.lua
Diffstat (limited to 'core/events.lua')
-rw-r--r--core/events.lua24
1 files changed, 18 insertions, 6 deletions
diff --git a/core/events.lua b/core/events.lua
index 2383fbf7..1d227b30 100644
--- a/core/events.lua
+++ b/core/events.lua
@@ -214,7 +214,11 @@ add_handler('view_new',
buffer.property['lexer.lua.home'] = _HOME..'/lexers/'
buffer.property['lexer.lua.script'] = _HOME..'/lexers/lexer.lua'
if _THEME and #_THEME > 0 then
- buffer.property['lexer.lua.color.theme'] = _THEME
+ if not _THEME:match('[/\\]') then
+ buffer.property['lexer.lua.color.theme'] = _THEME
+ else -- _THEME is a folder path
+ buffer.property['lexer.lua.color.theme'] = _THEME..'/lexer.lua'
+ end
end
-- lexer
@@ -233,8 +237,12 @@ add_handler('view_new',
end
if _THEME and #_THEME > 0 then
- local ret, errmsg =
- pcall(dofile, _HOME..'/themes/'.._THEME..'/view.lua')
+ local ret, errmsg
+ if not _THEME:match('[/\\]') then
+ ret, errmsg = pcall(dofile, _HOME..'/themes/'.._THEME..'/view.lua')
+ else -- _THEME is a folder path
+ ret, errmsg = pcall(dofile, _THEME..'/view.lua')
+ end
if ret then return end
io.stderr:write(errmsg)
end
@@ -307,13 +315,17 @@ add_handler('buffer_new',
buffer.code_page = textadept.constants.SC_CP_UTF8
if _THEME and #_THEME > 0 then
- local ret, errmsg =
- pcall(dofile, _HOME..'/themes/'.._THEME..'/buffer.lua')
+ local ret, errmsg
+ if not _THEME:match('[/\\]') then
+ ret, errmsg = pcall(dofile, _HOME..'/themes/'.._THEME..'/buffer.lua')
+ else -- _THEME is a folder path
+ ret, errmsg = pcall(dofile, _THEME..'/buffer.lua')
+ end
if ret then return end
io.stderr:write(errmsg)
end
- -- Default theme.
+ -- Default theme (Light).
-- folding
buffer.property['fold'] = '1'