index all rss twitter github linkedin email

Álvaro Ramírez

18 October 2020 Emacs: org block complete and edit

I quickly got used to Emacs org block company completion. I did, however, almost always found myself running org-edit-special immediately after inserting completion. I use C-c ' for that. That's all fine, but it just felt redundant.

Why not automatically edit the source block in corresponding major mode after completion? I think I can also get used to that!

automatic.gif

Or maybe the automatic approach is too eager? There's also a middle ground: ask immediately after.

prompted.gif

Or maybe I don't want either in the end? Time will tell, but I now have all three options available:

(defcustom company-org-block-edit-mode 'auto
  "Customize whether edit mode, post completion was inserted."
  :type '(choice
          (const :tag "nil: no edit after insertion" nil)
          (const :tag "prompt: ask before edit" prompt)
          (const :tag "auto edit, no prompt" auto)))

The new option is now in the company-org-block snippet with my latest config.