Re: Ctrl-Tab to go back to the most-recently-used buffer

From: Andy Lima <andysky....at.gmail.com>
Date: Thu, 14 May 2009 05:28:45 +0100

Works great! :) Thank you very much, Mitchell.

On Thu, May 14, 2009 at 5:16 AM, mitchell <mforal.n....at.gmail.com> wrote:

>
> Andy,
>
> > Problem is: _G.previous_buffer_idx always has the current buffer index,
> not
> > the previous one's.
>
> 'buffer_switch' is activated after the switch occurs, so 'buffer'
> always referrers to the current buffer naturally. One solution would
> be to use an intermediate variable.
>
> textadept.events.add_handler('buffer_switch',
> function()
> for idx, buf in ipairs(textadept.buffers) do
> if buf == buffer then
> _G.previous_buffer_idx = _G.current_buffer_idx or idx
> _G.current_buffer_idx = idx
> end
> end
> end)
>
> There may be more elegant solutions, but this is the midnight one ;)
>
> -Mitchell;
> >
>
Received on Thu 14 May 2009 - 00:28:45 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:37:54 EST