diff options
author | 2013-09-06 23:43:34 -0400 | |
---|---|---|
committer | 2013-09-06 23:43:34 -0400 | |
commit | 541f34101692ae85a61398ccae1e72d279fe4580 (patch) | |
tree | 3bcc29437581850607bcf0bfe194214214804423 | |
parent | 9bff1b29293b50e506936e93c14d7a65e8b0ea29 (diff) |
Fixed bug in processing command line options introduced in r1546.
-rw-r--r-- | core/init.lua | 3 | ||||
-rw-r--r-- | init.lua | 7 | ||||
-rw-r--r-- | src/textadept.c | 4 |
3 files changed, 6 insertions, 8 deletions
diff --git a/core/init.lua b/core/init.lua index 522fae00..a1cca760 100644 --- a/core/init.lua +++ b/core/init.lua @@ -17,6 +17,9 @@ _M = {} -- language modules table -- LuaJIT compatibility. if jit then module, package.searchers, bit32 = nil, package.loaders, bit end +events.connect(events.INITIALIZED, + function() if arg then args.process(arg) end end) + --[[ This comment is for LuaDoc. --- -- Extends Lua's _G table to provide extra functions and fields for Textadept. @@ -12,10 +12,3 @@ package.cpath = _USERHOME..so.._USERHOME..'/modules'..so..package.cpath textadept = require('textadept') local ok, err = pcall(dofile, _USERHOME..'/init.lua') if not ok and lfs.attributes(_USERHOME..'/init.lua') then ui.print(err) end - -if arg then - events.emit(events.BUFFER_NEW) -- for the first buffer - events.emit(events.VIEW_NEW) -- for the first view - args.process(arg) -end -events.emit(events.INITIALIZED) diff --git a/src/textadept.c b/src/textadept.c index d8f7d097..2161fbdc 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -1401,7 +1401,7 @@ static int lreset(lua_State *L) { l_setglobalview(L, focused_view); l_setglobaldoc(L, SS(focused_view, SCI_GETDOCPOINTER, 0, 0)); lua_pushnil(L), lua_setglobal(L, "arg"); - lL_dofile(L, "init.lua"); + lL_dofile(L, "init.lua"), lL_event(L, "initialized", -1); lua_getfield(L, LUA_REGISTRYINDEX, "ta_arg"), lua_setglobal(L, "arg"); lL_event(L, "reset_after", -1); return 0; @@ -2321,6 +2321,8 @@ int main(int argc, char **argv) { setlocale(LC_COLLATE, "C"), setlocale(LC_NUMERIC, "C"); if (lua = luaL_newstate(), !lL_init(lua, argc, argv, FALSE)) return 1; initing = TRUE, new_window(), lL_dofile(lua, "init.lua"), initing = FALSE; + lL_event(lua, "buffer_new", -1), lL_event(lua, "view_new", -1); // first ones + lL_event(lua, "initialized", -1); #if (__APPLE__ && !CURSES) gtkosx_application_ready(osxapp); #endif |