cobbal
cobbal

Reputation: 70753

Emacs, Objective-C, and autocomplete

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?

Upvotes: 16

Views: 8973

Answers (5)

Jialong
Jialong

Reputation: 11

Edit the file auto-complete.el (look for it in the folder you installed "auto-complete" package, of course):

Goto line 165, I guarantee you know what to do already. :)

Upvotes: 1

zegal
zegal

Reputation: 91

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.

Upvotes: 9

cobbal
cobbal

Reputation: 70753

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

Upvotes: 5

zpinter
zpinter

Reputation: 2242

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/

Upvotes: 1

luapyad
luapyad

Reputation: 3900

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.

Upvotes: 3

Related Questions