views:

2262

answers:

4

I recently switched to emacs for my code editing, and it mostly works well.

However, for Objective-C I find myself missing Xcode's autocomplete feature as I have trouble remembering the long function names such as

- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation screen:(NSScreen *)screen;

Is there a way to get Xcode-style autocompletion on emacs?

Also, are there any good packages to help with Cocoa or Objective-C in general that I should have?

+3  A: 

I haven't used XCode, but emacs comes with several autocomplete modes.

See:

  • built in dabbrev-expand (M-/ runs the command dabbrev-expand which "autocompletes" partially written text)
  • AutoComplete
  • HippieExpand

Also cedet for something more sophisticated - but I don't think it works with objective-c unfortunately.

luapyad
Thanks, I'm not sure any of these will work well enough though (doesn't look like any are context sensitive enough), I think I may just stick to XCode for Objective-C.
cobbal
+1  A: 

I haven't tried it yet, but company-mode has an xcode backend that could be quite helpful:

http://nschum.de/src/emacs/company-mode/

zpinter
+2  A: 

A somewhat buggy and hacky, but very nice solution is clang-completion-mode.el found in the clang svn.

cobbal
+2  A: 

I wrote a script to export function definitions in Cocoa SDK as yasnippet snippets: http://github.com/zegal/yasobjc

With the help with ETAGS and auto-complete, the completion experience is very close to XCode. You can have a try.

zegal
Very clever, and super useful, I love it ! Thanks zegal
julien