company-org-block
Insert Emacs org blocks with completion (via company mode).
When enabled, the character β<β triggers company completion of org blocks.
Install
Use your preferred way to add company-org-block to company-backends.
MELPA
company-org-block is available on MELPA.
- Install via M-x package-install.
- Require, set edit style, and add company backend:
(require 'company-org-block)
(setq company-org-block-edit-style 'auto) ;; 'auto, 'prompt, or 'inline
(add-hook 'org-mode-hook
(lambda ()
(add-to-list (make-local-variable 'company-backends)
'company-org-block)))
use-package
Alternatively, can also install via use-package with something like:
(use-package company-org-block
:ensure t
:custom
(company-org-block-edit-style 'auto) ;; 'auto, 'prompt, or 'inline
:hook ((org-mode . (lambda ()
(setq-local company-backends '(company-org-block))
(company-mode +1)))))
Block edit style
You can configure what happens immediately after inserting a block, you have the option to configure the style via company-org-block-edit-style.
Auto (default)
Automatically edit, no prompt. May seem excessive at first, but Iβve become heavily reliant on this style. Give it some time.
Note: This is the default. No need to set company-org-block-edit-style to βauto.
Prompt
Ask me (via yes-or-no-p) after insertion.
(setq company-org-block-edit-style 'prompt)
No edit
Prefer no editing after insertion? Set to βinline.
(setq company-org-block-edit-style 'inline)
Supported languages
company-org-block draws completion candidates from org-babel-load-languages. The more languages added, the more completions youβll see.