[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb 40d71b9 222/350: Steal UUID generating function fr
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb 40d71b9 222/350: Steal UUID generating function from Org |
Date: |
Mon, 14 Aug 2017 11:46:41 -0400 (EDT) |
branch: externals/ebdb
commit 40d71b97859b35f7d73ef57964e51591264e3122
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Steal UUID generating function from Org
Fixes #38
* ebdb.el (ebdb--make-uuid): Fallback in case there's no uuidgen
program on the system.
(ebdb-make-uuid): Use it.
---
ebdb.el | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/ebdb.el b/ebdb.el
index 3053eea..4f2c466 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -2703,12 +2703,38 @@ executable. When a symbol, assume an Elisp function."
(shell-command-to-string
(executable-find ebdb-uuid-function)))
((functionp ebdb-uuid-function)
- (funcall ebdb-uuid-function)))))
+ (funcall ebdb-uuid-function))
+ (t (ebdb--make-uuid)))))
(concat prefix-string
(replace-regexp-in-string
"[\n\t ]+" ""
uid))))
+;; Stolen directly and with no shame from Org.
+(defun ebdb--make-uuid ()
+ "Return string with random (version 4) UUID."
+ (let ((rnd (md5 (format "%s%s%s%s%s%s%s"
+ (random)
+ (current-time)
+ (user-uid)
+ (emacs-pid)
+ (user-full-name)
+ user-mail-address
+ (recent-keys)))))
+ (format "%s-%s-4%s-%s%s-%s"
+ (substring rnd 0 8)
+ (substring rnd 8 12)
+ (substring rnd 13 16)
+ (format "%x"
+ (logior
+ #b10000000
+ (logand
+ #b10111111
+ (string-to-number
+ (substring rnd 16 18) 16))))
+ (substring rnd 18 20)
+ (substring rnd 20 32))))
+
;;; The database class(es)
(defclass ebdb-db (eieio-named eieio-persistent)
- [elpa] externals/ebdb 501edfb 149/350: Give Org mode its own popup window, (continued)
- [elpa] externals/ebdb 501edfb 149/350: Give Org mode its own popup window, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 0612d92 153/350: Comment out ebdb-mua-auto-snarf-signature, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 957fc1b 157/350: Implement popping of buffer search history, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 3cb827e 181/350: Check for existence of fiel-attribute-modification-time, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb aabe2c0 189/350: Stupid mistake in previous commit, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 6549647 198/350: More tests, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb f316417 202/350: Change keybinding for ebdb-prev-field, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb bfc5d9d 208/350: Internationalized ebdb-parse method for names must accept slots arg, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 0c2056c 209/350: Basic tests for EBDB's internationalization support, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 2bfb04e 220/350: Move ebdb-message-search to ebdb.el, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 40d71b9 222/350: Steal UUID generating function from Org,
Eric Abrahamsen <=
- [elpa] externals/ebdb 4937cbd 225/350: Specify class of name fields when updating from MUA, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 13c0a38 216/350: Tweaks to testing macros, more tests, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 2b28f57 239/350: Bump to version 0.2, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ff3cfa4 232/350: ebdb-parse-i18n for Chinese phones should pass class arg through, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb d5bec83 229/350: Fix to UUID change, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 72aba6a 228/350: New label/field alist for vcard export, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb d0d0bbb 233/350: Shift transformation of search strings into ebdb-search, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb dc4217d 213/350: Compiler-inspired fixes, volume 5453, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ce5d9ee 242/350: Fix vCard formatting for anniversaries, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5d7a58c 246/350: Add option for character fold searching, Eric Abrahamsen, 2017/08/14