aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2009-01-25 22:51:51 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2009-01-25 22:51:51 -0500
commitf684f0c71d4090b5d03b9b0b27c6ddda92eda921 (patch)
treea5455084bda3532be3070d21d3101edfd347e036
parentefc086abed9be5cde8d8540d6b8640af975ddf3d (diff)
downloadtextadept-f684f0c71d4090b5d03b9b0b27c6ddda92eda921.tar.gz
textadept-f684f0c71d4090b5d03b9b0b27c6ddda92eda921.zip
Look for ~/.ta_modules to load modules, falling back on init.lua's default ones.
-rw-r--r--init.lua10
1 files changed, 10 insertions, 0 deletions
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])