From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: auto-complete mode with org-mode Date: Thu, 03 Feb 2011 15:38:15 +0000 Message-ID: <87pqr9b02g.fsf@ucl.ac.uk> References: <4D4AA6CF.5090804@googlemail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=42649 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pl1GI-0008Ul-Ls for emacs-orgmode@gnu.org; Thu, 03 Feb 2011 10:38:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pl1GH-0000U2-7C for emacs-orgmode@gnu.org; Thu, 03 Feb 2011 10:38:22 -0500 Received: from vscane-b.ucl.ac.uk ([144.82.108.141]:46724) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pl1GG-0000Tn-U4 for emacs-orgmode@gnu.org; Thu, 03 Feb 2011 10:38:21 -0500 In-Reply-To: <4D4AA6CF.5090804@googlemail.com> (phaebz@googlemail.com's message of "Thu, 03 Feb 2011 13:59:59 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: phaebz Cc: emacs-orgmode@gnu.org phaebz writes: > I am using org-mode v. 7.3 and auto-complete v. 1.2 > > I added org-mode to "ac-modes" as described in the documentation. When > typing in an org-mode buffer, I correctly get the popup-menu from > auto-complete mode. If I then press TAB to complete the word, nothing > happens - since TAB is bound to org-cycle. > > I am not really familliar with ac-mode, but I guess it could be using > a hook when populating the popup menu, so that I could bind the tab > key in this hook ac-specific and bind it then again to org-cycle when > after-completion-hook is run, in case there is one... I just wanted to > ask here if others have a similar setup/issue and how it is solved > elegantly, i.e. in org-mode style. > > Thank you > > Michael Bach org mode somehow (I have no idea how or why) manages to distinguish between TAB and C-i and this distinction is inherited by minor modes operating within an org mode buffer. For auto-complete, the fix is easy: #+begin_src emacs-lisp (require 'auto-complete) (require 'auto-complete-config) (ac-config-default) ;; (define-key ac-complete-mode-map "\t" 'ac-expand) (define-key ac-complete-mode-map [tab] 'ac-expand) ; <<--- add this line ;; (define-key ac-complete-mode-map "\r" 'ac-complete) #+end_src I've included two commented out lines: they are the defaults set by auto-complete. I found, before adding the annotated line, that C-i worked as expected within an auto-complete pop-up but the tab key didn't. With this key binding, it does. I do find, however, that although the \r (return key) works (accepts the completion proposed by auto-complete), *sometimes* org-mode also interprets it so that two things happen when I hit the key. I've not yet figured out when it does this in any reproducible manner unfortunately. -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 : using Org-mode version 7.4 (release_7.4.304.g71203.dirty)