Skip to content

Instantly share code, notes, and snippets.

@mpereira
Created March 5, 2021 17:52
An Emacs Lisp function that returns a UUID and makes it the latest kill in the kill ring
(defun make-uuid ()
"Return a UUID and make it the latest kill in the kill ring."
(interactive)
(kill-new (format "%04x%04x-%04x-%04x-%04x-%06x%06x"
(random (expt 16 4))
(random (expt 16 4))
(random (expt 16 4))
(random (expt 16 4))
(random (expt 16 4))
(random (expt 16 6))
(random (expt 16 6)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment