aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/events.lua6
-rw-r--r--core/file_io.lua30
-rw-r--r--core/gui.lua42
-rw-r--r--core/init.lua3
-rw-r--r--core/keys.lua8
-rw-r--r--core/locale.lua26
-rw-r--r--modules/textadept/bookmarks.lua4
-rw-r--r--modules/textadept/command_entry.lua5
-rw-r--r--modules/textadept/editing.lua11
-rw-r--r--modules/textadept/filter_through.lua5
-rw-r--r--modules/textadept/find.lua49
-rw-r--r--modules/textadept/keys.lua13
-rw-r--r--modules/textadept/menu.lua303
-rw-r--r--modules/textadept/mime_types.lua6
-rw-r--r--modules/textadept/run.lua10
-rw-r--r--modules/textadept/session.lua10
-rw-r--r--modules/textadept/snapopen.lua8
-rw-r--r--modules/textadept/snippets.lua6
18 files changed, 253 insertions, 292 deletions
diff --git a/core/events.lua b/core/events.lua
index 87861fca..fed85a72 100644
--- a/core/events.lua
+++ b/core/events.lua
@@ -1,7 +1,5 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = locale.localize
-
local M = {}
--[[ This comment is for LuaDoc.
@@ -196,7 +194,7 @@ M.handlers = {}
-- @see disconnect
-- @name connect
function M.connect(event, f, index)
- if not event then error(L('Undefined event name')) end
+ if not event then error(_L['Undefined event name']) end
if not M.handlers[event] then M.handlers[event] = {} end
local h = M.handlers[event]
if index then table.insert(h, index, f) else h[#h + 1] = f end
@@ -227,7 +225,7 @@ local error_emitted = false
-- otherwise.
-- @name emit
function M.emit(event, ...)
- if not event then error(L('Undefined event name')) end
+ if not event then error(_L['Undefined event name']) end
local h = M.handlers[event]
if not h then return end
local pcall, table_unpack, type = pcall, table.unpack, type
diff --git a/core/file_io.lua b/core/file_io.lua
index b2e02ead..82ddd73d 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -1,8 +1,5 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = locale.localize
-local events = events
-
--[[ This comment is for LuaDoc.
---
-- Extends Lua's io package to provide file input/output routines for Textadept.
@@ -44,6 +41,7 @@ module('io')]]
-- * `filename`: The filename encoded in UTF-8.
-- Events.
+local events = events
events.FILE_OPENED = 'file_opened'
events.FILE_BEFORE_SAVE = 'file_before_save'
events.FILE_AFTER_SAVE = 'file_after_save'
@@ -106,7 +104,7 @@ io.try_encodings = { 'UTF-8', 'ASCII', 'ISO-8859-1', 'MacRoman' }
function io.open_file(utf8_filenames)
utf8_filenames = utf8_filenames or
gui.dialog('fileselect',
- '--title', L('Open'),
+ '--title', _L['Open'],
'--select-multiple',
'--with-directory',
(buffer.filename or ''):match('.+[/\\]') or '')
@@ -136,7 +134,7 @@ function io.open_file(utf8_filenames)
local ok, conv = pcall(string.iconv, text, 'UTF-8', try_encoding)
if ok then encoding, text = try_encoding, conv break end
end
- if not encoding then error(L('Encoding conversion failed.')) end
+ if not encoding then error(_L['Encoding conversion failed.']) end
end
else
encoding = nil
@@ -193,7 +191,9 @@ end
-- LuaDoc is in core/.buffer.luadoc.
local function set_encoding(buffer, encoding)
buffer:check_global()
- if not buffer.encoding then error(L('Cannot change binary file encoding')) end
+ if not buffer.encoding then
+ error(_L['Cannot change binary file encoding'])
+ end
local pos, first_visible_line = buffer.current_pos, buffer.first_visible_line
local text = buffer:get_text(buffer.length)
text = text:iconv(buffer.encoding, 'UTF-8')
@@ -233,7 +233,7 @@ local function save_as(buffer, utf8_filename)
buffer:check_global()
if not utf8_filename then
utf8_filename = gui.dialog('filesave',
- '--title', L('Save'),
+ '--title', _L['Save'],
'--with-directory',
(buffer.filename or ''):match('.+[/\\]') or '',
'--with-file',
@@ -265,13 +265,13 @@ end
local function close(buffer)
if not buffer then buffer = _G.buffer end
buffer:check_global()
- local filename = buffer.filename or buffer._type or L('Untitled')
+ local filename = buffer.filename or buffer._type or _L['Untitled']
if buffer.dirty and gui.dialog('msgbox',
- '--title', L('Close without saving?'),
- '--text', L('There are unsaved changes in'),
+ '--title', _L['Close without saving?'],
+ '--text', _L['There are unsaved changes in'],
'--informative-text', filename,
'--button1', 'gtk-cancel',
- '--button2', L('Close _without saving'),
+ '--button2', _L['Close _without saving'],
'--no-newline') ~= '2' then
return false
end
@@ -306,11 +306,11 @@ local function update_modified_file()
if buffer.modification_time < attributes.modification then
buffer.modification_time = attributes.modification
if gui.dialog('yesno-msgbox',
- '--title', L('Reload?'),
- '--text', L('Reload modified file?'),
+ '--title', _L['Reload?'],
+ '--text', _L['Reload modified file?'],
'--informative-text',
('"%s"\n%s'):format(utf8_filename,
- L('has been modified. Reload it?')),
+ _L['has been modified. Reload it?']),
'--no-cancel',
'--no-newline') == '1' then
buffer:reload()
@@ -342,6 +342,6 @@ end)
-- Prompts the user to open a recently opened file.
-- @name open_recent_file
function io.open_recent_file()
- local i = gui.filteredlist(L('Open'), L('File'), io.recent_files, true)
+ local i = gui.filteredlist(_L['Open'], _L['File'], io.recent_files, true)
if i then io.open_file(io.recent_files[i + 1]) end
end
diff --git a/core/gui.lua b/core/gui.lua
index c4461561..349c0dbb 100644
--- a/core/gui.lua
+++ b/core/gui.lua
@@ -1,6 +1,5 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = locale.localize
local gui = gui
--[[ This comment is for LuaDoc.
@@ -19,6 +18,8 @@ module('gui')]]
-- (Write-only)
-- * `size` [table]: The size of the Textadept window (`{ width, height }`).
+local _L = _L
+
-- Helper function for printing messages to buffers.
-- @see gui._print
local function _print(buffer_type, ...)
@@ -52,8 +53,8 @@ end
-- buffer, and prints to it.
-- @param buffer_type String type of message buffer.
-- @param ... Message strings.
--- @usage gui._print(L('[Error Buffer]'), error_message)
--- @usage gui._print(L('[Message Buffer]'), message)
+-- @usage gui._print(_L['[Error Buffer]'], error_message)
+-- @usage gui._print(_L['[Message Buffer]'], message)
-- @name _print
function gui._print(buffer_type, ...) pcall(_print, buffer_type, ...) end
@@ -63,7 +64,7 @@ function gui._print(buffer_type, ...) pcall(_print, buffer_type, ...) end
-- messages.
-- @param ... Message strings.
-- @name print
-function gui.print(...) gui._print(L('[Message Buffer]'), ...) end
+function gui.print(...) gui._print(_L['[Message Buffer]'], ...) end
---
-- Shortcut function for `gui.dialog('filtered_list', ...)` with 'Ok' and
@@ -102,13 +103,13 @@ end
-- selected one, if any.
-- @name switch_buffer
function gui.switch_buffer()
- local columns, items = { L('Name'), L('File') }, {}
+ local columns, items = { _L['Name'], _L['File'] }, {}
for _, buffer in ipairs(_BUFFERS) do
- local filename = buffer.filename or buffer._type or L('Untitled')
+ local filename = buffer.filename or buffer._type or _L['Untitled']
items[#items + 1] = (buffer.dirty and '*' or '')..filename:match('[^/\\]+$')
items[#items + 1] = filename
end
- local i = gui.filteredlist(L('Switch Buffers'), columns, items, true)
+ local i = gui.filteredlist(_L['Switch Buffers'], columns, items, true)
if i then view:goto_buffer(i + 1) end
end
@@ -170,7 +171,7 @@ function gui.set_theme(name)
elseif lfs.attributes(name) then
theme = name
end
- if not theme then error(('"%s" %s'):format(name, L("theme not found."))) end
+ if not theme then error(('"%s" %s'):format(name, _L["theme not found."])) end
if buffer and view then
local current_buffer, current_view = _BUFFERS[buffer], _VIEWS[view]
@@ -212,7 +213,7 @@ function gui.select_theme()
end
for theme in pairs(themes_found) do themes[#themes + 1] = theme end
table.sort(themes)
- local theme = gui.filteredlist(L('Select Theme'), L('Name'), themes)
+ local theme = gui.filteredlist(_L['Select Theme'], _L['Name'], themes)
if not theme then return end
gui.set_theme(theme)
local f = io.open(_USERHOME..'/theme', 'wb')
@@ -280,7 +281,7 @@ end)
-- Sets the title of the Textadept window to the buffer's filename.
-- @param buffer The global buffer.
local function set_title(buffer)
- local filename = buffer.filename or buffer._type or L('Untitled')
+ local filename = buffer.filename or buffer._type or _L['Untitled']
gui.title = string.format('%s %s Textadept (%s)', filename:match('[^/\\]+$'),
buffer.dirty and '*' or '-', filename)
end
@@ -316,7 +317,7 @@ connect(events.APPLEEVENT_ODOC, function(uri)
end)
local string_format = string.format
-local EOLs = { L('CRLF'), L('CR'), L('LF') }
+local EOLs = { _L['CRLF'], _L['CR'], _L['LF'] }
local GETLEXERLANGUAGE = _SCINTILLA.functions.get_lexer_language[1]
-- Sets docstatusbar text.
connect(events.UPDATE_UI, function()
@@ -326,12 +327,12 @@ connect(events.UPDATE_UI, function()
local col = buffer.column[pos] + 1
local lexer = buffer:private_lexer_call(GETLEXERLANGUAGE)
local eol = EOLs[buffer.eol_mode + 1]
- local tabs = string_format('%s %d', buffer.use_tabs and L('Tabs:') or
- L('Spaces:'), buffer.indent)
+ local tabs = string_format('%s %d', buffer.use_tabs and _L['Tabs:'] or
+ _L['Spaces:'], buffer.indent)
local enc = buffer.encoding or ''
gui.docstatusbar_text =
- string_format('%s %d/%d %s %d %s %s %s %s', L('Line:'), line,
- max, L('Col:'), col, lexer, eol, tabs, enc)
+ string_format('%s %d/%d %s %d %s %s %s %s', _L['Line:'],
+ line, max, _L['Col:'], col, lexer, eol, tabs, enc)
end)
-- Toggles folding.
@@ -391,22 +392,23 @@ connect(events.QUIT, function()
local list = {}
for _, buffer in ipairs(_BUFFERS) do
if buffer.dirty then
- list[#list + 1] = buffer.filename or buffer._type or L('Untitled')
+ list[#list + 1] = buffer.filename or buffer._type or _L['Untitled']
end
end
if #list > 0 and gui.dialog('msgbox',
- '--title', L('Quit without saving?'),
- '--text', L('The following buffers are unsaved:'),
+ '--title', _L['Quit without saving?'],
+ '--text',
+ _L['The following buffers are unsaved:'],
'--informative-text', table.concat(list, '\n'),
'--button1', 'gtk-cancel',
- '--button2', L('Quit _without saving'),
+ '--button2', _L['Quit _without saving'],
'--no-newline') ~= '2' then
return false
end
return true
end)
-connect(events.ERROR, function(...) gui._print(L('[Error Buffer]'), ...) end)
+connect(events.ERROR, function(...) gui._print(_L['[Error Buffer]'], ...) end)
--[[ The functions below are Lua C functions.
diff --git a/core/init.lua b/core/init.lua
index 5543cf99..93746589 100644
--- a/core/init.lua
+++ b/core/init.lua
@@ -8,7 +8,7 @@ os.setlocale('C', 'collate')
if jit then require 'compat' end -- compatibility for LuaJIT
_SCINTILLA = require 'iface'
args = require 'args'
-locale = require 'locale'
+_L = require 'locale'
events = require 'events'
require 'file_io'
require 'gui'
@@ -34,6 +34,7 @@ module('_G')]]
-- * `_USERHOME` [string]: Path to the user's `~/.textadept/`.
-- * `_CHARSET` [string]: The character set encoding of the filesystem. This is
-- used in [File I/O](../modules/io.html).
+-- * `_L` [table]: Contains all messages used by Textadept for localization.
-- * `RESETTING` [bool]: If [`reset()`](../modules/_G.html#reset) has been
-- called, this flag is `true` while the Lua state is being re-initialized.
-- * `WIN32` [bool]: If Textadept is running on Windows, this flag is `true`.
diff --git a/core/keys.lua b/core/keys.lua
index 9a186eed..e02b0454 100644
--- a/core/keys.lua
+++ b/core/keys.lua
@@ -1,7 +1,5 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = locale.localize
-
local M = {}
--[[ This comment is for LuaDoc.
@@ -188,7 +186,7 @@ local function run_key_command(lexer)
if key_type ~= 'function' and key_type ~= 'table' then return INVALID end
if key_type == 'table' and #key == 0 and next(key) then
- gui.statusbar_text = L('Keychain:')..' '..table.concat(keychain, ' ')
+ gui.statusbar_text = _L['Keychain:']..' '..table.concat(keychain, ' ')
return CHAIN
end
@@ -234,7 +232,7 @@ local function keypress(code, shift, control, alt, meta)
-- command itself.
keychain = {}
local text = gui.statusbar_text or ''
- if text == L('Invalid sequence') or text:find('^'..L('Keychain:')) then
+ if text == _L['Invalid sequence'] or text:find(_L['Keychain:']) then
gui.statusbar_text = ''
end
end
@@ -245,7 +243,7 @@ local function keypress(code, shift, control, alt, meta)
local size = #keychain - 1
clear_key_sequence()
if not success and size > 0 then -- INVALID keychain sequence
- gui.statusbar_text = L('Invalid sequence')
+ gui.statusbar_text = _L['Invalid sequence']
return true
end
-- PROPAGATE otherwise.
diff --git a/core/locale.lua b/core/locale.lua
index 3975c323..1ba3a8f1 100644
--- a/core/locale.lua
+++ b/core/locale.lua
@@ -2,37 +2,15 @@
local M = {}
---[[ This comment is for LuaDoc.
----
--- Contains all messages used by Textadept for localization.
-module('locale')]]
-
--- Markdown:
--- ## Fields
---
--- Each message ID in `core/locale.conf` is accessible as a field in this
--- module.
-
--- Contains all localizations for the current locale.
--- @class table
--- @name localizations
-local localizations = {}
-
local f = io.open(_USERHOME..'/locale.conf', 'rb')
if not f then f = io.open(_HOME..'/core/locale.conf', 'rb') end
if not f then error('"core/locale.conf" not found.') end
for line in f:lines() do
if not line:find('^%s*%%') then
local id, str = line:match('^(.-)%s*=%s*(.+)$')
- if id and str then localizations[id] = str end
+ if id and str then M[id] = str end
end
end
f:close()
----
--- Localizes the given string.
--- @param id String to localize.
--- @name localize
-function M.localize(id) return localizations[id] or 'No Localization' end
-
-return M
+return setmetatable(M, { __index = function() return 'No Localization' end })
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua
index 74a2ad7d..31ae08bb 100644
--- a/modules/textadept/bookmarks.lua
+++ b/modules/textadept/bookmarks.lua
@@ -1,7 +1,5 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = locale.localize
-
local M = {}
--[[ This comment is for LuaDoc.
@@ -91,7 +89,7 @@ function M.goto_bookmark()
markers[#markers + 1] = tostring(line + 1)..': '..text
line = buffer:marker_next(line + 1, 2^MARK_BOOKMARK)
until line < 0
- local line = gui.filteredlist(L('Select Bookmark'), 'Bookmark', markers)
+ local line = gui.filteredlist(_L['Select Bookmark'], _L['Bookmark'], markers)
if line then _m.textadept.editing.goto_line(line:match('^%d+')) end
end
diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua
index 465e7a02..9ee6dc0e 100644
--- a/modules/textadept/command_entry.lua
+++ b/modules/textadept/command_entry.lua
@@ -1,9 +1,6 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-- Modified by Jay Gould.
-local L = locale.localize
-local events = events
-
--[[ This comment is for LuaDoc.
---
-- Textadept's Command entry.
@@ -35,6 +32,8 @@ local env = setmetatable({}, {
end,
})
+local events = events
+
-- Execute a Lua command.
events.connect(events.COMMAND_ENTRY_COMMAND, function(command)
local f, err = load(command, nil, 'bt', env)
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index c39d699a..6128e320 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -1,9 +1,5 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = locale.localize
-local events = events
-local K = keys.KEYSYMS
-
local M = {}
--[[ This comment is for LuaDoc.
@@ -75,6 +71,9 @@ M.braces = { [40] = 1, [41] = 1, [91] = 1, [93] = 1, [123] = 1, [125] = 1 }
-- @name current_call_tip
local current_call_tip = {}
+local events = events
+local K = keys.KEYSYMS
+
-- Matches characters specified in char_matches.
events.connect(events.CHAR_ADDED, function(c)
if not M.AUTOPAIR then return end
@@ -255,8 +254,8 @@ end
function M.goto_line(line)
if not line then
line = tonumber(gui.dialog('standard-inputbox',
- '--title', L('Go To'),
- '--text', L('Line Number:'),
+ '--title', _L['Go To'],
+ '--text', _L['Line Number:'],
'--no-newline'):match('%-?%d+$'))
if not line or line < 0 then return end
end
diff --git a/modules/textadept/filter_through.lua b/modules/textadept/filter_through.lua
index c97562fe..5a981270 100644
--- a/modules/textadept/filter_through.lua
+++ b/modules/textadept/filter_through.lua
@@ -1,8 +1,5 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = locale.localize
-local events = events
-
local M = {}
--[[ This comment is for LuaDoc.
@@ -31,6 +28,8 @@ function M.filter_through()
gui.command_entry.focus()
end
+local events = events
+
events.connect(events.COMMAND_ENTRY_KEYPRESS, function(code)
if filter_through_active and keys.KEYSYMS[code] == 'esc' then
filter_through_active = false
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index dddc1800..8086d5a8 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -1,9 +1,6 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = locale.localize
-local events = events
local find = gui.find
-local c = _SCINTILLA.constants
--[[ This comment is for LuaDoc.
---
@@ -40,16 +37,17 @@ module('gui.find')]]
-- * `in_files_label_text` [string]: The text of the 'In files' label. This is
-- primarily used for localization. (Write-only)
-find.find_label_text = L('Find:')
-find.replace_label_text = L('Replace:')
-find.find_next_button_text = L('Find Next')
-find.find_prev_button_text = L('Find Prev')
-find.replace_button_text = L('Replace')
-find.replace_all_button_text = L('Replace All')
-find.match_case_label_text = L('Match case')
-find.whole_word_label_text = L('Whole word')
-find.lua_pattern_label_text = L('Lua pattern')
-find.in_files_label_text = L('In files')
+local _L = _L
+find.find_label_text = _L['Find:']
+find.replace_label_text = _L['Replace:']
+find.find_next_button_text = _L['Find Next']
+find.find_prev_button_text = _L['Find Prev']
+find.replace_button_text = _L['Replace']
+find.replace_all_button_text = _L['Replace All']
+find.match_case_label_text = _L['Match case']
+find.whole_word_label_text = _L['Whole word']
+find.lua_pattern_label_text = _L['Lua pattern']
+find.in_files_label_text = _L['In files']
local MARK_FIND = _SCINTILLA.next_marker_number()
local MARK_FIND_COLOR = 0x4D9999
@@ -72,7 +70,7 @@ local escapes = {
function find.find_in_files(utf8_dir)
if not utf8_dir then
utf8_dir = gui.dialog('fileselect',
- '--title', L('Find in Files'),
+ '--title', _L['Find in Files'],
'--select-only-directories',
'--with-directory',
(buffer.filename or ''):match('^.+[/\\]') or '',
@@ -113,13 +111,16 @@ function find.find_in_files(utf8_dir)
end
local dir = utf8_dir:iconv(_CHARSET, 'UTF-8')
search_dir(dir)
- if #matches == 1 then matches[2] = L('No results found') end
+ if #matches == 1 then matches[2] = _L['No results found'] end
matches[#matches + 1] = ''
- if buffer._type ~= L('[Files Found Buffer]') then preferred_view = view end
- gui._print(L('[Files Found Buffer]'), table.concat(matches, '\n'))
+ if buffer._type ~= _L['[Files Found Buffer]'] then preferred_view = view end
+ gui._print(_L['[Files Found Buffer]'], table.concat(matches, '\n'))
end
end
+local events = events
+local c = _SCINTILLA.constants
+
-- Finds and selects text in the current buffer.
-- @param text The text to find.
-- @param next Flag indicating whether or not the search direction is forward.
@@ -178,10 +179,10 @@ local function find_(text, next, flags, nowrap, wrapped)
if result == -1 and not nowrap and not wrapped then -- wrap the search
local anchor, pos = buffer.anchor, buffer.current_pos
buffer:goto_pos((next or flags >= 8) and 0 or buffer.length)
- gui.statusbar_text = L('Search wrapped')
+ gui.statusbar_text = _L['Search wrapped']
result = find_(text, next, flags, true, true)
if result == -1 then
- gui.statusbar_text = L('No results found')
+ gui.statusbar_text = _L['No results found']
buffer:line_scroll(0, first_visible_line)
buffer:goto_pos(anchor)
end
@@ -249,8 +250,8 @@ local function run(code)
local ok, val = pcall(load('return '..code))
if not ok then
gui.dialog('ok-msgbox',
- '--title', L('Error'),
- '--text', L('An error occured:'),
+ '--title', _L['Error'],
+ '--text', _L['An error occured:'],
'--informative-text', val:gsub('"', '\\"'),
'--no-cancel')
error()
@@ -332,7 +333,7 @@ local function replace_all(ftext, rtext, flags)
buffer:set_sel(anchor, current_pos)
buffer:marker_delete_handle(end_marker)
end
- gui.statusbar_text = ("%d %s"):format(count, L('replacement(s) made'))
+ gui.statusbar_text = ("%d %s"):format(count, _L['replacement(s) made'])
buffer:end_undo_action()
end
events.connect(events.REPLACE_ALL, replace_all)
@@ -342,7 +343,7 @@ events.connect(events.REPLACE_ALL, replace_all)
-- @param pos The position of the caret.
-- @param line_num The line double-clicked.
local function goto_file(pos, line_num)
- if buffer._type == L('[Files Found Buffer]') then
+ if buffer._type == _L['[Files Found Buffer]'] then
line = buffer:get_line(line_num)
local file, file_line_num = line:match('^(.+):(%d+):.+$')
if file and file_line_num then
@@ -365,7 +366,7 @@ events.connect(events.DOUBLE_CLICK, goto_file)
function find.goto_file_in_list(next)
local orig_view = _VIEWS[view]
for _, buffer in ipairs(_BUFFERS) do
- if buffer._type == L('[Files Found Buffer]') then
+ if buffer._type == _L['[Files Found Buffer]'] then
for j, view in ipairs(_VIEWS) do
if view.buffer == buffer then
gui.goto_view(j)
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index ce23107f..50ea4dd7 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -1,8 +1,5 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = locale.localize
-local gui = gui
-
local M = {}
--[[
@@ -12,7 +9,7 @@ local M = {}
-- This module, should be 'require'ed last, but before _m.textadept.menu.
module('_m.textadept.keys')]]
-local keys, _buffer, _view = keys, buffer, view
+local keys, gui, _buffer, _view = keys, gui, buffer, view
local m_textadept, m_editing = _m.textadept, _m.textadept.editing
local c, OSX = _SCINTILLA.constants, OSX
@@ -38,8 +35,8 @@ M.utils = {
show_style = function()
local buffer = buffer
local style = buffer.style_at[buffer.current_pos]
- local text = string.format("%s %s\n%s %s (%d)", L('Lexer'),
- buffer:get_lexer(), L('Style'),
+ local text = string.format("%s %s\n%s %s (%d)", _L['Lexer'],
+ buffer:get_lexer(), _L['Style'],
buffer:get_style_name(style), style)
buffer:call_tip_show(buffer.current_pos, text)
end,
@@ -78,12 +75,12 @@ M.utils = {
if WIN32 then
cmd = string.format('start "" "%s"', url)
local p = io.popen(cmd)
- if not p then error(L('Error loading webpage:')..url) end
+ if not p then error(_L['Error loading webpage:']..url) end
p:close()
else
cmd = string.format(OSX and 'open "file://%s"' or 'xdg-open "%s" &', url)
local _, _, code = os.execute(cmd)
- if code ~= 0 then error(L('Error loading webpage:')..url) end
+ if code ~= 0 then error(_L['Error loading webpage:']..url) end
end
end
}
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index 70fc406d..8cb7bc1c 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -1,9 +1,6 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-- Contributions from Robert Gieseke.
-local L = locale.localize
-local gui = gui
-
local M = {}
--[[ This comment is for LuaDoc.
@@ -13,7 +10,7 @@ local M = {}
-- looks up defined key commands to show them in menus.
module('_m.textadept.menu')]]
-local _buffer, _view = buffer, view
+local _L, gui, _buffer, _view = _L, gui, buffer, view
local m_textadept, m_editing = _m.textadept, _m.textadept.editing
local c, SEPARATOR = _SCINTILLA.constants, { 'separator' }
local utils = m_textadept.keys.utils
@@ -36,184 +33,188 @@ end
-- @class table
-- @name menubar
M.menubar = {
- { title = L('File'),
- { L('gtk-new'), new_buffer },
- { L('gtk-open'), io.open_file },
- { L('Open Recent...'), io.open_recent_file },
- { L('Reload'), _buffer.reload },
- { L('gtk-save'), _buffer.save },
- { L('gtk-save-as'), _buffer.save_as },
+ { title = _L['File'],
+ { _L['gtk-new'], new_buffer },
+ { _L['gtk-open'], io.open_file },
+ { _L['Open Recent...'], io.open_recent_file },
+ { _L['Reload'], _buffer.reload },
+ { _L['gtk-save'], _buffer.save },
+ { _L['gtk-save-as'], _buffer.save_as },
SEPARATOR,
- { L('gtk-close'), _buffer.close },
- { L('Close All'), io.close_all },
+ { _L['gtk-close'], _buffer.close },
+ { _L['Close All'], io.close_all },
SEPARATOR,
- { L('Load Session...'), m_textadept.session.prompt_load },
- { L('Save Session...'), m_textadept.session.prompt_save },
+ { _L['Load Session...'], m_textadept.session.prompt_load },
+ { _L['Save Session...'], m_textadept.session.prompt_save },
SEPARATOR,
- { L('gtk-quit'), quit },
+ { _L['gtk-quit'], quit },
},
- { title = L('Edit'),
- { L('gtk-undo'), _buffer.undo },
- { L('gtk-redo'), _buffer.redo },
+ { title = _L['Edit'],
+ { _L['gtk-undo'], _buffer.undo },
+ { _L['gtk-redo'], _buffer.redo },
SEPARATOR,
- { L('gtk-cut'), _buffer.cut },
- { L('gtk-copy'), _buffer.copy },
- { L('gtk-paste'), _buffer.paste },
- { L('Duplicate Line'), _buffer.line_duplicate },
- { L('gtk-delete'), _buffer.clear },
- { L('gtk-select-all'), _buffer.select_all },
+ { _L['gtk-cut'], _buffer.cut },
+ { _L['gtk-copy'], _buffer.copy },
+ { _L['gtk-paste'], _buffer.paste },
+ { _L['Duplicate Line'], _buffer.line_duplicate },
+ { _L['gtk-delete'], _buffer.clear },
+ { _L['gtk-select-all'], _buffer.select_all },
SEPARATOR,
- { L('Match Brace'), m_editing.match_brace },
- { L('Complete Word'), { m_editing.autocomplete_word, '%w_' } },
- { L('Delete Word'), { m_editing.current_word, 'delete' } },
- { L('Highlight Word'), m_editing.highlight_word },
- { L('Toggle Block Comment'), m_editing.block_comment },
- { L('Transpose Characters'), m_editing.transpose_chars },
- { L('Join Lines'), m_editing.join_lines },
- { title = L('Select'),
- { L('Select to Matching Brace'), { m_editing.match_brace, 'select' } },
- { L('Select between XML Tags'), { m_editing.select_enclosed, '>', '<' } },
- { L('Select in XML Tag'), { m_editing.select_enclosed, '<', '>' } },
- { L('Select in Single Quotes'), { m_editing.select_enclosed, "'", "'" } },
- { L('Select in Double Quotes'), { m_editing.select_enclosed, '"', '"' } },
- { L('Select in Parentheses'), { m_editing.select_enclosed, '(', ')' } },
- { L('Select in Brackets'), { m_editing.select_enclosed, '[', ']' } },
- { L('Select in Braces'), { m_editing.select_enclosed, '{', '}' } },
- { L('Select Word'), { m_editing.current_word, 'select' } },
- { L('Select Line'), m_editing.select_line },
- { L('Select Paragraph'), m_editing.select_paragraph },
- { L('Select Indented Block'), m_editing.select_indented_block },
+ { _L['Match Brace'], m_editing.match_brace },
+ { _L['Complete Word'], { m_editing.autocomplete_word, '%w_' } },
+ { _L['Delete Word'], { m_editing.current_word, 'delete' } },
+ { _L['Highlight Word'], m_editing.highlight_word },
+ { _L['Toggle Block Comment'], m_editing.block_comment },
+ { _L['Transpose Characters'], m_editing.transpose_chars },
+ { _L['Join Lines'], m_editing.join_lines },
+ { title = _L['Select'],
+ { _L['Select to Matching Brace'], { m_editing.match_brace, 'select' } },
+ { _L['Select between XML Tags'],
+ { m_editing.select_enclosed, '>', '<' } },
+ { _L['Select in XML Tag'], { m_editing.select_enclosed, '<', '>' } },
+ { _L['Select in Single Quotes'],
+ { m_editing.select_enclosed, "'", "'" } },
+ { _L['Select in Double Quotes'],
+ { m_editing.select_enclosed, '"', '"' } },
+ { _L['Select in Parentheses'], { m_editing.select_enclosed, '(', ')' } },
+ { _L['Select in Brackets'], { m_editing.select_enclosed, '[', ']' } },
+ { _L['Select in Braces'], { m_editing.select_enclosed, '{', '}' } },
+ { _L['Select Word'], { m_editing.current_word, 'select' } },
+ { _L['Select Line'], m_editing.select_line },
+ { _L['Select Paragraph'], m_editing.select_paragraph },
+ { _L['Select Indented Block'], m_editing.select_indented_block },
},
- { title = L('Selection'),
- { L('Upper Case Selection'), _buffer.upper_case },
- { L('Lower Case Selection'), _buffer.lower_case },
+ { title = _L['Selection'],
+ { _L['Upper Case Selection'], _buffer.upper_case },
+ { _L['Lower Case Selection'], _buffer.lower_case },
SEPARATOR,
- { L('Enclose as XML Tags'), utils.enclose_as_xml_tags },
- { L('Enclose as Single XML Tag'), { m_editing.enclose, '<', ' />' } },
- { L('Enclose in Single Quotes'), { m_editing.enclose, "'", "'" } },
- { L('Enclose in Double Quotes'), { m_editing.enclose, '"', '"' } },
- { L('Enclose in Parentheses'), { m_editing.enclose, '(', ')' } },
- { L('Enclose in Brackets'), { m_editing.enclose, '[', ']' } },
- { L('Enclose in Braces'), { m_editing.enclose, '{', '}' } },
+ { _L['Enclose as XML Tags'], utils.enclose_as_xml_tags },
+ { _L['Enclose as Single XML Tag'], { m_editing.enclose, '<', ' />' } },
+ { _L['Enclose in Single Quotes'], { m_editing.enclose, "'", "'" } },
+ { _L['Enclose in Double Quotes'], { m_editing.enclose, '"', '"' } },
+ { _L['Enclose in Parentheses'], { m_editing.enclose, '(', ')' } },
+ { _L['Enclose in Brackets'], { m_editing.enclose, '[', ']' } },
+ { _L['Enclose in Braces'], { m_editing.enclose, '{', '}' } },
SEPARATOR,
- { L('Grow Selection'), { m_editing.grow_selection, 1 } },
- { L('Shrink Selection'), { m_editing.grow_selection, -1 } },
+ { _L['Grow Selection'], { m_editing.grow_selection, 1 } },
+ { _L['Shrink Selection'], { m_editing.grow_selection, -1 } },
SEPARATOR,
- { L('Move Selected Lines Up'), _buffer.move_selected_lines_up },
- { L('Move Selected Lines Down'), _buffer.move_selected_lines_down },
+ { _L['Move Selected Lines Up'], _buffer.move_selected_lines_up },
+ { _L['Move Selected Lines Down'], _buffer.move_selected_lines_down },
},
},
- { title = L('Search'),
- { L('gtk-find'), gui.find.focus },
- { L('Find Next'), gui.find.find_next },
- { L('Find Previous'), gui.find.find_prev },
- { L('Replace'), gui.find.replace },
- { L('Replace All'), gui.find.replace_all },
- { L('Find Incremental'), gui.find.find_incremental },
+ { title = _L['Search'],
+ { _L['gtk-find'], gui.find.focus },
+ { _L['Find Next'], gui.find.find_next },
+ { _L['Find Previous'], gui.find.find_prev },
+ { _L['Replace'], gui.find.replace },
+ { _L['Replace All'], gui.find.replace_all },
+ { _L['Find Incremental'], gui.find.find_incremental },
SEPARATOR,
- { L('Find in Files'), utils.find_in_files },
- { L('Goto Next File Found'), { gui.find.goto_file_in_list, true } },
- { L('Goto Previous File Found'), { gui.find.goto_file_in_list, false } },
+ { _L['Find in Files'], utils.find_in_files },
+ { _L['Goto Next File Found'], { gui.find.goto_file_in_list, true } },
+ { _L['Goto Previous File Found'], { gui.find.goto_file_in_list, false } },
SEPARATOR,
- { L('gtk-jump-to'), m_editing.goto_line },
+ { _L['gtk-jump-to'], m_editing.goto_line },
},
- { title = L('Tools'),
- { L('Command Entry'), gui.command_entry.focus },
- { L('Select Command'), utils.select_command },
+ { title = _L['Tools'],
+ { _L['Command Entry'], gui.command_entry.focus },
+ { _L['Select Command'], utils.select_command },
SEPARATOR,
- { L('Run'), m_textadept.run.run },
- { L('Compile'), m_textadept.run.compile },
- { L('Filter Through'), _m.textadept.filter_through.filter_through },
+ { _L['Run'], m_textadept.run.run },
+ { _L['Compile'], m_textadept.run.compile },
+ { _L['Filter Through'], _m.textadept.filter_through.filter_through },
SEPARATOR,
- { title = L('Adeptsense'),
- { L('Complete Symbol'), m_textadept.adeptsense.complete_symbol },
- { L('Show Documentation'), m_textadept.adeptsense.show_documentation },
+ { title = _L['Adeptsense'],
+ { _L['Complete Symbol'], m_textadept.adeptsense.complete_symbol },
+ { _L['Show Documentation'], m_textadept.adeptsense.show_documentation },
},
- { title = L('Bookmark'),
- { L('Toggle Bookmark'), m_textadept.bookmarks.toggle },
- { L('Clear Bookmarks'), m_textadept.bookmarks.clear },
- { L('Next Bookmark'), m_textadept.bookmarks.goto_next },
- { L('Previous Bookmark'), m_textadept.bookmarks.goto_prev },
- { L('Goto Bookmark...'), m_textadept.bookmarks.goto_bookmark },
+ { title = _L['Bookmark'],
+ { _L['Toggle Bookmark'], m_textadept.bookmarks.toggle },
+ { _L['Clear Bookmarks'], m_textadept.bookmarks.clear },
+ { _L['Next Bookmark'], m_textadept.bookmarks.goto_next },
+ { _L['Previous Bookmark'], m_textadept.bookmarks.goto_prev },
+ { _L['Goto Bookmark...'], m_textadept.bookmarks.goto_bookmark },
},
- { title = L('Snapopen'),
- { L('Snapopen User Home'), { m_textadept.snapopen.open, _USERHOME } },
- { L('Snapopen Textadept Home'), { m_textadept.snapopen.open, _HOME } },
- { L('Snapopen Current Directory'), utils.snapopen_filedir },
+ { title = _L['Snapopen'],
+ { _L['Snapopen User Home'], { m_textadept.snapopen.open, _USERHOME } },
+ { _L['Snapopen Textadept Home'], { m_textadept.snapopen.open, _HOME } },
+ { _L['Snapopen Current Directory'], utils.snapopen_filedir },
},
- { title = L('Snippets'),
- { L('Insert Snippet...'), m_textadept.snippets._select },
- { L('Expand Snippet/Next Placeholder'), m_textadept.snippets._insert },
- { L('Previous Snippet Placeholder'), m_textadept.snippets._previous },
- { L('Cancel Snippet'), m_textadept.snippets._cancel_current },
+ { title = _L['Snippets'],
+ { _L['Insert Snippet...'], m_textadept.snippets._select },
+ { _L['Expand Snippet/Next Placeholder'], m_textadept.snippets._insert },
+ { _L['Previous Snippet Placeholder'], m_textadept.snippets._previous },
+ { _L['Cancel Snippet'], m_textadept.snippets._cancel_current },
},
SEPARATOR,
- { L('Show Style'), utils.show_style },
+ { _L['Show Style'], utils.show_style },
},
- { title = L('Buffer'),
- { L('Next Buffer'), { _view.goto_buffer, _view, 1, true } },
- { L('Previous Buffer'), { _view.goto_buffer, _view, -1, true } },
- { L('Switch to Buffer...'), gui.switch_buffer },
+ { title = _L['Buffer'],
+ { _L['Next Buffer'], { _view.goto_buffer, _view, 1, true } },
+ { _L['Previous Buffer'], { _view.goto_buffer, _view, -1, true } },
+ { _L['Switch to Buffer...'], gui.switch_buffer },
SEPARATOR,
- { title = L('Indentation'),
- { L('Tab width: 2'), { utils.set_indentation, 2 } },
- { L('Tab width: 3'), { utils.set_indentation, 3 } },
- { L('Tab width: 4'), { utils.set_indentation, 4 } },
- { L('Tab width: 8'), { utils.set_indentation, 8 } },
+ { title = _L['Indentation'],
+ { _L['Tab width: 2'], { utils.set_indentation, 2 } },
+ { _L['Tab width: 3'], { utils.set_indentation, 3 } },
+ { _L['Tab width: 4'], { utils.set_indentation, 4 } },
+ { _L['Tab width: 8'], { utils.set_indentation, 8 } },
SEPARATOR,
- { L('Toggle Use Tabs'), { utils.toggle_property, 'use_tabs' } },
- { L('Convert Indentation'), m_editing.convert_indentation },
+ { _L['Toggle Use Tabs'], { utils.toggle_property, 'use_tabs' } },
+ { _L['Convert Indentation'], m_editing.convert_indentation },
},
- { title = L('EOL Mode'),
- { L('CRLF'), { utils.set_eol_mode, c.SC_EOL_CRLF } },
- { L('CR'), { utils.set_eol_mode, c.SC_EOL_CR } },
- { L('LF'), { utils.set_eol_mode, c.SC_EOL_LF } },
+ { title = _L['EOL Mode'],
+ { _L['CRLF'], { utils.set_eol_mode, c.SC_EOL_CRLF } },
+ { _L['CR'], { utils.set_eol_mode, c.SC_EOL_CR } },
+ { _L['LF'], { utils.set_eol_mode, c.SC_EOL_LF } },
},
- { title = L('Encoding'),
- { L('UTF-8 Encoding'), { utils.set_encoding, 'UTF-8' } },
- { L('ASCII Encoding'), { utils.set_encoding, 'ASCII' } },
- { L('ISO-8859-1 Encoding'), { utils.set_encoding, 'ISO-8859-1' } },
- { L('MacRoman Encoding'), { utils.set_encoding, 'MacRoman' } },
- { L('UTF-16 Encoding'), { utils.set_encoding, 'UTF-16LE' } },
+ { title = _L['Encoding'],
+ { _L['UTF-8 Encoding'], { utils.set_encoding, 'UTF-8' } },
+ { _L['ASCII Encoding'], { utils.set_encoding, 'ASCII' } },
+ { _L['ISO-8859-1 Encoding'], { utils.set_encoding, 'ISO-8859-1' } },
+ { _L['MacRoman Encoding'], { utils.set_encoding, 'MacRoman' } },
+ { _L['UTF-16 Encoding'], { utils.set_encoding, 'UTF-16LE' } },
},
SEPARATOR,
- { L('Select Lexer...'), m_textadept.mime_types.select_lexer },
- { L('Refresh Syntax Highlighting'), { _buffer.colourise, _buffer, 0, -1 } },
+ { _L['Select Lexer...'], m_textadept.mime_types.select_lexer },
+ { _L['Refresh Syntax Highlighting'],
+ { _buffer.colourise, _buffer, 0, -1 } },
},
- { title = L('View'),
- { L('Next View'), { gui.goto_view, 1, true } },
- { L('Previous View'), { gui.goto_view, -1, true } },
+ { title = _L['View'],
+ { _L['Next View'], { gui.goto_view, 1, true } },
+ { _L['Previous View'], { gui.goto_view, -1, true } },
SEPARATOR,
- { L('Split View Horizontal'), { _view.split, _view } },
- { L('Split View Vertical'), { _view.split, _view, true } },
- { L('Unsplit View'), { _view.unsplit, _view } },
- { L('Unsplit All Views'), utils.unsplit_all },
- { L('Grow View'), { utils.grow, 10 } },
- { L('Shrink View'), { utils.shrink, 10 } },
+ { _L['Split View Horizontal'], { _view.split, _view } },
+ { _L['Split View Vertical'], { _view.split, _view, true } },
+ { _L['Unsplit View'], { _view.unsplit, _view } },
+ { _L['Unsplit All Views'], utils.unsplit_all },
+ { _L['Grow View'], { utils.grow, 10 } },
+ { _L['Shrink View'], { utils.shrink, 10 } },
SEPARATOR,
- { L('Toggle Current Fold'), utils.toggle_current_fold },
+ { _L['Toggle Current Fold'], utils.toggle_current_fold },
SEPARATOR,
- { L('Toggle View EOL'), { utils.toggle_property, 'view_eol' } },
- { L('Toggle Wrap Mode'), { utils.toggle_property, 'wrap_mode' } },
- { L('Toggle Show Indent Guides'),
+ { _L['Toggle View EOL'], { utils.toggle_property, 'view_eol' } },
+ { _L['Toggle Wrap Mode'], { utils.toggle_property, 'wrap_mode' } },
+ { _L['Toggle Show Indent Guides'],
{ utils.toggle_property, 'indentation_guides' } },
- { L('Toggle View Whitespace'), { utils.toggle_property, 'view_ws' } },
- { L('Toggle Virtual Space'),
+ { _L['Toggle View Whitespace'], { utils.toggle_property, 'view_ws' } },
+ { _L['Toggle Virtual Space'],
{ utils.toggle_property, 'virtual_space_options',
c.SCVS_USERACCESSIBLE } },
SEPARATOR,
- { L('Zoom In'), _buffer.zoom_in },
- { L('Zoom Out'), _buffer.zoom_out },
- { L('Reset Zoom'), utils.reset_zoom },
+ { _L['Zoom In'], _buffer.zoom_in },
+ { _L['Zoom Out'], _buffer.zoom_out },
+ { _L['Reset Zoom'], utils.reset_zoom },
SEPARATOR,
- { L('Select Theme...'), gui.select_theme },
+ { _L['Select Theme...'], gui.select_theme },
},
- { title = L('Help'),
- { L('Show Manual'),
+ { title = _L['Help'],
+ { _L['Show Manual'],
{ utils.open_webpage, _HOME..'/doc/manual/1_Introduction.html' } },
- { L('Show LuaDoc'), { utils.open_webpage, _HOME..'/doc/index.html' } },
+ { _L['Show LuaDoc'], { utils.open_webpage, _HOME..'/doc/index.html' } },
SEPARATOR,
- { L('gtk-about'),
+ { _L['gtk-about'],
{ gui.dialog, 'ok-msgbox', '--title', 'Textadept', '--informative-text',
_RELEASE, '--no-cancel' } },
},
@@ -224,15 +225,15 @@ M.menubar = {
-- @class table
-- @name context_menu
M.context_menu = {
- { L('gtk-undo'), _buffer.undo },
- { L('gtk-redo'), _buffer.redo },
+ { _L['gtk-undo'], _buffer.undo },
+ { _L['gtk-redo'], _buffer.redo },
SEPARATOR,
- { L('gtk-cut'), _buffer.cut },
- { L('gtk-copy'), _buffer.copy },
- { L('gtk-paste'), _buffer.paste },
- { L('gtk-delete'), _buffer.clear },
+ { _L['gtk-cut'], _buffer.cut },
+ { _L['gtk-copy'], _buffer.copy },
+ { _L['gtk-paste'], _buffer.paste },
+ { _L['gtk-delete'], _buffer.clear },
SEPARATOR,
- { L('gtk-select-all'), _buffer.select_all }
+ { _L['gtk-select-all'], _buffer.select_all }
}
local key_shortcuts = {}
@@ -324,12 +325,12 @@ local function build_command_tables(menu, title, items, commands)
end
end
-local columns = { L('Command'), L('Key Command') }
+local columns = { _L['Command'], _L['Key Command'] }
---
-- Prompts the user with a filteredlist to run menu commands.
-- @name select_command
function M.select_command()
- local i = gui.filteredlist(L('Run Command'), columns, items, true)
+ local i = gui.filteredlist(_L['Run Command'], columns, items, true)
if i then keys.run_command(commands[i + 1], type(commands[i + 1])) end
end
@@ -347,7 +348,7 @@ events.connect(events.MENU_CLICKED, function(menu_id)
local actions = menu_id < 1000 and menu_actions or contextmenu_actions
local action = actions[menu_id < 1000 and menu_id or menu_id - 1000]
if type(action) ~= 'function' and type(action) ~= 'table' then
- error(L('Unknown command:')..' '..tostring(action))
+ error(_L['Unknown command:']..' '..tostring(action))
end
keys.run_command(action, type(action))
end)
diff --git a/modules/textadept/mime_types.lua b/modules/textadept/mime_types.lua
index c763895d..6ab0e0d3 100644
--- a/modules/textadept/mime_types.lua
+++ b/modules/textadept/mime_types.lua
@@ -1,8 +1,5 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = locale.localize
-local events = events
-
local M = {}
--[[ This comment is for LuaDoc.
@@ -33,6 +30,7 @@ module('_m.textadept.mime_types')]]
-- * `lang`: The language lexer name.
-- Events.
+local events = events
events.LANGUAGE_MODULE_LOADED = 'language_module_loaded'
---
@@ -108,7 +106,7 @@ table.sort(M.lexers)
-- buffer.
-- @name select_lexer
function M.select_lexer()
- local lexer = gui.filteredlist(L('Select Lexer'), 'Name', M.lexers)
+ local lexer = gui.filteredlist(_L['Select Lexer'], _L['Name'], M.lexers)
if lexer then buffer:set_lexer(lexer) end
end
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index 88967d1c..08033c70 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -1,8 +1,5 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = locale.localize
-local events = events
-
local M = {}
--[[ This comment is for LuaDoc.
@@ -32,6 +29,7 @@ module('_m.textadept.run')]]
-- * `output`: The output from the command.
-- Events.
+local events = events
events.COMPILE_OUTPUT = 'compile_output'
events.RUN_OUTPUT = 'run_output'
@@ -139,8 +137,8 @@ M.error_detail = {}
-- @param line_num The line double-clicked.
-- @see error_detail
function goto_error(pos, line_num)
- if buffer._type ~= L('[Message Buffer]') and
- buffer._type ~= L('[Error Buffer]') then
+ if buffer._type ~= _L['[Message Buffer]'] and
+ buffer._type ~= _L['[Error Buffer]'] then
return
end
local buffer = buffer
@@ -156,7 +154,7 @@ function goto_error(pos, line_num)
local msg = captures[error_detail.message]
if msg then buffer:call_tip_show(buffer.current_pos, msg) end
else
- error(string.format('"%s" %s', utf8_filename, L('does not exist')))
+ error(string.format('"%s" %s', utf8_filename, _L['does not exist']))
end
return
end
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua
index 217f8101..fe77650d 100644
--- a/modules/textadept/session.lua
+++ b/modules/textadept/session.lua
@@ -1,7 +1,5 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = locale.localize
-
local M = {}
--[[ This comment is for LuaDoc.
@@ -92,8 +90,8 @@ function M.load(filename)
gui.goto_view(current_view)
if #not_found > 0 then
gui.dialog('msgbox',
- '--title', L('Session Files Not Found'),
- '--text', L('The following session files were not found'),
+ '--title', _L['Session Files Not Found'],
+ '--text', _L['The following session files were not found'],
'--informative-text', table.concat(not_found, '\n'))
end
return true
@@ -174,7 +172,7 @@ end
-- @name prompt_load
function M.prompt_load()
local utf8_filename = gui.dialog('fileselect',
- '--title', L('Load Session'),
+ '--title', _L['Load Session'],
'--with-directory',
M.DEFAULT_SESSION:match('.+[/\\]') or '',
'--with-file',
@@ -188,7 +186,7 @@ end
-- @name prompt_save
function M.prompt_save()
local utf8_filename = gui.dialog('filesave',
- '--title', L('Save Session'),
+ '--title', _L['Save Session'],
'--with-directory',
M.DEFAULT_SESSION:match('.+[/\\]') or '',
'--with-file',
diff --git a/modules/textadept/snapopen.lua b/modules/textadept/snapopen.lua
index bcf7e482..02d20f2a 100644
--- a/modules/textadept/snapopen.lua
+++ b/modules/textadept/snapopen.lua
@@ -1,7 +1,5 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = locale.localize
-
local M = {}
--[[ This comment is for LuaDoc.
@@ -116,13 +114,13 @@ function M.open(utf8_paths, filter, exclusive, depth)
for _, path in ipairs(utf8_paths) do add_directory(path, list, 1, filter) end
if #list >= M.MAX then
gui.dialog('ok-msgbox',
- '--title', L('File Limit Exceeded'),
+ '--title', _L['File Limit Exceeded'],
'--informative-text',
string.format('%d %s %d', M.MAX,
- L('files or more were found. Showing the first'),
+ _L['files or more were found. Showing the first'],
M.MAX))
end
- local utf8_filenames = gui.filteredlist(L('Open'), L('File'), list, false,
+ local utf8_filenames = gui.filteredlist(_L['Open'], _L['File'], list, false,
'--select-multiple') or ''
for filename in utf8_filenames:gmatch('[^\n]+') do io.open_file(filename) end
end
diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua
index 189c5e92..d0ed65ee 100644
--- a/modules/textadept/snippets.lua
+++ b/modules/textadept/snippets.lua
@@ -1,7 +1,5 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local L = locale.localize
-
local M = {}
--[[ This comment is for LuaDoc.
@@ -236,8 +234,8 @@ function M._select()
for i = 1, #list do
t[#t + 1], t[#t + 2], t[#t + 3] = list[i]:match('^(%Z+)%z(%Z+)%z(%Z+)$')
end
- local i = gui.filteredlist(L('Select Snippet'),
- { L('Trigger'), L('Scope'), L('Snippet Text') },
+ local i = gui.filteredlist(_L['Select Snippet'],
+ { _L['Trigger'], _L['Scope'], _L['Snippet Text'] },
t, true, '--output-column', '2')
if i then M._insert(t[(i + 1) * 3]) end
end