aboutsummaryrefslogtreecommitdiff
path: root/core/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'core/init.lua')
-rw-r--r--core/init.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/init.lua b/core/init.lua
new file mode 100644
index 00000000..297495e6
--- /dev/null
+++ b/core/init.lua
@@ -0,0 +1,21 @@
+-- Copyright 2007 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+
+---
+-- Checks if the buffer being indexed is the currently focused buffer.
+-- This is necessary because any buffer actions are performed in the focused
+-- views' buffer, which may not be the buffer being indexed. Throws an error
+-- if the check fails.
+-- @param buffer The buffer in question.
+function textadept.check_focused_buffer(buffer)
+ if type(buffer) ~= 'table' or not buffer.doc_pointer then
+ error('Buffer argument expected.', 2)
+ elseif textadept.focused_doc_pointer ~= buffer.doc_pointer then
+ error('The indexed buffer is not the focused one.', 2)
+ end
+end
+
+package.path = package.path..';'.._HOME..'/core/?.lua'
+
+require 'iface'
+require 'handlers'
+require 'file_io'