From 00f600630987d0840601ae0f04f6bb0e55d04d37 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sat, 7 May 2022 15:48:39 +0300 Subject: [PATCH] Update esy/org-fill-custom-ids-in-buffer --- .emacs.d/esy.org | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.emacs.d/esy.org b/.emacs.d/esy.org index 5633121..06df7c3 100644 --- a/.emacs.d/esy.org +++ b/.emacs.d/esy.org @@ -313,17 +313,23 @@ For further information about Elisp headers, see [[info:elisp#Library (interactive "d\nMCUSTOM_ID: ") (org-entry-put point "CUSTOM_ID" value)) + (defun esy/org-maybe-prompt-custom-id () + "Prompt for CUSTOM_ID if not set for the entry at POINT." + (unless (org-entry-get (point) "CUSTOM_ID") + (beacon-blink) + (org-cycle) + (call-interactively #'esy/org-fill-custom-id) + (org-global-cycle 1))) + (defun esy/org-fill-custom-ids-in-buffer () "Visit headers in the current buffer and set CUSTOM_ID for each." (interactive) (require 'beacon) (org-global-cycle 1) - (org-map-entries (lambda () - (unless (org-entry-get (point) "CUSTOM_ID") - (beacon-blink) - (org-cycle) - (call-interactively #'esy/org-fill-custom-id) - (org-global-cycle 1))))) + (message "Filled %d CUSTOM_ID properties." + (length (remove nil + (org-map-entries + #'esy/org-maybe-prompt-custom-id))))) #+end_src ** Export and publish :PROPERTIES: -- 2.39.5