I work with WiX source files in Emacs (using James Clark's excellent nxml-mode) a lot and sometimes need to create a GUID. I was going to the trouble of calling guidgen.exe
, copying, pasting, and formatting (upcasing, and adding the "{}"). Then I did some digging in org-mode to see how it was generating GUIDs: they use uuidgen
from E2fsprogs which is available in cygwin and in Linux. OS X also has this utility but is a different version that does not support the same options.
Here's my implementation:
(defun insert-guid () "Inserts a Win32 GUID." (interactive) (let ((guid (shell-command-to-string "uuidgen|tr -d '\\n'"))) (insert (concat "{" (upcase guid) "}"))))
I pipe the ouput to tr
to remove any newlines.
No comments:
Post a Comment