I settled on using a small Python script, since I am not
a Lisp programmer.

1.  I created a text file todononum.txt which contains
the next number to use.

2.  I created the following script to read this file, return the
next available number formatted in a unique, easy to find string,
for example [#310].

# script next_todo.py import sys
nextnum_file = "C:/charles/gtd/todonum.txt"

try:
   f = open(nextnum_file, 'r')
except IOError:
   print "Unable to open %s. Program terminating." % nextnum_file
   sys.exit(1)

val = int(f.readline()) + 1
f.close()

of = open(nextnum_file, 'w')
of.write("%d\n"  % val)
of.close()

print "[#%s]" % val


Charles,

If you don't need human readable numbers, you could try something like the following to generate a hash:

import hashlib
from time import strftime

timestamp = strftime("%Y-%m-%d %H:%M:%S")
s = myorg_item + timestamp
myhash = hashlib.sha224(s).hexdigest()

This combines your org text with the current timestamp to generate a hash. Since it's unlikely that you will try to create a hash from two identical org items at the same moment in time, this should be unique.

Ian.



_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to