Has anyone written a "zap gremlins" command for TextMate? BBEdit has this, but an equivalent doesn't seem to be available in TextMate. Thanks,
Trevor
On 3/20/06, Trevor Harmon trevor@vocaro.com wrote:
Has anyone written a "zap gremlins" command for TextMate? BBEdit has this, but an equivalent doesn't seem to be available in TextMate.
Please forgive me if I react in total and absolute confusion but.. what????
All I know is.. don't feed them after midnight.. don't get them wet.. and the fact that blenders, microwaves and sunlight seem to work well.
-Pawel
On Mar 20, 2006, at 6:26 PM, Pawel Szymczykowski wrote:
On 3/20/06, Trevor Harmon trevor@vocaro.com wrote:
Has anyone written a "zap gremlins" command for TextMate? BBEdit has this, but an equivalent doesn't seem to be available in TextMate.
Please forgive me if I react in total and absolute confusion but.. what????
From the BBEdit User Manual:
This command displays a sheet which allows you to remove or replace various non- printing characters, often known as “gremlins”. Use this command when you have a file that may contain extraneous control characters, or any non- ASCII characters, which you wish to identify or remove.
It allows you to selectively remove non-ASCII characters, control characters, and/or null (ASCII 0) characters, and either delete them, replace them with their character code, or replace them with a specified character (defaulting to the standard bullet (•) character).
I can't answer Trevor's question, but hopefully that clears up what he's asking for those of you who haven't used BBEdit before.
Thanks, Jeff
On Mar 20, 2006, at 5:07 PM, Domenico Carbotta wrote:
Text > Remove Unprintable Characters in Document
the name "zap gremlins" is way cooler ^_^
Not to mention much shorter and therefore easier to spot. I think that's part of the reason why I overlooked it. The command menu's item names are so verbose that I tend to get overwhelmed. I think they should be shorter. For instance, is having "in Document" as part of the name really necessary?
Another example: "Convert Spaces to Tabs (Estimating Indent)" That's quite a mouthful. Why not just "Entab"?
Trevor
On 21/3/2006, at 2:57, Trevor Harmon wrote:
[...] I think they should be shorter. For instance, is having "in Document" as part of the name really necessary?
It is, yes. Because if you have a selection, it is “Remove Unprintable Characters in Selection”.
Another example: "Convert Spaces to Tabs (Estimating Indent)" That's quite a mouthful. Why not just "Entab"?
Because personally I had no idea what Entab or Zap Gremlens meant, before BBEdit users told me (and I would think Entab would be to add one tab, e.g. increase indent).
The goal with TextMate’s menu labeling is not verbosity, but it is non-ambiguity. There is a lot of commands, so it is a priority that the names spell out what the commands do. And if you try to rename all the commands to shorter names, I think you will find this may work for only very few of them, causing asymmetry in the naming system.
On 20 Mar 2006, at 18:40, Allan Odgaard wrote:
if you try to rename all the commands to shorter names, I think you will find this may work for only very few of them, causing asymmetry in the naming system.
Oh, I don't know about that. Given "Zap Gremlins" and "Entab" as examples, you could go on for quite a while in that vein.
I suggest: Poke Edges Chop Super Chop Transmogrify Halo Effect Decaffeinate
:-)
On 21/3/2006, at 4:19, Dan Ridley wrote:
On 20 Mar 2006, at 18:40, Allan Odgaard wrote:
if you try to rename all the commands to shorter names, I think you will find this may work for only very few of them, causing asymmetry in the naming system.
Oh, I don't know about that. Given "Zap Gremlins" and "Entab" as examples, you could go on for quite a while in that vein.
I suggest: Poke Edges Chop Super Chop Transmogrify Halo Effect Decaffeinate
ROTFL! :)
Most excellent!
One could try for names that are most un-obvious to begin with, but which could be justified through careful explanation!
Laminate Adhere Extrude Compress Compound Vertices Join Adjunctives Blend Germinate De-tangle EN-tangle [of course] Exhaust Consume Resonate . . .
eo
On Mar 20, 2006, at 7:19 PM, Dan Ridley wrote:
On 20 Mar 2006, at 18:40, Allan Odgaard wrote:
if you try to rename all the commands to shorter names, I think you will find this may work for only very few of them, causing asymmetry in the naming system.
Oh, I don't know about that. Given "Zap Gremlins" and "Entab" as examples, you could go on for quite a while in that vein.
I suggest: Poke Edges Chop Super Chop Transmogrify Halo Effect Decaffeinate
:-)
On Mar 20, 2006, at 4:51 PM, Chris Thomas wrote:
Has anyone written a "zap gremlins" command for TextMate? BBEdit has this, but an equivalent doesn't seem to be available in TextMate. Thanks,
Text > Remove Unprintable Characters in Document
Ah, thanks for the pointer. I completely missed that.
Unfortunately, it doesn't work. That is, it doesn't work like BBEdit's Zap Gremlins. The problem is that TextMate's version is too conservative. With Zap Gremlins, I have the option of removing any non-ASCII characters, while TextMate only removes "unprintable" characters. A case in point:
http://vocaro.com/trevor/files/t.cc
Compiling the above in g++ gives: t.cc:8: error: stray '\194' in program t.cc:8: error: stray '\160' in program
The problem characters are 0xC2 and 0xA0, which apparently are "printable" (according to TextMate) but are not compilable.
Perhaps we simply need an extra command: "Remove non-ASCII Characters in Document".
Trevor
Does the "Remove Unprintable Characters in Document" command take into consideration the character encoding of the file? In a brief experiment with the supplied file I found that in some encodings the byte sequences was printed, but in others (UTF-8) the byte sequence was not printed.
-Corey
On 3/20/06, Trevor Harmon trevor@vocaro.com wrote:
On Mar 20, 2006, at 4:51 PM, Chris Thomas wrote:
Has anyone written a "zap gremlins" command for TextMate? BBEdit has this, but an equivalent doesn't seem to be available in TextMate. Thanks,
Text > Remove Unprintable Characters in Document
Ah, thanks for the pointer. I completely missed that.
Unfortunately, it doesn't work. That is, it doesn't work like BBEdit's Zap Gremlins. The problem is that TextMate's version is too conservative. With Zap Gremlins, I have the option of removing any non-ASCII characters, while TextMate only removes "unprintable" characters. A case in point:
http://vocaro.com/trevor/files/t.cc
Compiling the above in g++ gives: t.cc:8: error: stray '\194' in program t.cc:8: error: stray '\160' in program
The problem characters are 0xC2 and 0xA0, which apparently are "printable" (according to TextMate) but are not compilable.
Perhaps we simply need an extra command: "Remove non-ASCII Characters in Document".
Trevor
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
-- -Corey O'Connor
On 21/3/2006, at 3:02, Corey O'Connor wrote:
Does the "Remove Unprintable Characters in Document" command take into consideration the character encoding of the file?
Commands always see the document as UTF-8 and work with that. The encoding of the file (on disk) has no influence on that, as TextMate convert from/to the encoding used on disk when loading and saving the file.
In a brief experiment with the supplied file I found that in some encodings the byte sequences was printed, but in others (UTF-8) the byte sequence was not printed.
A file has one encoding -- if you load it with the wrong encoding, the result is effectively a broken file.
On 21/3/2006, at 2:51, Trevor Harmon wrote:
[...] Perhaps we simply need an extra command: "Remove non-ASCII Characters in Document".
You might, and you can just create it yourself.
Go to the Bundle Editor (Window menu). Locate the current command in the Text bundle. Duplicate it and change it to:
perl -pe 's/[^\t\n\x20-\x7F]//g'
Then you have a command which remove all but ASCII (though it also remove the control characters in ASCII).
If you only need it once, you can instead just fire the above command using opt-cmd R (Filter Through Command…)
There is btw a Transliterate Word / Selection to ASCII which may also work (it finds ASCII characters for the non-ASCII stuff in current word / selection, for example making your non-breakable space into a regular space etc.).
On Mar 20, 2006, at 6:34 PM, Allan Odgaard wrote:
On 21/3/2006, at 2:51, Trevor Harmon wrote:
[...] Perhaps we simply need an extra command: "Remove non-ASCII Characters in Document".
You might, and you can just create it yourself.
I understand, but what I meant by that was, "I think this should be built-in to TextMate."
Go to the Bundle Editor (Window menu). Locate the current command in the Text bundle. Duplicate it and change it to:
perl -pe 's/[^\t\n\x20-\x7F]//g'
Thanks for the tip! I didn't expect it to be that simple, but that's because I'm always forgetting the power of regex...
Trevor