Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tips for transitioning from Emacs to Xcode

Tags:

emacs

xcode

macos

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.

like image 264
Rob Jones Avatar asked Aug 14 '09 03:08

Rob Jones


3 Answers

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.

like image 147
Carmine Paolino Avatar answered Nov 01 '22 05:11

Carmine Paolino


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.

like image 41
Pinochle Avatar answered Nov 01 '22 06:11

Pinochle


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.

like image 4
Andrew Johnson Avatar answered Nov 01 '22 04:11

Andrew Johnson