org-block-capf icon indicating copy to clipboard operation
org-block-capf copied to clipboard

👉 [[https://github.com/sponsors/xenodium][Support this work via GitHub Sponsors]]

tl;dr “<” to trigger org block completion at point.

#+attr_html: :align center [[file:corfu.png]]\ Screenshot of =org-block-capf= completion in =corfu= with =corfu-popupinfo-mode= enabled for block preview.

Like [[https://github.com/xenodium/company-org-block][company-org-block]], but for users of the built-in =completion-at-point= completion or its extensions like [[https://github.com/minad/corfu][corfu]], who want similar functionality without the [[https://company-mode.github.io/][company]] dependency. org-block-capf is still compatible with company via its =company-capf= backend.

Check out [[https://github.com/xenodium/company-org-block][company-org-block]] to get a feel for the functionality and capabilities.

To enable =org-block-capf=, add it to the =completion-at-point-functions= in org-mode, which you can do via:

#+begin_src emacs-lisp :lexical no (require 'org-block-capf)

(add-hook 'org-mode-hook #'org-block-capf-add-to-completion-at-point-functions) #+end_src Then, completing the “<” via =complete-symbol= / =completion-at-point= in org-mode should let you select an org block.

Alternatively, you can use =M-x org-block-capf= as an interactive command to complete “<”, which doesn't require the above setup, as it uses itself as a completion-at-point-function.

Many thanks to [[https://github.com/meliache][Michael Eliachevitch]] for contributing improvements.