Re: Objective-C Beautifier?
Re: Objective-C Beautifier?
- Subject: Re: Objective-C Beautifier?
- From: Karl Moskowski <email@hidden>
- Date: Wed, 12 Nov 2008 15:58:36 -0500
Well, in case anyone's interested, I mucked with uncrustify a bit, and
found a somewhat pleasing configuration.
1. Download the source from <http://uncrustify.sourceforge.net/> and
do the usual ./configure & make, then move ./src/uncrustify to
somewhere on your path.
2. Copy your preferred cfg file from ./etc/ to ~/uncrustify.cfg and
add the following ObjC-specific items with your preferred settings (I
used linux.cfg):
sp_before_oc_colon = remove
sp_after_oc_scope = force
sp_after_oc_type = force
3. Select Edit User Scripts... from Xcode's script menu and add the
following script, calling it uncrustify:
#!/bin/sh
echo -n "%%%{PBXSelection}%%%"
/path/to/uncrustify -q -c ~/uncrustify.cfg -l oc+
echo -n "%%%{PBXSelection}%%%"
with these options:
Input: Entire Document
Directory: Selection
Output: Replace Document Contents
Errors: Merge with Script Output
When you're editing a file in Xcode, select Scripts > uncrustify and
see the results.
So far, I've noticed one glitch I haven't been able to suppress. I use
a macro to register an NSNotifcation observer method
#define LocalObserver(n, s) [[NSNotificationCenter defaultCenter]
addObserver:self selector:@selector(s) name:n object:nil]
and call it using
LocalObserver(@"myNotification", handleNotification:);
uncrustify puts a space before the colon in the selector
LocalObserver(@"myNotification", handleNotification :);
----
Karl Moskowski <email@hidden>
Voodoo Ergonomics Inc. <http://voodooergonomics.com/>
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden