company-org-block
company-org-block copied to clipboard
👉 [[https://github.com/sponsors/xenodium][Support this work via GitHub Sponsors]]
- company-org-block
[[https://www.buymeacoffee.com/xenodium][Buy me a coffee ☕]]
Insert Emacs org blocks with completion (via [[https://github.com/company-mode/company-mode][company mode]]).
When enabled, the character "<" triggers company completion of org blocks.
[[file:hello-company-org-block.gif]]
- Install
Use your preferred way to add /company-org-block/ to /company-backends/.
** MELPA /company-org-block/ is available on [[https://melpa.org][MELPA]].
[[https://melpa.org/#/company-org-block][file:https://melpa.org/packages/company-org-block-badge.svg]]
- Install via M-x /package-install/.
- Require, set edit style, and add company backend:
#+begin_src emacs-lisp (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))) #+end_src
** use-package
Alternatively, can also install via [[https://github.com/jwiegley/use-package][use-package]] with something like:
#+begin_src emacs-lisp (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))))) #+end_src
- 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.
[[file:automatic.gif]]
** Prompt
Ask me (via /yes-or-no-p/) after insertion.
#+begin_src emacs-lisp (setq company-org-block-edit-style 'prompt) #+end_src
[[file:prompted.gif]]
** No edit
[[file:noedit.gif]]
Prefer no editing after insertion? Set to 'inline.
#+begin_src emacs-lisp (setq company-org-block-edit-style 'inline) #+end_src
- Supported languages
/company-org-block/ draws completion candidates from [[https://orgmode.org/worg/org-contrib/babel/languages/index.html][org-babel-load-languages]]. The more languages added, the more completions you'll see.
- Support this work
👉 [[https://github.com/sponsors/xenodium][Support my work via GitHub Sponsors]]