From d26047e6f74e2023920eb0fd845ba2972e2610fe Mon Sep 17 00:00:00 2001 From: Jethro Kuan Date: Sun, 7 Nov 2021 22:29:17 +0800 Subject: [PATCH] (minor)db: make check for property drawers case-insensitive (#1949) --- org-roam-db.el | 2 +- org-roam-utils.el | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/org-roam-db.el b/org-roam-db.el index f94a9c6..8bbe2d3 100644 --- a/org-roam-db.el +++ b/org-roam-db.el @@ -344,7 +344,7 @@ If UPDATE-P is non-nil, first remove the file in the database." (setq link element)) ;; Prevent self-referencing links in ROAM_REFS ((and (eq type 'node-property) - (string-equal (org-element-property :key element) "ROAM_REFS")) + (org-roam-string-equal (org-element-property :key element) "ROAM_REFS")) nil) ;; Links in property drawers and lines starting with #+. Recall that, as for Org Mode v9.4.4, the ;; org-element-type of links within properties drawers is "node-property" and for lines starting with diff --git a/org-roam-utils.el b/org-roam-utils.el index 0c0b9e9..9351bd3 100644 --- a/org-roam-utils.el +++ b/org-roam-utils.el @@ -52,6 +52,13 @@ (org-roam-replace-string "\\" "\\\\") (org-roam-replace-string "\"" "\\\""))) +(defun org-roam-string-equal (s1 s2) + "Return t if S1 and S2 are equal. +Like `string-equal', but case-insensitive." + (and (= (length s1) (length s2)) + (or (string-equal s1 s2) + (string-equal (downcase s1) (downcase s2))))) + ;;; List utilities (defmacro org-roam-plist-map! (fn plist) "Map FN over PLIST, modifying it in-place."