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

From: Mitchell <>
Date: Mon, 8 Apr 2013 10:16:37 -0400 (Eastern Daylight Time)

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. 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.

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.


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 - 10:16:37 EDT

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