I've discovered org-outline-level which when in a code block under a given header delivers as expected:
* This old level
#+BEGIN_SRC emacs-lisp
(org-current-level)
#+END_SRC
#+RESULTS:
: 1
Now, how could I turn this into an interactive callable with M-x? My stab in the dark
(defun my-insert-level ()
(interactive)
(insert (org-outline-level)))
doesn't seem to be working. Or is there already an interactive that will give me what level I'm at? My goal is to put this into a tempo template for a PROPERTIES key-value, and I assume this sort of construct
(tempo-define-template "org-PROPERTIES_time-uuid-level"
'(":PROPERTIES:" n
":HLEVEL: " (my-insert-level) n
":Time: " (my-insert-dateutc) n
":UUID: " (my-insert-uuid) n
":END:" )
"<Pt" "Insert PROPERTIES time-uuid-level block" 'org-tempo-tags)
which gets distorted-munged, no doubt because it doesn't properly call and/or return org-outline-level. Any hints appreciated.
LB