From bb4032eb12c20d34555a4e670f28696cf31a7b54 Mon Sep 17 00:00:00 2001 From: stardiviner Date: Wed, 21 Dec 2022 12:31:08 +0800 Subject: [PATCH] Add `if' condition on (org-find-exact-headline-in-buffer query) return nil. --- org-contacts.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/org-contacts.el b/org-contacts.el index 004b826..2724dc9 100644 --- a/org-contacts.el +++ b/org-contacts.el @@ -1318,8 +1318,9 @@ Each element has the form (NAME . (FILE . POSITION))." ;; jump to exact contact headline directly (t (with-current-buffer buf - (let ((position (org-find-exact-headline-in-buffer query))) - (goto-char (marker-position position)))) + (if-let ((position (org-find-exact-headline-in-buffer query))) + (goto-char (marker-position position)) + (user-error "[org-contacts] Can't find <%s> in your `org-contacts-files'." query))) (display-buffer buf '(display-buffer-below-selected)) ;; FIXME: