2026-08-10 Emphasizing a region in Org mode

One of the most basic features of Org mode is its markup. It is basically the Markdown of the Emacs world (although some people, like Karl Voit, claim that it’s superior to Markdown), and it lets do basic things like italic, bold or verbatim very easily – at least if you’re writing text.

I, on the other hand, happen to edit text pretty often. This is very different from writing. When I write, typing a slash before and after something I want to emphasize is easy. When I edit and just want to make some text bold, putting stars around it is much less convenient.

In popular text processors, you can select a piece of text and press some keychord – usually C-b – to make it bold. I figured I could add a similar feature to my Org mode. Of course, I first checked for an existing one. It turns out that (of course!) Org mode has me covered already – but the key binding is absolutely abysmal. To make the active region bold, you need to press C-c C-x C-f *. (This is a general command called org-emphasize, bound to C-c C-x C-f, followed by the emphasizing character, * in this case.) This command is quite sophisticated and quite simplistic at the same time. For example, it can remove the emphasis (you need to press C-c C-x C-f SPC for that), but for this to work, the region must contain the existing emphasis characters. If the active region contains a space, it will be included in the emphasized text, and due to how Org syntax works, Org won’t actually apply the emphasis then. Still, it does its job well enough.

So, I decided to add some nifty keychord so that I can mark a piece of text bold more easily. It turns out that C-c C-x C-8 is free, and quite mnemonic since the star is usually typed with S-8 (that is, shift+8). Note that I didn’t bother with funcall-interactively or similar features since org-emphasize doesn’t care if it was called interactively, and instead of using the interactive form to detect if it should ask about the character to use, it just treats its char parameter as optional and asks the user for it if its nil.

(defun org-emphasize-bold ()
  "Call `org-emphasize' with the argument of `?*'."
  (interactive)
  (org-emphasize ?*))

(keymap-set org-mode-map "C-c C-x C-8" #'org-emphasize-bold)

Now I could add similar commands for other markup, like italics or strike-through, but I don’t use them enough to justify it. You may ask, why do I mark things as bold so often, then? After all, boldface should be used sparingly. The reason is that I often copy some article to my Org file and I want to make the key fragments prominent. Italics is too “weak” for that, while boldface is much more visible at a first glance. A dream of mine is a way to “highlight” the important parts (like in pdf readers, including the excellent pdf-tools), and apparently there exists a package which does exactly that, but I couldn’t make it work for me (yet?).

That’s it for today, see you next week!

CategoryEnglish, CategoryBlog, CategoryEmacs, CategoryOrgMode