aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/._M.luadoc16
-rw-r--r--doc/08_Preferences.md10
-rw-r--r--modules/cpp/init.lua7
-rw-r--r--modules/lua/init.lua7
-rw-r--r--modules/textadept/mime_types.lua1
5 files changed, 13 insertions, 28 deletions
diff --git a/core/._M.luadoc b/core/._M.luadoc
index f2e02abe..7b459468 100644
--- a/core/._M.luadoc
+++ b/core/._M.luadoc
@@ -67,17 +67,17 @@
-- #### Buffer Properties
--
-- By default, Textadept uses 2 spaces as indentation. If your language has
--- different indentation guidelines, change them in a `set_buffer_properties()`
--- function. Using tabs of width 8 would look like
+-- different indentation guidelines, change them from an
+-- `events.LANGUAGE_MODULE_LOADED` event handler. Using tabs of width 8 would
+-- look like
--
--- function M.set_buffer_properties()
--- buffer.tab_width = 8
--- buffer.use_tabs = true
+-- events.connect(events.LANGUAGE_MODULE_LOADED, function(lang)
+-- if lang == 'lua' then
+-- buffer.tab_width = 8
+-- buffer.use_tabs = true
+-- end
-- end
--
--- This function is called automatically to set the properties for the
--- language's source files.
---
-- #### Adeptsense
--
-- The `Ctrl+Space` and `Ctrl+H` (`⌥⎋` and `^H` on Mac OSX | `^Space` and `M-H`
diff --git a/doc/08_Preferences.md b/doc/08_Preferences.md
index fa41f4c6..a3cbe3d8 100644
--- a/doc/08_Preferences.md
+++ b/doc/08_Preferences.md
@@ -70,12 +70,12 @@ these kinds of copies of language-specific modules, you will likely want to
update them with each new Textadept release. Instead of potentially wasting time
merging your changes, you can run custom code independent of a module in the
module's *post_init.lua* file. For example, instead of copying the `lua` module
-and changing its `set_buffer_properties()` function to use tabs, you can do this
-from *~/.textadept/modules/lua/post_init.lua*:
+and creating an `events.LANGUAGE_MODULE_LOADED` event handler to use tabs, you
+can do this from *~/.textadept/modules/lua/post_init.lua*:
- function _M.lua.set_buffer_properties()
- buffer.use_tabs = true
- end
+ events.connect(events.LANGUAGE_MODULE_LOADED, function(lang)
+ if lang == 'lua' then buffer.use_tabs = true end
+ end)
Similarly, you can use *post_init.lua* to change the module's
[compile and run][] commands, load more [Adeptsense tags][], and add additional
diff --git a/modules/cpp/init.lua b/modules/cpp/init.lua
index 0adf61cb..0e328838 100644
--- a/modules/cpp/init.lua
+++ b/modules/cpp/init.lua
@@ -38,13 +38,6 @@ _M.textadept.run.error_detail.c = {
filename = 1, line = 2, message = 3
}
----
--- Sets default buffer properties for C/C++ files.
--- @name set_buffer_properties
-function M.set_buffer_properties()
-
-end
-
-- Adeptsense.
M.sense = _M.textadept.adeptsense.new('cpp')
diff --git a/modules/lua/init.lua b/modules/lua/init.lua
index de9c7450..8bf381a9 100644
--- a/modules/lua/init.lua
+++ b/modules/lua/init.lua
@@ -35,13 +35,6 @@ _M.textadept.run.error_detail.lua = {
filename = 1, line = 2, message = 3
}
----
--- Sets default buffer properties for Lua files.
--- @name set_buffer_properties
-function M.set_buffer_properties()
-
-end
-
-- Adeptsense.
M.sense = _M.textadept.adeptsense.new('lua')
diff --git a/modules/textadept/mime_types.lua b/modules/textadept/mime_types.lua
index 90924fb3..06653223 100644
--- a/modules/textadept/mime_types.lua
+++ b/modules/textadept/mime_types.lua
@@ -92,7 +92,6 @@ local function set_lexer(buffer, lang)
_M[lang] = require(lang)
local post_init = lang..'.post_init'
if package.searchpath(post_init, package.path) then require(post_init) end
- if _M[lang].set_buffer_properties then _M[lang].set_buffer_properties() end
events.emit(events.LANGUAGE_MODULE_LOADED, lang)
end
local last_line = buffer.first_visible_line + buffer.lines_on_screen