Re: buffer list

From: Scott Weisman <sweis....at.gmail.com>
Date: Sun, 12 Dec 2010 01:15:33 -0800 (PST)

Mitchell,

Thanks for the help on this. I'm trying to figure this particular
problem out but I am getting stuck. Do you mind if I ask for some
help?

This is what I've got so far:

keys.ck = { function ()
    local buffer = buffer
    local events = events
    local items = {}
    for _, buffer in ipairs(_BUFFERS) do
        local filename = buffer.filename or buffer._type or 'UNTITLED'
        local dirty = buffer.dirty and '* ' or ''
        table.insert(items, 1, dirty .. filename)
-- items[#items + 1] = dirty .. filename
        buffer:user_list_show(1, table.concat(items, '|'))
    end
    file_select = events.connect('user_list_selection', function(type,
text)
        events.disconnect('user_list_selection', file_select)
    end, 1)
end }

I hacked this together from code I saw in the core TA files, but was
having trouble understanding some of it.

Also, the user_list_show function takes a parameter, type, which I
have no idea what it means.

Right now, I just want to display the list of files in internal TA
order (I'll work on sorting them later), with the complete file paths,
and prefixed by "* " when the file is "dirty." Upon selection,
switching to the selected buffer, or just displaying the selected
index, would be fine. And removing the event hook, since I assume this
is proper behavior.

I hope I am not being too bothersome. TA is actually the first editor
I've used that I really want to customize to my liking. I always felt
that something like Vim or or Emacs were just too much for me, and
Scite, which I did customize a bit, was too limited.

Scott

On Dec 10, 3:59 pm, mitchell <c....at.caladbolg.net> wrote:
> Scott,
>
> > Instead of using a dialog, what about some sort popup, like used for
> > name completion? Is it possible to use something like that to instead
> > popup a buffer selection list?
>
> Yes. Use buffer:user_list_show() and handle the selection with
> events.connect('user_list_selection', ...)
Received on Sun 12 Dec 2010 - 04:15:33 EST

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