• Stars
    star
    131
  • Rank 275,867 (Top 6 %)
  • Language
    Emacs Lisp
  • License
    GNU General Publi...
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ‘‰ Support this work via GitHub Sponsors

company-org-block

Buy me a coffee β˜•

Insert Emacs org blocks with completion (via company mode).

When enabled, the character β€œ<” triggers company completion of org blocks.

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 MELPA.

https://melpa.org/packages/company-org-block-badge.svg

  1. Install via M-x package-install.
  2. 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.

automatic.gif

Prompt

Ask me (via yes-or-no-p) after insertion.

(setq company-org-block-edit-style 'prompt)

prompted.gif

No edit

noedit.gif

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.

Support this work

πŸ‘‰ Support my work via GitHub Sponsors