Re: [code] I need help adding a language-specific snippet

From: Mitchell <m.att.foicica.com>
Date: Tue, 7 May 2013 16:37:29 -0400 (Eastern Daylight Time)

Russell,

On Wed, 8 May 2013, Russell Dickenson wrote:

> Mitchell,
>
> Ah, thankyou for explaining the role of "init.lua". I should have pointed
> out at the start that I had started from a clean, fresh installation of
> Textadept and so had no customisation alrready in place. I *do* intend
> making use of an XML tag auto-closure script/module but I am taking baby
> steps at the moment. The aim of enabling XML-specific has been to
> understand a little better how Textadept works, rather than my previous
> "cut-and-paste" approach.
>
> Can you give me a sample use case for a "post_init.lua" file? In the wiki
> an example is given of language-specific snippets, the task I took as my
> "Textadept 101" test. I can't understand why anyone would create an
> init.lua and post_init.lua file.

Consider this use case:

Textadept comes with a Lua language-specific module with predefined
snippets. However, you want to add your own snippets to those predefined
ones. Moreover, you want to take advantage of the existing Lua module's
tools like Adeptsense and auto-"end" completion. You could copy the Lua
module into your *~/.textadept/modules/* directory and add your custom
snippets. However, each time Textadept is released, you will have to keep
track of any module changes and update your copy -- a tedious and
error-prone process. Enter *post_init.lua*. If you create a
*~/.textadept/modules/lua/post_init.lua* file with your custom snippet,
you can have your cake and eat it too: the default Lua language-specific
module will be loaded as well as your snippets from *post_init.lua* :)

Note: under normal circumstances, nobody should be creating an *init.lua*
and a *post_init.lua*. The latter is to take advantage of existing
functionality. The former is for creating non-existant functionality.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Tue 07 May 2013 - 16:37:29 EDT

This archive was generated by hypermail 2.2.0 : Wed 08 May 2013 - 06:53:24 EDT