diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/events.lua | 2 | ||||
-rw-r--r-- | core/file_io.lua | 12 | ||||
-rw-r--r-- | core/init.lua | 17 |
3 files changed, 14 insertions, 17 deletions
diff --git a/core/events.lua b/core/events.lua index a6060ab9..6ffe327f 100644 --- a/core/events.lua +++ b/core/events.lua @@ -202,7 +202,7 @@ add_handler('view_new', -- properties buffer.property['textadept.home'] = _HOME - buffer.property['lexer.lua.home'] = _HOME..'/lexers/' + buffer.property['lexer.lua.home'] = _LEXERPATH buffer.property['lexer.lua.script'] = _HOME..'/lexers/lexer.lua' if _THEME and #_THEME > 0 then local tfile = _THEME..'/lexer.lua' diff --git a/core/file_io.lua b/core/file_io.lua index 68cb777a..4cb9210f 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -313,15 +313,13 @@ end -- Textadept restores split views, opened buffers, cursor information, and -- project manager details. -- @param filename The absolute path to the session file to load. Defaults to --- $HOME/.ta_session if not specified. +-- $HOME/.textadept/session if not specified. -- @param only_pm Flag indicating whether or not to load only the Project -- Manager session settings. Defaults to false. -- @return true if the session file was opened and read; false otherwise. -- @usage textadept.io.load_session(filename) function load_session(filename, only_pm) - local user_dir = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE') - if not user_dir then return end - local ta_session = user_dir..'/.ta_session' + local ta_session = _USERHOME..'/session' local f = io.open(filename or ta_session, 'rb') if not f then return false end local current_view, splits = 1, { [0] = {} } @@ -384,7 +382,7 @@ end -- Saves split views, opened buffers, cursor information, and project manager -- details. -- @param filename The absolute path to the session file to save. Defaults to --- $HOME/.ta_session if not specified. +-- $HOME/.textadept/session if not specified. -- @usage textadept.io.save_session(filename) function save_session(filename) local session = {} @@ -445,9 +443,7 @@ function save_session(filename) session[#session + 1] = ("pm: %d %s %s"):format(pm.width, pm.cursor or '0', pm.entry_text) -- Write the session. - local user_dir = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE') - if not user_dir then return end - local ta_session = user_dir..'/.ta_session' + local ta_session = _USERHOME..'/session' local f = io.open(filename or ta_session, 'wb') if f then f:write(table.concat(session, '\n')) diff --git a/core/init.lua b/core/init.lua index 5039fe56..52e5ebae 100644 --- a/core/init.lua +++ b/core/init.lua @@ -9,15 +9,16 @@ else package.cpath = _HOME..'/core/?.dll;'..package.cpath end +_USERHOME = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE')..'/.textadept/' + +_LEXERPATH = _USERHOME..'/lexers/?.lua;'.._HOME..'/lexers/' + _THEME = 'light' -local user_dir = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE') -if user_dir then - local f = io.open(user_dir..'/.ta_theme', 'rb') - if f then - theme = f:read('*line'):match('[^\r\n]+') - f:close() - if theme and #theme > 0 then _THEME = theme end - end +local f = io.open(_USERHOME..'/theme', 'rb') +if f then + theme = f:read('*line'):match('[^\r\n]+') + f:close() + if theme and #theme > 0 then _THEME = theme end end require 'iface' |