Re: [code] [textadept] Am I executing a snippet ?

From: Mitchell <m.att.foicica.com>
Date: Tue, 28 May 2013 10:00:50 -0400 (Eastern Daylight Time)

Hi Richard,

On Mon, 27 May 2013, Richard Philips wrote:

> Hi,
>
> is there a non-destructive way to infer in my Lua code if it is
> executing
> in the context of a snippet ?
>
>
> The _M.textadept.snippets._previous function has that property but is
> 'destructive'.
> It is based on a local table `snippet_stack`.

It's a hack, but you can use

     if buffer:indicator_end(10, 0) > 0 then
       -- snippet is active
     end

I used a `gui.print()` statement in the snippets module to temporarily
determine the indicator number for snippet end points.

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 28 May 2013 - 10:00:50 EDT

This archive was generated by hypermail 2.2.0 : Wed 29 May 2013 - 06:54:19 EDT