I'm using org-mode
(Emacs: 24.3.1, org-mode: 7.9.3f 8.0.6) for a database of code snippets in different languages (so far mainly elisp and python). This works very nice using org-mode-babel, i.e. after creating a "code field" as explained in the documentation I can edit the code using the correct major-mode by issueing C-c '
(i.e. org-edit-special
). However, when editing C++ source snippets such as
#+begin_src c++
std::vector<int> v( 100 );
std::iota( std::begin( v ), std::end( v ), 0 ); // Fill with 0, 1, ..., 99.
#+end_src
The error message
byte-code: Language mode `c++-mode' fails with: "Buffer *Org Src snippets.org[ c++ ]* has no process"
is prined (snippets.org
is the name of the file I use to store the snippets). Furthermore, I can not save any changes made in the temporary buffer (which actually opens) and can not exit the temporary buffer using C-c '
.
Anyone encountered this problem previously?
UPDATE: I found the culprit! The auto completion source ac-source-clang-async
is responsible for screwing it up. My ac-clang
config:
(defun ac-cc-mode-clang-setup ()
(message " * calling ac-cc-mode-clang-setup")
(setq ac-clang-complete-executable "~/.emacs.d/site-lisp/emacs-clang-complete-async/clang-complete")
(setq ac-clang-cflags
(mapcar (lambda (item)(concat "-I" item))
(split-string
"
/usr/include/c++/4.7
/usr/include/c++/4.7/x86_64-linux-gnu
/usr/include/c++/4.7/backward
/usr/lib/gcc/x86_64-linux-gnu/4.7/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
/usr/local/root_v5.32.04/include
"
)))
(setq ac-clang-flags ac-clang-cflags)
;; (setq ac-sources (append '(ac-source-clang-async ac-source-yasnippet) ac-sources))
(setq ac-sources '(ac-source-filename ac-source-clang-async ac-source-yasnippet))
(ac-clang-launch-completion-process)
(ac-clang-update-cmdlineargs))
(defun ac-cc-mode-clang-config ()
(message " * calling ac-cc-mode-clang-config")
(add-hook 'c-mode-common-hook 'ac-cc-mode-clang-setup)
(add-hook 'auto-complete-mode-hook 'ac-common-setup))
(ac-cc-mode-clang-config)
Upon commenting this out, everything works nicely. I assume that the problem occurs because ac-clang
wants to execute clang on the source file, which does not exists because its a purely virtual buffer (meaning: there is no associated file). However, I don't want to lose support for using ac-clang
when writing programs... I think this might be solved if ac-cc-mode-clang-config
is only executed when I'm doing genuine C++ edits (not org-mode
c++ edits). Any ideas how to solve this?