emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Insert UUID with org-insert-todo-heading
@ 2014-04-06 18:21 Esben Stien
  2014-04-06 23:39 ` John Kitchin
  0 siblings, 1 reply; 3+ messages in thread
From: Esben Stien @ 2014-04-06 18:21 UTC (permalink / raw)
  To: emacs-orgmode

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ø. 20:11]
     :END:

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

**** TODO 
     :PROPERTIES:
     :CREATED:  [2014-04-06 sø. 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Insert UUID with org-insert-todo-heading
  2014-04-06 18:21 Insert UUID with org-insert-todo-heading Esben Stien
@ 2014-04-06 23:39 ` John Kitchin
  2014-04-07 15:22   ` Esben Stien
  0 siblings, 1 reply; 3+ messages in thread
From: John Kitchin @ 2014-04-06 23:39 UTC (permalink / raw)
  To: Esben Stien; +Cc: emacs-orgmode@gnu.org

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

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 <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-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ø. 20:11]
>      :END:
>
> Is there any way to insert a UUID as well?, like:
>
> **** TODO
>      :PROPERTIES:
>      :CREATED:  [2014-04-06 sø. 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
>
>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Insert UUID with org-insert-todo-heading
  2014-04-06 23:39 ` John Kitchin
@ 2014-04-07 15:22   ` Esben Stien
  0 siblings, 0 replies; 3+ messages in thread
From: Esben Stien @ 2014-04-07 15:22 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode@gnu.org

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> this kind of does what you want:

Hehe, that's really great;). Thanks a bunch.

-- 
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-07 15:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-06 18:21 Insert UUID with org-insert-todo-heading Esben Stien
2014-04-06 23:39 ` John Kitchin
2014-04-07 15:22   ` Esben Stien

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).