emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: phaebz <phaebz@googlemail.com>
To: Eric S Fraga <e.fraga@ucl.ac.uk>
Cc: emacs-orgmode@gnu.org
Subject: Re: auto-complete mode with org-mode
Date: Sun, 06 Feb 2011 14:04:00 +0100	[thread overview]
Message-ID: <4D4E9C40.9080503@googlemail.com> (raw)
In-Reply-To: <87pqr9b02g.fsf@ucl.ac.uk>

On 02/03/2011 04:38 PM, Eric S Fraga wrote:
> phaebz <phaebz@googlemail.com> 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.
>

Thank you for the information!

remapped the ac-expand now. There is just one more annoyance: When the completions popup-menu gets displayed, for every line that has an org-style *heading, the completions line drawn over it starts just with the first letter and then an ellipsis "..."

I try to present an org snippet for an example:

#+BEGIN_org-sample
* first heading
--- popup-menu starts here ---
cobra
c...
c...
c...
c...
computer
connection
--- popup menu ends here ---
co<point>

some more text
#+END_org-sample

All lines in the popup menu that start with c..., would be real completion candidates, which get folded away because of underlying folded org-headings.

Any ideas on this?

Michael Bach

  reply	other threads:[~2011-02-06 13:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03 12:59 auto-complete mode with org-mode phaebz
2011-02-03 15:38 ` Eric S Fraga
2011-02-06 13:04   ` phaebz [this message]
2011-02-06 14:00     ` Eric S Fraga
2011-02-10 10:13       ` phaebz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D4E9C40.9080503@googlemail.com \
    --to=phaebz@googlemail.com \
    --cc=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).