[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] My Python solution to generating unique Ids in headlines
From: |
Nick Dokos |
Subject: |
Re: [Orgmode] My Python solution to generating unique Ids in headlines |
Date: |
Wed, 04 Mar 2009 18:59:43 -0500 |
Charles Cave <address@hidden> wrote:
> ...
> print "[#%s]" % val
>
>
> ...
>
> ESC-1 ESC-! nextnum RET Ctl-D
>
> The Ctrl D is needed to remove a carriage return (not sure why it is
> there.
Try
import sys
sys.stdout.write("[%d]" % val)
instead of print. It should work on Windows as well (but I have not
tested it there).
>
> Can someone give me Lisp code equivalent of
> the command sequene above? I know it is something to do
> with (shell command .... )
>
(shell-command "nextnum" t)
It may be necessary to specify a complete path to the command.
>
> The end result now looks like
>
> *** Post to org-mode list about next sequential [#315] :COMPUTER:
>
> Once I have Lisp code to implement the command sequence I will have
> a satisfactory solution to generating the unique id when I need it.
>
But I still don't understand why you need an external program: what is
wrong with (insert (format "[%s]" (org-id-new)))? Are the IDs too ugly
or is there some other problem?
The trouble with unique IDs in files is that it's easy for them to get
out of sync (leading to non-uniqueness), e.g. if there are two processes
trying to get a unique id at the same time.
Nick