From 43b902a1fe625cc4c38abdbdc3fa0633c3971ed3 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Wed, 16 Jun 2021 14:33:20 +0200 Subject: [PATCH] [Emacs] Add package for unique IDs for org headers --- org/config/emacs.org | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/org/config/emacs.org b/org/config/emacs.org index b7a9c0f..23665fe 100644 --- a/org/config/emacs.org +++ b/org/config/emacs.org @@ -2373,6 +2373,26 @@ for org files that will be hosted and viewable on Github. (electric-indent-local-mode -1))) #+end_src +As explained in my [[https://blog.phundrak.com/better-custom-ids-orgmode/][blog post]], org-mode is terrible with coming up with +meaningful IDs for its headings. I actually wrote a package for this! +#+begin_src emacs-lisp + (use-package org-unique-id + :straight (org-unique-id :build t + :type git + :host github + :repo "Phundrak/org-unique-id") + :defer t + :after org + :init + (add-hook 'org-mode-hook + (lambda () + (add-hook 'before-save-hook + (lambda () + (when (and (eq major-mode 'org-mode) + (eq buffer-read-only nil)) + (org-unique-id))))))) +#+end_src + *** Babel A package I use from time to time is ~ob-latex-as-png~ which allows me to easily convert a LaTeX snippet into a PNG, regardless of the