I would like to enable auto-complete
for Babel code blocks in org-mode
:
#+begin_src emacs-lisp
(setq ) <--- language-aware auto-completion here
#+end_src
What do I need to add to my .emacs
file in order to configure auto-complete
to do this?
Late to the party but today the default (and recommended way without other hacks) is to switch to the dedicated elisp buffer for that "hunk" using 'org-edit-special which today is mapped to
C-c- '
Hit the same to return to your org file editing.
The most robust (and entirely not org-mode
specific) way to do this involves an indirect buffer
. Here's a blog post that explains indirect buffers in depth. Basically an indirect buffer mirrors the contents of a section of another buffer.
(defun narrow-to-region-indirect (start end)
"Restrict editing in this buffer to the current region, indirectly."
(interactive "r")
(deactivate-mark)
(let ((buf (clone-indirect-buffer nil nil)))
(with-current-buffer buf
(narrow-to-region start end))
(switch-to-buffer buf)))
At this point, you will have a new buffer that contains the region you previously made. You can enable a major mode for that buffer and edit to your satisfaction--the changes you make are (like any good mirror should do) reflected in the original document.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With