From: Eshel Yaron Date: Sat, 7 May 2022 12:48:39 +0000 (+0300) Subject: Update esy/org-fill-custom-ids-in-buffer X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=00f600630987d0840601ae0f04f6bb0e55d04d37;p=dotfiles.git Update esy/org-fill-custom-ids-in-buffer --- 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: