From: Nick Dokos <nicholas.dokos@hp.com>
To: charles_cave@optusnet.com.au
Cc: emacs-orgmode@gnu.org
Subject: Re: My Python solution to generating unique Ids in headlines
Date: Wed, 04 Mar 2009 18:59:43 -0500 [thread overview]
Message-ID: <13242.1236211183@alphaville.usa.hp.com> (raw)
In-Reply-To: Message from Charles Cave <charles_cave@optusnet.com.au> of "Thu, 05 Mar 2009 10:20:13 +1100." <200903042320.n24NKDmD007471@mail11.syd.optusnet.com.au>
Charles Cave <charles_cave@optusnet.com.au> 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
next prev parent reply other threads:[~2009-03-05 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-04 23:20 My Python solution to generating unique Ids in headlines Charles Cave
2009-03-04 23:59 ` Nick Dokos [this message]
2009-03-05 2:40 ` Charles Cave
2009-03-05 9:37 ` Carsten Dominik
2009-03-06 2:13 ` Samuel Wales
2009-03-05 8:39 ` Ian Barton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=13242.1236211183@alphaville.usa.hp.com \
--to=nicholas.dokos@hp.com \
--cc=charles_cave@optusnet.com.au \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).