aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/mime_types.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2013-04-25 09:34:01 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2013-04-25 09:34:01 -0400
commit02a014c3d865ce5a426d2fd0f69c801b7f5a0fc0 (patch)
tree5f51c20606a3cd81312237f305f3fe8845598e26 /modules/textadept/mime_types.lua
parentcb57c684e1fb68ac8b4fc9c26a33bce603265eba (diff)
downloadtextadept-02a014c3d865ce5a426d2fd0f69c801b7f5a0fc0.tar.gz
textadept-02a014c3d865ce5a426d2fd0f69c801b7f5a0fc0.zip
Code and documentation cleanup.
Diffstat (limited to 'modules/textadept/mime_types.lua')
-rw-r--r--modules/textadept/mime_types.lua19
1 files changed, 8 insertions, 11 deletions
diff --git a/modules/textadept/mime_types.lua b/modules/textadept/mime_types.lua
index 7449da19..9ba2397e 100644
--- a/modules/textadept/mime_types.lua
+++ b/modules/textadept/mime_types.lua
@@ -6,7 +6,7 @@ local M = {}
---
-- Handles file type detection for Textadept.
-- @field _G.events.LANGUAGE_MODULE_LOADED (string)
--- Called after loading a language-specific module.
+-- Emitted after loading a language-specific module.
-- This is useful for overriding a language-specific module's key bindings
-- or other properties since the module is not loaded when Textadept starts.
-- Arguments:
@@ -70,22 +70,19 @@ for line in mime_types:gmatch('[^\r\n]+') do
end
---
--- List of detected lexers are read from *lexers/* and *~/.textadept/lexers/*.
+-- List of lexers found in `_LEXERPATH`.
-- @class table
-- @name lexers
M.lexers = {}
-- Generate lexer list
local lexers_found = {}
-for lexer in lfs.dir(_HOME..'/lexers') do
- if lexer:find('%.lua$') and lexer ~= 'lexer.lua' then
- lexers_found[lexer:match('^(.+)%.lua$')] = true
- end
-end
-if lfs.attributes(_USERHOME..'/lexers') then
- for lexer in lfs.dir(_USERHOME..'/lexers') do
- if lexer:find('%.lua$') and lexer ~= 'lexer.lua' then
- lexers_found[lexer:match('^(.+)%.lua$')] = true
+for dir in _LEXERPATH:gsub('[/\\]%?%.lua', ''):gmatch('[^;]+') do
+ if lfs.attributes(dir) then
+ for lexer in lfs.dir(dir) do
+ if lexer:find('%.lua$') and lexer ~= 'lexer.lua' then
+ lexers_found[lexer:match('^(.+)%.lua$')] = true
+ end
end
end
end