Browse Source

org-compat.el: New compatibility function `org-random'

* org-compat.el (org-random): New compatibility function.

* org-id.el (org-id-uuid): Use it.
Bastien Guerry 5 years ago
parent
commit
cca22f4af7
2 changed files with 7 additions and 1 deletions
  1. 6 0
      lisp/org-compat.el
  2. 1 1
      lisp/org-id.el

+ 6 - 0
lisp/org-compat.el

@@ -460,6 +460,12 @@ With two arguments, return floor and remainder of their quotient."
 	   (defun org-release () "N/A")
 	   (defun org-git-version () "N/A !!check installation!!"))))))
 
+(defun org-random ()
+  "Call ̀random' appropriately."
+  (if (or (featurep 'xemacs) (version< emacs-version "24.2.50.1"))
+      (random t)
+    (random)))
+
 (provide 'org-compat)
 
 ;;; org-compat.el ends here

+ 1 - 1
lisp/org-id.el

@@ -317,7 +317,7 @@ So a typical ID could look like \"Org:4nd91V40HI\"."
 (defun org-id-uuid ()
   "Return string with random (version 4) UUID."
   (let ((rnd (md5 (format "%s%s%s%s%s%s%s"
-			  (random t)
+			  (org-random)
 			  (current-time)
 			  (user-uid)
 			  (emacs-pid)