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

From: Mitchell <m.att.foicica.com>
Date: Mon, 6 May 2013 08:29:35 -0400 (Eastern Daylight Time)

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.
Received on Mon 06 May 2013 - 08:29:35 EDT

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