From b1d82f875f1954722b7b85f03c95ffac063a42bc Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 26 Sep 2020 14:12:21 +0200 Subject: [PATCH] Do not let org-roam change matching data when determining the face It is not clear what function really changes the matching data, but it's called by `org-roam--id-link-face', and this is where we save the matching data now. TODO: check whether this has been reported or even fixed upstream. --- init.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 3345ce6..140a2ad 100644 --- a/init.el +++ b/init.el @@ -1333,7 +1333,19 @@ (apply orig-fun args))) (advice-add 'org-roam--update-file-name-on-title-change - :around #'db/org-roam--no-titlechange-if-title-is-nil))) + :around #'db/org-roam--no-titlechange-if-title-is-nil) + + ;; `org-roam--id-link-face' apparently changes the matching data, + ;; resulting in `org-finalize-agenda' to fail while applying text + ;; properties to ID links; let's warp `save-match-data' around calls + ;; to it. + + (defun db/save-match-data (orig-fun &rest args) + (save-match-data + (apply orig-fun args))) + + (advice-add 'org-roam--id-link-face + :around #'db/save-match-data))) (use-package org-ref :config (progn