From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: [patch] org-id: New org-id-method 'uuid' w/ elisp function that creates random uuid Date: Fri, 07 May 2010 17:57:05 +0200 Message-ID: <874oijaeni.wl%dmaus@ictsoc.de> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="===============2146465781==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OAQ22-0000wf-H7 for emacs-orgmode@gnu.org; Fri, 07 May 2010 12:04:06 -0400 Received: from [140.186.70.92] (port=34452 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OAQ1y-0000tW-1G for emacs-orgmode@gnu.org; Fri, 07 May 2010 12:04:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OAQ1v-0008At-FG for emacs-orgmode@gnu.org; Fri, 07 May 2010 12:04:01 -0400 Received: from mysql1.xlhost.de ([213.202.242.106]:45620) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OAQ1v-0008AV-6J for emacs-orgmode@gnu.org; Fri, 07 May 2010 12:03:59 -0400 Received: from localhost (localhost [127.0.0.1]) by mysql1.xlhost.de (Postfix) with ESMTP id 7F4E46FCEC for ; Fri, 7 May 2010 18:03:57 +0200 (CEST) Received: from mysql1.xlhost.de ([127.0.0.1]) by localhost (mysql1.xlhost.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zKVk0MOw+LTR for ; Fri, 7 May 2010 18:03:57 +0200 (CEST) Received: from t41.ictsoc.de (unknown [88.130.157.216]) by mysql1.xlhost.de (Postfix) with ESMTPSA id E71C46FCE7 for ; Fri, 7 May 2010 18:03:56 +0200 (CEST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org-mode --===============2146465781== Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Fri_May__7_17:57:04_2010-1"; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit --pgp-sign-Multipart_Fri_May__7_17:57:04_2010-1 Content-Type: multipart/mixed; boundary="Multipart_Fri_May__7_17:57:04_2010-1" --Multipart_Fri_May__7_17:57:04_2010-1 Content-Type: text/plain; charset=US-ASCII Attached patch for org-id adds a new function `org-id-uuid' that returns a random (version 4) uuid following the format and suggestions in RFC 4122: - it collects some random, system ans user specific data - creates a md5 hash for this data to obtain the require 32 octets - flips the correct bits to indicate a random uuid Using the elisp method to create a random uuid can be customized by setting `org-id-method' to 'uuid. In addition `org-id-new' throws an error when the call to `org-id-uuid-program' returns something that does not look like a uuid.[1] HTH -- David [1] Sorry, this should have been a patch on its own. -- OpenPGP... 0x99ADB83B5A4478E6 Jabber.... dmjena@jabber.org Email..... dmaus@ictsoc.de --Multipart_Fri_May__7_17:57:04_2010-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="org-id-uuid-elisp.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2xpc3AvQ2hhbmdlTG9nIGIvbGlzcC9DaGFuZ2VMb2cKaW5kZXggODhkNDc3 ZS4uMTcxYzIyMiAxMDA2NDQKLS0tIGEvbGlzcC9DaGFuZ2VMb2cKKysrIGIvbGlzcC9DaGFuZ2VM b2cKQEAgLTEsMyArMSwxMSBAQAorMjAxMC0wNS0wNyAgRGF2aWQgTWF1cyAgPGRtYXVzQGljdHNv Yy5kZT4KKworCSogb3JnLWlkLmVsIChvcmctaWQtdXVpZC1yZWdleHApOiBOZXcgY29uc3RhbnQu ICBSZWdleHAgdGhhdAorCW1hdGNoZXMgYSB1dWlkLgorCShvcmctaWQtbWV0aG9kKTogTmV3IGN1 c3RvbWl6YXRpb24gdmFsdWUuCisJKG9yZy1pZC1uZXcpOiBVc2UgbGlzcCBmdW5jdGlvbiB0byBj c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DAgOCkKKwkgICAgKHN1 YnN0cmluZyBybmQgOCAxMikKKwkgICAgKHN1YnN0cmluZyBybmQgMTMgMTYpCisJICAgIChmb3Jt YXQgIiV4IgorCQkgICAgKGxvZ2lvcgorCQkgICAgICNCMTAwMDAwMDAKKwkJICAgICAobG9nYW5k CisJCSAgICAgICNCMTAxMTExMTEKKwkJICAgICAgKHN0cmluZy10by1udW1iZXIKKwkJICAgICAg IChzdWJzdHJpbmcgcm5kIDE2IDE4KSAxNikpKSkKKwkgICAgKHN1YnN0cmluZyBybmQgMTggMjAp CisJICAgIChzdWJzdHJpbmcgcm5kIDIwIDMyKSkpKQorCiAoZGVmdW4gb3JnLWlkLXJldmVyc2Ut c3RyaW5nIChzKQogICAobWFwY29uY2F0ICdjaGFyLXRvLXN0cmluZyAobnJldmVyc2UgKHN0cmlu Zy10by1saXN0IHMpKSAiIikpCiAK --Multipart_Fri_May__7_17:57:04_2010-1-- --pgp-sign-Multipart_Fri_May__7_17:57:04_2010-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iF4EABEIAAYFAkvkOFAACgkQma24O1pEeOZ7ZwEA5mAGJta7hZ8SzaJtQr1h/h0u nouzeyekaFbNOlxuwgEBALblZSZgTH9aKDAaQqdARPWdVDo/dGd3VNWDLXpVAC0S =JlES -----END PGP SIGNATURE----- --pgp-sign-Multipart_Fri_May__7_17:57:04_2010-1-- --===============2146465781== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============2146465781==--