emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Lawrence Bottorff <borgauf@gmail.com>
To: emacs-orgmode Mailinglist <emacs-orgmode@gnu.org>
Subject: Turn function into interactive
Date: Sun, 29 Dec 2019 23:26:58 -0600	[thread overview]
Message-ID: <CAFAhFSXc6jp5UsVe795dCBY55URP1tZ7LSSDr3xX8sQDJSUYsw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 946 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1774 bytes --]

             reply	other threads:[~2019-12-30  5:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-30  5:26 Lawrence Bottorff [this message]
2019-12-30 18:43 ` Turn function into interactive Berry, Charles

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFAhFSXc6jp5UsVe795dCBY55URP1tZ7LSSDr3xX8sQDJSUYsw@mail.gmail.com \
    --to=borgauf@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).