From f684f0c71d4090b5d03b9b0b27c6ddda92eda921 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sun, 25 Jan 2009 22:51:51 -0500 Subject: Look for ~/.ta_modules to load modules, falling back on init.lua's default ones. --- init.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 4159e1c3..9c7c07c4 100644 --- a/init.lua +++ b/init.lua @@ -5,6 +5,15 @@ local textadept = _G.textadept local mpath = _HOME..'/modules/?.lua;'.._HOME..'/modules/?/init.lua' package.path = mpath..';'..package.path +local loaded_user_modules = false +local user_dir = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE') +if user_dir then + local ret, errmsg = pcall(dofile, user_dir..'/.ta_modules') + if not ret and not errmsg:find('No such file') then error(errmsg) end + loaded_user_modules = ret +end + +if not loaded_user_modules then -- Core extension modules to load on startup. require 'ext/keys' -- provides key command support require 'ext/find' -- provides functionality for find/replace @@ -30,6 +39,7 @@ require 'ext/menu' -- provides the menu bar --require 'ext/key_commands_std' -- key commands for Windows and Linux --require 'ext/key_commands_mac' -- key commands for Mac OSX require 'ext/key_commands' -- key commands for Mitchell (Nano-Emacs hybrid) +end if not RESETTING then -- for Windows, create arg table from single command line string (arg[0]) -- cgit v1.2.3