aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/editing.lua2
-rw-r--r--modules/textadept/find.lua2
-rw-r--r--modules/textadept/mime_types.lua19
-rw-r--r--modules/textadept/run.lua4
-rw-r--r--modules/textadept/session.lua9
5 files changed, 17 insertions, 19 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 2be18168..eb9aa8c5 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -344,7 +344,7 @@ function M.transpose_chars()
if eol then pos = pos - 1 end
buffer.target_start, buffer.target_end = pos - 1, pos + 1
buffer:replace_target(buffer:text_range(pos - 1, pos + 1):reverse())
- buffer:goto_pos(not eol and pos or pos + 1)
+ buffer:goto_pos(pos + 1)
end
---
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index 3dacfad6..c9d67ade 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -52,7 +52,7 @@ local M = gui.find
-- The text of the "In files" label.
-- This is primarily used for localization.
-- @field _G.events.FIND_WRAPPED (string)
--- Called when a search for text wraps, either from bottom to top when
+-- Emitted when a search for text wraps, either from bottom to top when
-- searching for a next occurrence, or from top to bottom when searching for a
-- previous occurrence.
-- This is useful for implementing a more visual or audible notice when a
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
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index 6f220385..3ee9d5df 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -18,7 +18,7 @@ local M = {}
-- command.
-- It is used for error messages with relative file paths.
-- @field _G.events.COMPILE_OUTPUT (string)
--- Called after executing a language's compile command.
+-- Emitted after executing a language's compile command.
-- By default, compiler output is printed to the message buffer. To override
-- this behavior, connect to the event with an index of `1` and return `true`.
-- Arguments:
@@ -26,7 +26,7 @@ local M = {}
-- * `lexer`: The lexer language name.
-- * `output`: The string output from the command.
-- @field _G.events.RUN_OUTPUT (string)
--- Called after executing a language's run command.
+-- Emitted after executing a language's run command.
-- By default, output is printed to the message buffer. To override this
-- behavior, connect to the event with an index of `1` and return `true`.
-- Arguments:
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua
index 98a5c56c..5ac2f50f 100644
--- a/modules/textadept/session.lua
+++ b/modules/textadept/session.lua
@@ -12,6 +12,8 @@ local M = {}
-- [`_G.CURSES`]: _G.html#CURSES
-- @field SAVE_ON_QUIT (bool)
-- Save the session when quitting.
+-- The session file saved is always `DEFAULT_SESSION`, even if a different
+-- session was loaded with [`load()`](#load).
-- The default value is `true`, but is disabled when passing the command line
-- switch `-n` or `--nosession` to Textadept.
-- @field MAX_RECENT_FILES (number)
@@ -100,7 +102,7 @@ function M.load(filename)
break
end
end
- if not exists then recent[#recent + 1] = filename end
+ if not exists then recent[#recent + 1] = filename end
end
end
f:close()
@@ -203,10 +205,9 @@ end, 1)
local function no_session() M.SAVE_ON_QUIT = false end
args.register('-n', '--nosession', 0, no_session, 'No session functionality')
-- Loads the given session on startup.
-local function load_session(name)
+args.register('-s', '--session', 1, function(name)
if lfs.attributes(name) then M.load(name) return end
M.load(_USERHOME..'/'..name)
-end
-args.register('-s', '--session', 1, load_session, 'Load session')
+end, 'Load session')
return M