Skip to content

Instantly share code, notes, and snippets.

@mpereira
Created March 5, 2021 17:52
Show Gist options
  • Save mpereira/cd5d247d00cc909e67fd0e76cef6ecc4 to your computer and use it in GitHub Desktop.
Save mpereira/cd5d247d00cc909e67fd0e76cef6ecc4 to your computer and use it in GitHub Desktop.
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