emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Insert PROPERTIES drawer after heading creation


From: Lawrence Bottorff
Subject: Re: Insert PROPERTIES drawer after heading creation
Date: Wed, 11 Mar 2020 08:14:20 -0500

Yes, thanks. That substring was a bad copy. Any insight why the (shell-command "uuidgen" t) wasn't working?

On Wed, Mar 11, 2020 at 3:03 AM Diego Zamboni <address@hidden> wrote:
Hi LB,

How about using the =org-id-uuid= function instead of shelling out to uuidgen? In my quick test the following seems to behave properly:

(defun template-myid ()
  (insert "\n:PROPERTIES:\n:TIME: "
      (format-time-string "%Y-%m-%dT%H:%M:%S")
      "\n:VERTEX: "
      (org-id-uuid)
      "\n:EDGES:  \n:END:"))

Note that I also removed the wrapping (substring (format ...)), which didn't seem to be necessary.

--Diego


On Wed, Mar 11, 2020 at 5:39 AM Lawrence Bottorff <address@hidden> wrote:
I want to insert upon creating a heading a PROPERTIES drawer. So far I have this

(defadvice org-insert-heading (after add-id-stuff activate)
  (template-myid))

(defun template-myid ()
  (insert "\n:PROPERTIES:\n:TIME: "
      (substring (format "%s" (format-time-string "%Y-%m-%dT%H:%M:%S")))
      "\n:VERTEX: "
      (substring (format "%s" (shell-command "uuidgen" t)))
      "\n:EDGES:  \n:END:"))

This is working -- sort of. My problem is the uuid is getting thrown around. The output looks like this

* Heading
:PROPERTIES:
:TIME: 2020-03-10T23:34:17
:VERTEX: 12836
:EDGES:  
:END:32bf9499-f9e2-49d9-b8e7-9edb40272411

Not sure how to make this behave.

LB

reply via email to

[Prev in Thread] Current Thread [Next in Thread]