3

I need to edit source code in org-mode.

#+BEGIN_SRC cpp
void elimDups(vector<string> &words)
{
    sort(words.begin(), words.end());
    auto end_unique = unique(words.begin(), words.end());
    words.erase(end_unique, words.end());
}
#+END_SRC

In code blocks, there is no code completion.

Is it possible to use code completion in code blocks in org-mode?

enter image description here

1 Answer 1

5

You can do C-c ' to open a new window with the corresponding major mode. Then you have code completion.

6
  • Your cursor need too be in the src BLOC. You can try M-x org-edit-special
    – djangoliv
    Commented Jun 2, 2016 at 7:51
  • Also not work. Not only company-mode can not work, Yasnippet can not work too.
    – ernest
    Commented Jun 2, 2016 at 8:34
  • You also need to configure completion in C++ major mode.
    – djangoliv
    Commented Jun 2, 2016 at 9:23
  • I could use completion when editing a cpp source file
    – ernest
    Commented Jun 2, 2016 at 10:33
  • I think the problem is the completion configuration. For example, this file is not parse by CEDET... The solution works well with emacs-lisp or python but need more configuration for c++
    – djangoliv
    Commented Jun 2, 2016 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.