[TxMt] diff vs opendiff

Dave Winzler dave at nkvt.com
Sat Nov 11 15:05:43 UTC 2006


Jay Soffian wrote:

> This reminds me. I was surprised to find that the Diff bundle does  
> not support using Xcode's opendiff. Is this just an oversight  
> (either in the bundle or by me), or does no one care for opendiff?
>
> In general it seems like it would be useful to be able to  
> generically configure all the bundles to use opendiff where it  
> makes sense to use it as a replacement for /usr/bin/diff. This  
> would be settable via something like TM_USEOPENDIFF or some such. I  
> know there's certainly times when I'd prefer to have the Subversion  
> bundle diff for me using opendiff.

Yup, that's pretty much what I'm looking for too.

I ended up hacking together some of the commands from the Diff bundle  
to get an opendiff equivalent of "Diff Document With Arbitrary  
File...", but it only works with the saved version of the current  
document which limits its usefulness (can't compare unsaved changes,  
can't compare new unsaved documents for instance).

Still, in case anybody else finds it useful:
(Save: Nothing)
(Input: Entire Document)
(Output: Discard)

require_cmd opendiff "Opendiff comes with Apple's developer tools."

# set utf-8 as the default encoding (used by opendiff)
export __CF_USER_TEXT_ENCODING=$UID:0x8000100:0x8000100

path=$(osascript<<END
tell application "TextMate"
	set theFile to choose file
	set the result to POSIX path of theFile
end tell
END)

opendiff "$path" "$TM_FILEPATH"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20061111/a007e711/attachment.html>


More information about the textmate mailing list