On 2011 Sep 15, at 12:16, Scott Ribe wrote:

> Well, if you used __LINE__ in your NSLog statements instead of reading the 
> cursor position, then perhaps you wouldn't have to read anything in your 
> script.

Yes, except the really nice thing about %%%{PBXSelectionStart}%%% is that it 
gives me a unique identifier with 99.99% probability.  For example, say that I 
wanted to hone in on where an exception was being raised.  I'd pepper the 
suspect code, even if spread across different files, with NSLogs including 
%%%{PBXSelectionStart}%%%.  Each one takes only one keystroke.  Build and run.  
Console will print out something like this:

145656
145856
12674
12874
13476
*** Exception Blah Blah.
13487

Bang.  Just do a ⇧⌘F, copy that 13476 to the search field, and in seconds the 
problem is staring me in the face.

__FILE__ would be useful if it didn't print out the whole damned full path.

> Then for removing them, perhaps you could use regex search & replace based on 
> your signature comment.

My script deletes the entirety of any line that has the signature comment.  
Since C allows more than one statement on a line, I can also put in other 
temporary statements such as 

   thatString = @"Try this string!" ; NSLog(…) ;

and my remove-debugging script blows away all such lines with one keystroke.

My signature comment is: /*DB?Line*/.  A regex like this should work:

   [^\n]/\*DB\?Line\*/[^\n]+\n

Unfortunately, I remember learning once that Xcode's regex does not parse 
newlines, and just confirmed that still seems to be the case.  So the \n on the 
end breaks it, and without it, I'm left with a blank line.

But thank you, Scott.  I'll keep trying.

* * *

Code Snippets would start to fill the bill if there were some environment 
variables available.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to