Re: [code] Possible callback used to manipulate items in gui.filteredlist() and io.snapopen()

From: Ryan Pusztai <>
Date: Mon, 8 Apr 2013 11:11:18 -0400

Hi Mitchell,

On Mon, Apr 8, 2013 at 10:16 AM, Mitchell <> wrote:

> Hi Ryan,
> On Mon, 1 Apr 2013, Ryan Pusztai wrote:
> Hi Mitchell,
>> I am wondering how I can make my paths shorter by using the unix style '~'
>> in replacement to the full path to files that appear in the snapopen and
>> filteredlist dialogs. This idea is not new. I got the idea from the
>> "common" library [1] and love it, so I used to copy the snapopen() module
>> functioins into my own modified display_filename.lua file. This leads to
>> the functions getting out of date and may need updates for every release.
>> Is there a better way? Maybe...
>> I was wondering if you had any thoughts of ways to make this happen.
>> Possibly making the functions gui.filteredlist() and io.snapopen() take a
>> callback. The callback function would take the displayed text and returns
>> a
>> manipulated string. This would allow users to do simple and complex things
>> to the items displayed.
>> Do you think this is possible? If so can those features be added to TA?
> Sorry for the delay. After thinking about this, it's difficult because
> `io.snapopen()` passes its output directly to `io.open_files()`, so any
> transforms shown in the snapopen list will have to be "un-transformed".
> This feels clunky to me.

Ok. Thanks for taking time to think about it.

> The good news is that you can just re-define `io.snapopen` to your liking
> from your init.lua rather than having to re-copy the old snapopen module. I
> know this may be non-ideal for you, but I'm not sure of a better way to do
> it.

Can you give a quick example. I am not quite seeing how to re-define this
and would like to. I am on a domain and it makes my path at least 2
directories deeper. My "home" paths get pretty long.
In your example just make up the function to call that would shorten the
path name. I will come up with the way to implement that. I am just unclear
about what it would look like to re-define io.snapopen() and any help would
be greatly appreciated.

For `gui.filteredlist()`, it just shows whatever input you give it, so I
> cannot justify putting in a callback function as you can just transform the
> text before passing it to the function. The outside functions calling this
> function would have to be tweaked, like redefining `io.snapopen` as
> mentioned above.

Agreed this one was not as important and I have an example in the "common"
library to look at.

Thanks again.

You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Mon 08 Apr 2013 - 11:11:18 EDT

This archive was generated by hypermail 2.2.0 : Tue 09 Apr 2013 - 06:49:32 EDT