diff options
author | 2013-05-15 10:31:16 -0400 | |
---|---|---|
committer | 2013-05-15 10:31:16 -0400 | |
commit | e101a0190a282bf30ed6496d627e362774c1864a (patch) | |
tree | 4816027b197d2fd13bb9bb10a9eebf8504c88441 /doc/08_Preferences.md | |
parent | 64ec422c0a6da08710578ae92282cfb4bcb50f5f (diff) | |
download | textadept-e101a0190a282bf30ed6496d627e362774c1864a.tar.gz textadept-e101a0190a282bf30ed6496d627e362774c1864a.zip |
Set language-specific buffer properties through an event instead of a function.
Diffstat (limited to 'doc/08_Preferences.md')
-rw-r--r-- | doc/08_Preferences.md | 10 |
1 files changed, 5 insertions, 5 deletions
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 |