From e101a0190a282bf30ed6496d627e362774c1864a Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Wed, 15 May 2013 10:31:16 -0400 Subject: Set language-specific buffer properties through an event instead of a function. --- doc/08_Preferences.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'doc/08_Preferences.md') 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 -- cgit v1.2.3