From f7fa3f3a86499689a82bff9131b3c1186694ce5c Mon Sep 17 00:00:00 2001 From: James Ravn Date: Tue, 31 Mar 2020 12:33:16 +0100 Subject: [PATCH 1/2] 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. --- modules/lang/org/config.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index ca68bd125..34f7ae5b1 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -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)))) From dd94bd67acd7680488d87aaa67f83d1581ce5847 Mon Sep 17 00:00:00 2001 From: James Ravn Date: Tue, 7 Apr 2020 10:22:05 +0100 Subject: [PATCH 2/2] Use filter-return for downcase of uuidgen --- modules/lang/org/config.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 34f7ae5b1..46f277aff 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -514,12 +514,12 @@ current workspace (and clean them up)." (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) + (defadvice! +org--fix-inconsistent-uuidgen-case-a (uuid) "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)))) + :filter-return #'org-id-new + (if (eq org-id-method 'uuid) + (downcase uuid) + uuid))) (defun +org-init-keybinds-h ()