From 2e042c305207e52831c1d5eb0706e2ebbf94ab1b Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 23 Mar 2010 06:12:30 -0400 Subject: Added textadept.user_dofile to load user files like key commands and snippets. --- core/init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'core/init.lua') diff --git a/core/init.lua b/core/init.lua index b55a3f04..7576e660 100644 --- a/core/init.lua +++ b/core/init.lua @@ -99,3 +99,11 @@ function textadept.switch_buffer() local i = tonumber(out:match('%-?%d+$')) if i and i >= 0 then view:goto_buffer(i + 1, true) end end + +-- LuaDoc is in core/.textadept.lua. +function textadept.user_dofile(filename) + if lfs.attributes(_USERHOME..'/'..filename) then + local ret, errmsg = pcall(dofile, _USERHOME..'/'..filename) + if not ret then textadept.print(errmsg) end + end +end -- cgit v1.2.3