aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/init.lua
blob: 8242176fb28f2c7282a402bea2628390c9d6f855 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
-- Copyright 2007-2010 Mitchell mitchell<att>caladbolg.net. See LICENSE.

_RELEASE = "Textadept 3.5"

package.path = _HOME..'/core/?.lua;'..package.path
os.setlocale('C', 'collate')

require 'iface'
require 'args'
require 'locale'
require 'events'
require 'file_io'
require 'gui'
require 'keys'

_LEXERPATH = _USERHOME..'/lexers/?.lua;'.._HOME..'/lexers'

_THEME = 'light'
local f = io.open(_USERHOME..'/theme', 'rb')
if f then
  local theme = f:read('*line'):match('[^\r\n]+')
  f:close()
  if theme and #theme > 0 then _THEME = theme end
end
if not _THEME:find('[/\\]') then
  local theme = _THEME
  _THEME = _USERHOME..'/themes/'..theme
  if not lfs.attributes(_THEME) then _THEME = _HOME..'/themes/'..theme end
end

-- LuaDoc is in core/._G.luadoc.
function _G.user_dofile(filename)
  if lfs.attributes(_USERHOME..'/'..filename) then
    local ok, err = pcall(dofile, _USERHOME..'/'..filename)
    if not ok then gui.print(err) end
    return ok
  end
  return false
end