Re: I'd like to alter AutoPair's behaviour for some files

From: phayz <russelldicken....at.gmail.com>
Date: Tue, 7 Dec 2010 19:51:10 -0800 (PST)

On Dec 8, 6:29 am, mitchell <c....at.caladbolg.net> wrote:
> Robert,
>
> > events.connect('buffer_after_switch',
> >  function()
> >    if buffer._lexer == 'lua' then
> >      _m.textadept.editing.AUTOPAIR = false
> >    else
> >      _m.textadept.editing.AUTOPAIR = true
> >    end
> >  end
> >  )
>
> > Mitchell,
> > I tried this with buffer:get_lexer(). This caused Textadept to hang
> > when I opened a new file. Is there something that needs to be checked
> > additionally in this "private_lexer_call", whatever that means?
>
> This is a bug and will be fixed in hg later today. It has to do with the
> "buffer_after_switch" event being emitted before "buffer_new". The
> mime-types module uses "buffer_new" to add the get_lexer function. Since
> "buffer_after_switch" references it before it exists when a new buffer is
> opened, an infinite recursion of errors happens.
>
> mitchell

Robert and Mitchell,

Thanks for your help. I will try this approach when Textadept is next
released.
Received on Tue 07 Dec 2010 - 22:51:10 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:55:19 EST