My Emacs Org Configuration
These days, I’ve come across numerous posts and Reddit threads praising Org mode as one of the most compelling features of Emacs. There’s no doubt this is true, and I’m amazed by how many people use Emacs solely for Org-mode. As a software developer, I rely on Org every day for note-taking, maintaining my knowledge database (org-roam), agenda management (org-agenda, synchronized with beorg on my iPhone and iPad via Dropbox), and, of course, blogging.
So, I’ve decided to share my Org configuration in the hope that it will be useful to someone.
Org-mode
Org-mode is now included with Emacs, so we don’t need to install it
separately—except for org-roam
, which is an external package.
Common Settings
;; When at a URL, pressing the <Enter> opens the link in a browser.
(setq org-return-follows-link t)
;; To prevent M-RET splitting the line.
;; https://irreal.org/blog/?p=6297
(setq org-M-RET-may-split-line '((item . nil)))
;; To hide drawers, e.g. PROPERTIES.
(setq org-startup-folded 'fold)
Hide Emphasis Characters
From Org as a Word Processor.
;; Non-nil means font-lock should hide
;; the emphasis marker characters.
(setq org-hide-emphasis-markers t)
Keep in mind that the slash characters (and asterisks for bold, etc) are still there, but aren’t displayed.
;; Make invisible parts of Org elements appear visible.
(use-package org-appear :ensure t
:init
(setq org-appear-delay 0.2)
:hook
org-mode
)
The org-appear package is very helpful
when using org-hide-emphasis-markers
, as described above.
Hidden element parts appear when the cursor enters an element
and disappear when it leaves—with some delay.
Better List Bullets
From Org as a Word Processor.
;; Better list bullets.
(font-lock-add-keywords
'org-mode
'(("^ +\\([-*]\\) "
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))
Replace the initial -
with a Unicode bullet symbol •
.
Better Header Bullets
I prefer using Unicode circled digit symbols as header bullets to indicate the header level.
(use-package org-bullets :ensure t)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
(setq org-bullets-bullet-list
'("①" "②" "③" "④" "⑤" "⑥" "⑦" "⑧" "⑨" "⑩"))
;; Indent levels.
(add-hook 'org-mode-hook 'org-indent-mode)
;; Use this character(s) for ellipsis.
(setq org-ellipsis "...")
Source Code Blocks
;; Pretty fontification of source code blocks.
(setq org-src-fontify-natively t)
;; Use `bash' instead of `sh' in the `shell' code block.
(setq org-babel-sh-command "bash")
;; Use C++17.
(setq org-babel-C++-compiler "g++ -std=c++17")
;; `org-babel' languages.
(require 'ob-tangle)
(org-babel-do-load-languages
'org-babel-load-languages
'(
(shell . t)
(python . t)
(C . t) ; C and C++
(calc . t)
(latex . t)
(gnuplot . t)
(sqlite . t)))
;; No confirmation on block execution.
(setq org-confirm-babel-evaluate nil)
Org Agenda
;; Open the current agenda.
(global-set-key (kbd "C-c a") 'org-agenda)
;; View the agenda in the current window.
(setq org-agenda-window-setup 'current-window)
;; A file to store the agenda. I use Dropbox to be able to view/edit
;; the agenda on other devices (phones, tablets).
;; In particular, I use the `beorg' app on both iPhone and iPad.
(setq org-agenda-files '("~/Dropbox/org/refile-beorg.org"))
;; View diary for the current week.
(setq org-agenda-include-diary t)
;; Set priority range from A to C with default A.
(setq org-highest-priority ?A)
(setq org-lowest-priority ?C)
(setq org-default-priority ?A)
;; Optional. Set custom colors for priorities (for Solarized Dark theme).
;; Your theme may require a different color set.
(setq org-priority-faces
'((?A . (:foreground "#F0DFAF" :weight bold))
(?B . (:foreground "LightSteelBlue"))
(?C . (:foreground "OliveDrab"))))
;; Capture items using <C-c c>.
(define-key global-map (kbd "C-c c") 'org-capture)
(setq org-capture-templates
'(
("t" "TODO item in refile-beorg"
entry (file "~/Dropbox/org/refile-beorg.org")
"* TODO %?\n%U"
)
("n" "Notes in notes.org"
entry (file "~/Dropbox/org/notes.org")
"\n* %T %?\n%i"
)))
;; https://github.com/harrybournis/org-fancy-priorities
(use-package org-fancy-priorities
:ensure t
:hook
(org-mode . org-fancy-priorities-mode)
:config
(setq org-fancy-priorities-list '("⚡" "⏰" "☕")))
;; A timestamp or a note will be recorded when an entry has been refiled.
(setq org-log-refile t)
;; Add "CLOSED: [timestamp]" when a task is marked as DONE.
(setq org-log-done t)
(defun my/notes-open ()
(interactive)
(switch-to-buffer (find-file-noselect "~/Dropbox/org/notes.org")))
(global-set-key (kbd "C-c n") #'my/notes-open)
Theme Specific Settings
I use the Solarized Dark theme; it has some tweaks for Org-mode.
;; Don't change size of Org-mode headlines (but keep other size-changes)
(setq solarized-scale-org-headlines nil)
;; Avoid all font-size changes
(setq solarized-height-minus-1 1.0)
(setq solarized-height-plus-1 1.0)
(setq solarized-height-plus-2 1.0)
(setq solarized-height-plus-3 1.0)
(setq solarized-height-plus-4 1.0)
Some Custom Face Settings for Org-mode
I prefer to have a very dark background in code blocks. Your theme may require a different color set.
(custom-set-faces
'(org-block ((t (:background "gray10"))))
'(org-document-title ((t (:foreground "red" :weight bold))))
'(org-level-1 ((t (:inherit outline-1 :weight bold))))
'(org-level-2 ((t (:inherit outline-2 :weight normal :slant italic))))
'(org-level-3 ((t (:inherit outline-3 :slant italic))))
'(org-level-4 ((t (:inherit outline-4 :slant italic)))))
Screenshots

Org mode w/ code blocks. Click or tap to view the full-size picture.

Org agenda w/ diary. Click or tap to view the full-size picture.
Happy emacsing!
— The Emacs Cat.