Use auto-id package
This commit is contained in:
parent
82252dbb27
commit
3fb9362383
19
init.org
19
init.org
|
@ -3963,23 +3963,10 @@ preceded by another heading) and after headings."
|
|||
:hook (org-mode . org-superstar-mode))
|
||||
#+END_SRC
|
||||
|
||||
*** Automatically add CUSTOM_ID property
|
||||
Probably best run in =before-save-hook=. Considerations -
|
||||
1. making human-readable CUSTOM_IDs by reusing heading titles
|
||||
2. maintaining CUSTOM_ID uniqueness
|
||||
|
||||
*** auto-id
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun my-org-set-custom-id ()
|
||||
(let (headings)
|
||||
(org-map-region
|
||||
(lambda ()
|
||||
(let ((heading (org-element-at-point)))
|
||||
(unless (org-element-property "CUSTOM_ID" heading)
|
||||
(cl-pushnew (org-element-property :title heading) headings))))
|
||||
(point-min)
|
||||
(point-max))
|
||||
(reverse headings)))
|
||||
(add-hook 'org-insert-heading-hook #'my-org-set-custom-id)
|
||||
(use-package auto-id
|
||||
:load-path "/media/data/anon/Documents/Text Files/programming/elisp/auto-id/")
|
||||
#+END_SRC
|
||||
|
||||
** markdown-mode :editing:
|
||||
|
|
Loading…
Reference in New Issue