tags:

views:

1450

answers:

3

I'm a developer making the transition from Linux/Emacs to OSX/Xcode. Does anyone have any tips or recommendations for smoothing this transition with regard to text editing? Specifically:

What Emacs habits caused the most heartburn upon switching, i.e. what errors did you make repeatedly that were a result of an Emacs background?

Was there a way to make Xcode work similarly, or did it require a change in behavior?

Is there anything you miss from Emacs that you can't get in Xcode?

I'm mostly interested in the text editor portion of this, e.g. key bindings, split windows, moving between buffers, etc... I never used Emacs in the IDE sense. It was always a pure text editor to me. Compiles happened in another shell. Ditto for SCM stuff.

+3  A: 

The transition isn't all that rough, once one discovers all that XCode has to offer.

Most of the Emacs text editing keybindings are in XCode (and Cocoa apps in general) so there isn't as much pain there as one might think.

You can even extend Xcode in the language of your choice (you could even use elisp in script mode, now that I think of it; I'll have to try that out), though you will always be forced to use Applescript in most scripts and extensibility is not nearly as good as in Emacs, nor is there a big "user script" community to get extensions from easily. You can usually get some simulacrum of the IDE aspects of Emacs going XCode, for instance I set aside some time a while ago and wrote some scripts and that integrate XCode with Git, which isn't officially supported by the SCM functionality of XCode.

I will always miss ido-mode when working in XCode, I miss using word forward and word back in XCode and I do use the mouse a lot more than I do in Emacs. One small thing that ends up being quite annoying to me is that parenthesis matching is only cued off when you pass the cursor over the closing parenthesis from left to right. You can't see the match if you keep the cursor on the right side of the closing parenthesis.

The things that you miss will be more than made up for by the fact that XCode is well-tailored to development in Objective-C and Cocoa. That being said, I only use it for Objective-C and Cocoa. Anything else, including user scripts, I write and test in Emacs first and then XCodeize them (for I/O etc) as a last step.

I found that the most important thing in making the transition was to stop lamenting that XCode wasn't Emacs and start putting that energy into figuring out how to get XCode to do what I wanted to do. As long as you are using XCode for Objective-C/Cocoa, you will be able to get what you want to do done (you won't be able to "easily" turn XCode into a personal organizer and timetable app, like has been done with Emacs for example).

Here's a list of good info for those just coming to XCode: XCode tips that you wished you knew 2 years ago.

Pinochle
FYI word forward and word back are binded to Alt-<right arrow> and Alt-<left arrow> where Cocoa controls text-editable things.
Carmine Paolino
Ha, I had a sneaking feeling that I was wrong in claiming that I did not know that binding, but couldn't for the life of me remember why. You've cued it. That is such a bad binding that I never use it and "forgot" about it. I dislike all bindings that use the arrow keys for what I think would be obvious reasons.
Pinochle
you should return to Emacs ;)
Carmine Paolino
+4  A: 

Don't.

I switched from emacs to XCode (aquamacs even) for my first iPhone project. On my next iPhone project, I'll be using emacs.

If you're the type that likes the Visual Basic thing, you're in for a treat using emacs. But if you just like to write code, there's really no reason to use XCode. You can get all the objective C love in emacs.

Andrew Johnson
Do you still have to pop into Xcode for anything? I've used IDEs in the past where the most convenient approach was to edit in Emacs, then open the code in the IDE and flash the target from there. I still had to use the IDE for some debugging tasks.
Rob Jones
As I said, for my next project I'm switching back. For the next few days, I'm still enduring XCode.
Andrew Johnson
+9  A: 

Don't fully switch to Xcode, just use Emacs for editing and Xcode for the rest (UI design, compilation, debugging, etc.). It seems to be a better compromise for you (and for me, because I use Xcode this way :-).

The best part is that Xcode will let you change the default editor to anything! Just set the "text -> sourcecode" editor to Emacs.app (or lowercased emacs if you wish to use the terminal version) in the "File Types" tab of Xcode's preferences and your life will be happier :-)

Just in case: when opening a file from OSX (dragging it in the Dock icon, open it from the Finder, ..., and even open it from Xcode), the default behavior of Emacs.app 23.1 is to open a new frame. If you don't like it, just add

(setq ns-pop-up-frames 'nil)

to your emacs' configuration file.

Carmine Paolino
Ahhh, that's what I've been looking for. I figured the option would be under the Text Editor tab of preferences. When I didn't see it there I assumed the worst.Do you mean:(setq ns-pop-up-frames nil)
Rob Jones
Carmine Paolino