Skip to content

Commit

Permalink
Make M-x uuid default to UUID-4 and add autoload cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
kanru committed Sep 18, 2014
1 parent 440b09e commit b62c169
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions uuid-el.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; uuid-el.el --- Provides uuid generating functions
;;; uuid-el.el --- Provides various UUID generating functions

;; Copyright (C) 2010, 2011, 2014 Kan-Ru Chen

Expand Down Expand Up @@ -36,7 +36,6 @@

;;; TODO:
;;
;; * Interactive command.
;; * Simplify implementation and interfaces.
;; * Unpack time-based UUID.

Expand Down Expand Up @@ -306,19 +305,21 @@ You customize `uuid-cid-format-string' to change the default format."
(uuid-4)))))
(apply 'format uuid-cid-format-string raw)))

;;;###autoload
(defun insert-uuid-cid (uuid)
"Insert UUID string in CID format that is suitable for COM definition.
If UUID is nil will generate UUID-4 automatically.
You customize `uuid-cid-format-string' to change the default format."
(interactive (list (read-string "UUID: " (uuid-4))))
(insert (uuid-cid uuid)))

(defun uuid (random)
"Insert UUID-1 at point. If RANDOM is non-nil, insert UUID-4 instead."
;;;###autoload
(defun uuid (time-based)
"Insert UUID-4 at point. If TIME-BASED is non-nil, insert UUID-1 instead."
(interactive "P")
(if random
(insert (uuid-4))
(insert (uuid-1))))
(if time-based
(insert (uuid-1))
(insert (uuid-4))))

(provide 'uuid-el)
;;; uuid-el.el ends here

0 comments on commit b62c169

Please sign in to comment.