From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Insert UUID with org-insert-todo-heading Date: Sun, 6 Apr 2014 19:39:06 -0400 Message-ID: References: <87a9byz5cx.fsf@quasar.esben-stien.name> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b5d8937b25b7904f668419c Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWweb-0004jT-9C for emacs-orgmode@gnu.org; Sun, 06 Apr 2014 19:39:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WWwea-0005kw-4D for emacs-orgmode@gnu.org; Sun, 06 Apr 2014 19:39:09 -0400 Received: from mail-pd0-x230.google.com ([2607:f8b0:400e:c02::230]:33423) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWweZ-0005kh-Qw for emacs-orgmode@gnu.org; Sun, 06 Apr 2014 19:39:08 -0400 Received: by mail-pd0-f176.google.com with SMTP id r10so5713976pdi.21 for ; Sun, 06 Apr 2014 16:39:06 -0700 (PDT) In-Reply-To: <87a9byz5cx.fsf@quasar.esben-stien.name> 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.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Esben Stien Cc: "emacs-orgmode@gnu.org" --047d7b5d8937b25b7904f668419c Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable this kind of does what you want: #+BEGIN_SRC emacs-lisp (require 'org-id) (add-hook 'org-insert-heading-hook #'(lambda () (org-entry-put (point) "UUID" (org-id-uuid)))) #+END_SRC at least it works if you use the menu to insert a new heading. it does not work if you type the heading by hand. org-insert-heading-hook you can probably write a little function that sets a uuid property. John ----------------------------------- John Kitchin Associate Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu On Sun, Apr 6, 2014 at 2:21 PM, Esben Stien wrote: > I'm using the following to have a CREATED field in the PROPERTIES field > of a TODO: > > ;; advice org-insert-todo-heading to insert a created timestamp using > org-expiry > (defadvice org-insert-todo-heading (after mrb/created-timestamp-advice > activate) > "Insert a CREATED property using org-expiry.el for TODO entries" > (mrb/insert-created-timestamp) > ) > (ad-activate 'org-insert-todo-heading) > > So, I get: > > **** TODO > :PROPERTIES: > :CREATED: [2014-04-06 s=F8. 20:11] > :END: > > Is there any way to insert a UUID as well?, like: > > **** TODO > :PROPERTIES: > :CREATED: [2014-04-06 s=F8. 20:11] > :UUID: 70f273b5-8bce-315f-6f31-6d9ec9a8b739 > :END: > > Any pointers as to how I can achieve this? > > -- > Esben Stien is b0ef@e s a > http://www. s t n m > irc://irc. b - i . e/%23contact > sip:b0ef@ e e > jid:b0ef@ n n > > --047d7b5d8937b25b7904f668419c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
this kind of does what you want:

#+BEGIN_SRC e= macs-lisp
(require 'org-id)

(add-hook 'org-insert-heading= -hook
=A0=A0=A0 =A0 #'(lambda ()
=A0=A0=A0 =A0=A0=A0=A0=A0 (org= -entry-put (point) "UUID" (org-id-uuid))))=A0=A0=A0 =A0=A0=A0 =A0=
#+END_SRC

at least it works if you use the menu to insert a ne= w heading. it does not work if you type the heading by hand.
<= h3 id=3D"org-insert-heading-hook">org-insert-heading-hook

you can pr= obably write a little function that sets a uuid property.


Joh= n

-----------------------------------
John Kitchin
Associate P= rofessor
Doherty Hall A207F
Department of Chemical Engineering
Car= negie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu

<= /div>

On Sun, Apr 6, 2014 at 2:21 PM, Esben St= ien <b0ef@esben-stien.name> wrote:
I'm using the following to have a CREATED field in the PROPERTIES field=
of a TODO:

;; advice org-insert-todo-heading to insert a created timestamp using org-e= xpiry
(defadvice org-insert-todo-heading (after mrb/created-timestamp-advice acti= vate)
=A0 "Insert a CREATED property using org-expiry.el for TODO entries&qu= ot;
=A0 (mrb/insert-created-timestamp)
)
(ad-activate 'org-insert-todo-heading)

So, I get:

**** TODO
=A0 =A0 =A0:PROPERTIES:
=A0 =A0 =A0:CREATED: =A0[2014-04-06 s=F8. 20:11]
=A0 =A0 =A0:END:

Is there any way to insert a UUID as well?, like:

**** TODO
=A0 =A0 =A0:PROPERTIES:
=A0 =A0 =A0:CREATED: =A0[2014-04-06 s=F8. 20:11]
=A0 =A0 =A0:UUID: 70f273b5-8bce-315f-6f31-6d9ec9a8b739
=A0 =A0 =A0:END:

Any pointers as to how I can achieve this?

--
Esben Stien is b0ef@e =A0 =A0 s =A0 =A0 =A0a
=A0 =A0 =A0 =A0 =A0http://www.= s =A0 =A0 t =A0 =A0n m
=A0 =A0 =A0 =A0 =A0 irc://irc. =A0b =A0- =A0i =A0. =A0 e/%23contact
=A0 =A0 =A0 =A0 =A0 =A0sip:b0ef@ =A0 e =A0 =A0 e
=A0 =A0 =A0 =A0 =A0 =A0jid:b0ef@ =A0 =A0n =A0 =A0 n


--047d7b5d8937b25b7904f668419c--