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

From: Russell Dickenson <russelldickenson.att.gmail.com>
Date: Tue, 7 May 2013 07:32:39 +1000

Mitchell,

Yay! \O/ I made the necessary changes to my XML-specific 'init'lua', using
the second form, and the XML-specific snippet now works as expected.

I expect that what you explained in your previous email would normally be
covered in "Lua 101", so thanks for taking the time to explain the basics.
I feel that by enabling this very simple option I have learned a little
about how Textadept works. Now to take on the world!!

Before advancing too far I need to have one point clarified: the use of
"post_init.lua". When I was first trying to enable the XML-specific
snippet, I thought that I should be using "post_init.lua" but that wasn't
working so instead I switched to "init.lua". Can you please clarify if I
have the right configuration according to my goals? In future I intend
enabling buffer-specific properties, such as word-wrap etc, so I want to be
sure I am defining these in the right place.

On 6 May 2013 22:29, Mitchell <m.att.foicica.com> wrote:

> Russell,
>
> On Mon, 6 May 2013, Russell Dickenson wrote:
>
> Mitchell,
>>
>> I have modified my ~/.textadept/modules/xml/init.**lua file, trying both
>> of
>> the forms you suggested earlier in this email thread.
>>
>> Regardless of which I choose, I get the following error message when I
>> open
>> an XML file:
>>
>> /usr/lib64/textadept/modules/**textadept/mime_types.lua:95: attempt to
>> index
>> field '?' (a boolean value)
>>
>> In this case I have packaged Texadept 6.6 beta for Fedora 18 and installed
>> the resulting package. I have tested and confirmed that I get the same
>> error message even if using the pre-built binaries.
>>
>
> Sorry for overlooking this. If you are trying to create an xml module
> (which it seems you are by creating init.lua), then that file must return a
> Lua table (a characteristic of a module). So at the end of your init.lua,
> add "return {}" since you do not have any special features. However, if you
> plan on adding them (such as XML-specific buffer properties or any
> XML-specific functions), then you would wrap everything in a "local M = {}
> ... return M" construct. For example:
>
>
> snippets.xml = {
> ['hi'] = 'hello there'
> }
>
> return {}
>
> or
>
> local M = {}
>
> function M.set_buffer_properties()
> -- buffer-specific properties like indentation here
> end
>
>
> snippets.xml = {
> ['hi'] = 'hello there'
> }
>
> return M
>
>
> 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.
>
>

-- 
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 Mon 06 May 2013 - 17:32:39 EDT

This archive was generated by hypermail 2.2.0 : Tue 07 May 2013 - 06:34:31 EDT