From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lawrence Bottorff Subject: Re: Insert PROPERTIES drawer after heading creation Date: Wed, 11 Mar 2020 08:14:20 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000004d850705a0940410" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:56010) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jC1C1-0008HR-Ub for emacs-orgmode@gnu.org; Wed, 11 Mar 2020 09:14:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jC1Bx-0003zf-JU for emacs-orgmode@gnu.org; Wed, 11 Mar 2020 09:14:37 -0400 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]:34811) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jC1Bx-0003xc-Ak for emacs-orgmode@gnu.org; Wed, 11 Mar 2020 09:14:33 -0400 Received: by mail-lj1-x234.google.com with SMTP id s13so2291727ljm.1 for ; Wed, 11 Mar 2020 06:14:33 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: Diego Zamboni , emacs-orgmode Mailinglist --0000000000004d850705a0940410 Content-Type: text/plain; charset="UTF-8" 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 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 > 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 >> > --0000000000004d850705a0940410 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Yes, thanks. That substring was a bad copy. Any insight wh= y the (shell-command "uuidgen" t) wasn't working?

On Wed, Mar = 11, 2020 at 3:03 AM Diego Zamboni <diego@zzamboni.org> wrote:
Hi LB,

<= div>How about using the =3Dorg-id-uuid=3D function instead of shelling out = to uuidgen? In my quick test the following seems to behave properly:
<= div>
(defun template-myid ()
=C2=A0 (insert &q= uot;\n:PROPERTIES:\n:TIME: "
=C2=A0 =C2=A0 =C2=A0 (format-ti= me-string "%Y-%m-%dT%H:%M:%S")
=C2=A0 =C2=A0 =C2=A0 &qu= ot;\n:VERTEX: "
=C2=A0 =C2=A0 =C2=A0 (org-id-uuid)
=C2=A0 =C2=A0 =C2=A0 "\n:EDGES:=C2=A0 \n:END:"))

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

--Dieg= o


On Wed, Mar 11, 2020 at 5:39 AM Lawrence Bott= orff <borgauf@gma= il.com> wrote:
I want to insert upon creating a heading a PROPERTIE= S drawer. So far I have this

(defadvice org-insert-heading (after ad= d-id-stuff activate)
=C2=A0 (template-myid))

(defun template-myid= ()
=C2=A0 (insert "\n:PROPERTIES:\n:TIME: "
=C2=A0 =C2=A0 = =C2=A0 (substring (format "%s" (format-time-string "%Y-%m-%d= T%H:%M:%S")))
=C2=A0 =C2=A0 =C2=A0 "\n:VERTEX: "
=C2= =A0 =C2=A0 =C2=A0 (substring (format "%s" (shell-command "uu= idgen" t)))
=C2=A0 =C2=A0 =C2=A0 "\n:EDGES: =C2=A0\n:END:"= ;))

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

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

Not sure how to make this = behave.

LB
--0000000000004d850705a0940410--