hello all, i am working with files that contain mixed ascii and binary data. if i open the file in textMate and then resave it (without editing it's contents), parts of the binary data are incorrectly interpreted as line-breaks and the data becomes corrupted.
is there a way to create an ascii/binary hybrid file-type that textMate understands so that i can edit the ascii without ruining the binary data?
sorry if this is an obvious question, i'm still a textMate newb.
thanks in advance, chad
On 7. Nov 2006, at 20:57, Chad Dombrova wrote:
[...] is there a way to create an ascii/binary hybrid file-type that textMate understands so that i can edit the ascii without ruining the binary data?
No, TextMate is not intended to be able to edit binary data without potential mangling.
On 8 nov. 06, at 03:08, Allan Odgaard wrote:
On 7. Nov 2006, at 20:57, Chad Dombrova wrote:
[...] is there a way to create an ascii/binary hybrid file-type that textMate understands so that i can edit the ascii without ruining the binary data?
No, TextMate is not intended to be able to edit binary data without potential mangling.
I've unfortunately been bitten by this yesterday, but good old vim worked perfectly. (I'm not going back though, TextMate is too nice ;-) ).
Alan
-- Alan Schmitt http://alan.petitepomme.net/
The hacker: someone who figured things out and made something cool happen. .O. ..O OOO
[...] is there a way to create an ascii/binary hybrid file-type that textMate understands so that i can edit the ascii without ruining the binary data?
No, TextMate is not intended to be able to edit binary data without potential mangling.
as a convention, every 8 bytes of binary data is placed on a new line between a grave accent character ( ` ), which makes the binary data more predictable.
a small chunk of binary might look like this inside a text editor (hopefully that comes through ok in your mail program):
`?Ø≠ÛA9¿` `?πbtArÀ` `?π0{Aj°`
would it be possible to write a module that would allow textMate to ignore data between a given delimiter ( in this case ` ), treating it as binary instead of ascii?
-chad
On Nov 13, 2006, at 2:32 PM, Chad Dombrova wrote:
would it be possible to write a module that would allow textMate to ignore data between a given delimiter ( in this case ` ), treating it as binary instead of ascii?
You could write a module with two commands:
- Open Binary - Save Binary
You'd open a blank document, select that module, choose Open Binary. It would prompt you for a file name and run the file through your pre- filter of choice (perl, ruby, python, ...) escaping the binary bytes into a standard format such as \xNN. The filtered output would replace the currently open and blank document.
Edit, edit edit.
Then select Save Binary which would reverse the operation.
j.
You could write a module with two commands:
- Open Binary
- Save Binary
How about a generic filtering system?
TextMate picks a filter when opening a file, initially based upon the extension etc. but with the option to override via a dropdown, then uses the filter module to convert the file contents into characters. And remembers to reverse the operation upon saving.
Possible filters:
- Custom ones that, as you say, base64 or whatnot the binary sections for preservation, while allowing the text to be edited. - gzip - Open a GDBM or other such file, see it as key = value pairs in Win.ini style, save it back to GDBM - Open a PNG file, see it as key = value pairs for all the editable text chunks (comments, copyright, etc), with a big binary block at the bottom containing the image data and all the non-text chunks
The next development might be to have 'attachments' attached to the TextMate buffer, so the uneditable binary sections can be elided into such attachments and a 'reference' left in the text, to keep them out of the way.
ABS
-- Alaric Snell-Pym Work: http://www.snell-systems.co.uk/ Play: http://www.snell-pym.org.uk/alaric/ Blog: http://www.snell-pym.org.uk/?author=4
On 15. Nov 2006, at 12:43, Alaric Snell-Pym wrote:
You could write a module with two commands:
- Open Binary
- Save Binary
How about a generic filtering system? [...]
There is something along those lines on the drawing board, more though for compiled AppleScripts, binary property lists, and similar, which is more logical to edit, than binary data as base64 or what not ;)
On 15 Nov 2006, at 13:59, Allan Odgaard wrote:
There is something along those lines on the drawing board, more though for compiled AppleScripts, binary property lists, and similar, which is more logical to edit, than binary data as base64 or what not ;)
Cool. A hex edit mode would be nice too please :)
On 15 Nov 2006, at 15:38, Andy Armstrong wrote:
On 15 Nov 2006, at 13:59, Allan Odgaard wrote:
There is something along those lines on the drawing board, more though for compiled AppleScripts, binary property lists, and similar, which is more logical to edit, than binary data as base64 or what not ;)
Cool. A hex edit mode would be nice too please :)
Try Hex Fiend- it's pretty darn good. http://ridiculousfish.com/hexfiend/
-- Kind regards James Milne
On 15 Nov 2006, at 15:44, James Milne wrote:
Try Hex Fiend- it's pretty darn good. http://ridiculousfish.com/hexfiend/
Cool, thanks :)
On Nov 15, 2006, at 9:38 AM, Andy Armstrong wrote:
On 15 Nov 2006, at 13:59, Allan Odgaard wrote:
There is something along those lines on the drawing board, more though for compiled AppleScripts, binary property lists, and similar, which is more logical to edit, than binary data as base64 or what not ;)
Cool. A hex edit mode would be nice too please :)
xxd is your friend. It reads and writes.
James Edward Gray II
On 15 Nov 2006, at 15:48, James Edward Gray II wrote:
Cool. A hex edit mode would be nice too please :)
xxd is your friend. It reads and writes.
That's the tool I was thinking could be invoked by Allan's new filter system - but I couldn't remember the name - thanks :)