Make uuidgen consistent for org-id-new

On macos/bsd systems, uuidgen produces all uppercase output. On
Linux/GNU systems it produces all lowercase output. This leads to
problems when managing org files across both systems (see e.g.
https://lists.gnu.org/archive/html/emacs-orgmode/2019-07/msg00081.html).

This change adds a defadvice for `org-id-new` to always lowercase the
output of `uuidgen` so the behavior is consistent across platforms.
This commit is contained in:
James Ravn 2020-03-31 12:33:16 +01:00
parent 8f685a3c31
commit f7fa3f3a86
No known key found for this signature in database
GPG key ID: 52C372C72159D6EE

View file

@ -512,6 +512,13 @@ current workspace (and clean them up)."
(lambda (file-or-data &optional type data-p &rest props)
(let ((type (if (plist-get props :width) type)))
(apply old-create-image file-or-data type data-p props)))))
(apply orig-fn args)))
(defadvice! +org--fix-inconsistent-uuidgen-case (orig-fn &rest args)
"Ensure uuidgen always produces lowercase output regardless of system."
:around #'org-id-new
(if (equal org-id-method 'uuid)
(downcase (apply orig-fn args))
(apply orig-fn args))))