aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2013-09-09 21:48:15 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2013-09-09 21:48:15 -0400
commit7e88330753edcf2df034e2240c2e77e1006d2e64 (patch)
tree63b7afd8d28129922e7eb5c1f64f7af9dd58813f /modules/textadept
parent393e320d1f8170ff76fb18fca34b5dbdf36dd31f (diff)
downloadtextadept-7e88330753edcf2df034e2240c2e77e1006d2e64.tar.gz
textadept-7e88330753edcf2df034e2240c2e77e1006d2e64.zip
Moved buffer IO functions into the `io` module.
Menus and key bindings do not need `events.INITIALIZED`.
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/init.lua8
-rw-r--r--modules/textadept/keys.lua12
-rw-r--r--modules/textadept/menu.lua12
-rw-r--r--modules/textadept/run.lua2
-rw-r--r--modules/textadept/session.lua2
5 files changed, 17 insertions, 19 deletions
diff --git a/modules/textadept/init.lua b/modules/textadept/init.lua
index b3049a49..9dd072b7 100644
--- a/modules/textadept/init.lua
+++ b/modules/textadept/init.lua
@@ -19,10 +19,8 @@ M.run = require('textadept.run')
M.session = require('textadept.session')
M.snippets = require('textadept.snippets')
-events.connect(events.INITIALIZED, function()
- -- These need to be loaded last.
- M.keys = require('textadept.keys')
- M.menu = require('textadept.menu')
-end)
+-- These need to be loaded last.
+M.keys = require('textadept.keys')
+M.menu = require('textadept.menu')
return M
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index 3acb2a28..f7cb599b 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -258,7 +258,7 @@ M.utils = {
events.emit(events.UPDATE_UI) -- for updating statusbar
end,
set_encoding = function(encoding)
- buffer:set_encoding(encoding)
+ io.set_buffer_encoding(encoding)
events.emit(events.UPDATE_UI) -- for updating statusbar
end,
set_eol_mode = function(mode)
@@ -363,11 +363,11 @@ for _, f in ipairs(menu_buffer_functions) do buffer[f] = buffer[f] end
keys[not OSX and (not CURSES and 'cn' or 'cmn') or 'mn'] = buffer.new
keys[not OSX and 'co' or 'mo'] = io.open_file
keys[not OSX and not CURSES and 'cao' or 'cmo'] = io.open_recent_file
-keys[not OSX and (not CURSES and 'cO' or 'mo') or 'mO'] = buffer.reload
-keys[not OSX and 'cs' or 'ms'] = buffer.save
-keys[not OSX and (not CURSES and 'cS' or 'cms') or 'mS'] = buffer.save_as
-keys[not OSX and 'cw' or 'mw'] = buffer.close
-keys[not OSX and (not CURSES and 'cW' or 'cmw') or 'mW'] = io.close_all
+keys[not OSX and (not CURSES and 'cO' or 'mo') or 'mO'] = io.reload_file
+keys[not OSX and 'cs' or 'ms'] = io.save_file
+keys[not OSX and (not CURSES and 'cS' or 'cms') or 'mS'] = io.save_file_as
+keys[not OSX and 'cw' or 'mw'] = io.close_buffer
+keys[not OSX and (not CURSES and 'cW' or 'cmw') or 'mW'] = io.close_all_buffers
-- TODO: textadept.sessions.load
-- TODO: textadept.sessions.save
keys[not OSX and 'cq' or 'mq'] = quit
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index b67f8916..af8e7550 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -21,12 +21,12 @@ local menubar = {
{_L['_New'], buffer.new},
{_L['_Open'], io.open_file},
{_L['Open _Recent...'], io.open_recent_file},
- {_L['Re_load'], buffer.reload},
- {_L['_Save'], buffer.save},
- {_L['Save _As'], buffer.save_as},
+ {_L['Re_load'], io.reload_file},
+ {_L['_Save'], io.save_file},
+ {_L['Save _As'], io.save_file_as},
SEPARATOR,
- {_L['_Close'], buffer.close},
- {_L['Close All'], io.close_all},
+ {_L['_Close'], io.close_buffer},
+ {_L['Close All'], io.close_all_buffers},
SEPARATOR,
{_L['Loa_d Session...'], textadept.session.load},
{_L['Sav_e Session...'], textadept.session.save},
@@ -366,7 +366,7 @@ if not CURSES then
events.connect(events.LEXER_LOADED, set_language_contextmenu)
events.connect(events.BUFFER_AFTER_SWITCH, set_language_contextmenu)
events.connect(events.VIEW_AFTER_SWITCH, set_language_contextmenu)
- events.connect(events.BUFFER_NEW, set_lang_contextmenu)
+ events.connect(events.BUFFER_NEW, set_language_contextmenu)
end
return M
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index 917cb7a5..67850924 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -50,7 +50,7 @@ local preferred_view
local function command(cmd_table, compiling)
if not buffer.filename then return end
buffer:annotation_clear_all()
- buffer:save()
+ io.save_file()
local command = cmd_table[buffer.filename:match('[^.]+$')]
if not command then return end
if type(command) == 'function' then command = command() end
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua
index 8ae408fd..b44a777c 100644
--- a/modules/textadept/session.lua
+++ b/modules/textadept/session.lua
@@ -50,7 +50,7 @@ function M.load(filename)
if filename == '' then return end
local not_found = {}
local f = io.open(filename, 'rb')
- if not f then io.close_all() return false end
+ if not f then io.close_all_buffers() return false end
local current_view, splits = 1, {[0] = {}}
local lfs_attributes = lfs.attributes
for line in f:lines() do