On 21 Aug 2016, at 13:29, Stefan Daschek wrote:

I’d be happy to give this a try. Could you give me some hints on what code you think could / should be removed?

Unused code, whatever that is :) And code that is only used by a single bundle can be moved to that bundle.

There might also be use of some code that could be replaced with stdlib functionality, for example a lot of bundles use e_sh from escape.rb when they should probably instead use the Shellwords library.

To check if code isn’t used in other bundles before removing it: Would it be sufficient to search across all bundles that are listed in TextMate’s bundle index?

Yes, I think if none of “our” bundles use the code, there should be no need to support it anymore.

(Btw, where can I find the source of this index?)

This code will echo the “git clone” instructions required to clone all bundles in the index (pipe it to sh when you ensure it works):

pp ~/Library/Application\ Support/TextMate/Managed/Cache/org.textmate.updates.default \
|grep -o 'https://api.textmate.org/.*\.tbz' \
|while read url; do curl -s $url \
|tar -jxO info.plist|pp \
|sed -n 's/.*url = "\(.*git.*\)";/\1/p' \
|( read repos; echo git clone $repos ); done

Here pp is the property list tool found in the Property List bundle (under Support/bin).

It basically just reads a property list from stdin and outputs the old-style format to stdout so that we can easily grep it. A bit like pl but that tool lacks support for binary property lists.

And you will btw need to clone all the repositories because the deployed versions use binary property lists, so searching these would not find everything.