From 038a608e795d0a0a308f85333a9cf4d8d32de69e Mon Sep 17 00:00:00 2001 From: stardiviner Date: Sat, 30 Oct 2021 18:19:56 +0800 Subject: [PATCH] Fix AVATAR property value not exist problem --- org-contacts.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/org-contacts.el b/org-contacts.el index 022e750..7202730 100644 --- a/org-contacts.el +++ b/org-contacts.el @@ -898,17 +898,17 @@ address." (setq pom (or pom (point))) (catch 'icon ;; Use `org-contacts-icon-property' - (let ((image-path (let ((avatar (org-entry-get pom org-contacts-icon-property)) - (link-matcher-regexp "\\[\\[\\([^]]*\\)\\]\\(\\[\\(.*\\)\\]\\)?\\]")) - (cond - ;; [[file:dir/filename.png]] - ((string-match-p "\\[\\[.*\\]\\]" avatar) - (when (string-match link-matcher-regexp avatar) - (expand-file-name (substring (match-string-no-properties 1 avatar) 5 nil) - (file-name-directory (first org-contacts-files))))) - ;; "" (empty string) - ((string-empty-p avatar) nil) - (t (expand-file-name avatar (file-name-directory (first org-contacts-files)))))))) + (let ((image-path (if-let ((avatar (org-entry-get pom org-contacts-icon-property)) + (link-matcher-regexp "\\[\\[\\([^]]*\\)\\]\\(\\[\\(.*\\)\\]\\)?\\]")) + (cond + ;; [[file:dir/filename.png]] + ((string-match-p "\\[\\[.*\\]\\]" avatar) + (when (string-match link-matcher-regexp avatar) + (expand-file-name (substring (match-string-no-properties 1 avatar) 5 nil) + (file-name-directory (first org-contacts-files))))) + ;; "" (empty string) + ((string-empty-p avatar) nil) + (t (expand-file-name avatar (file-name-directory (first org-contacts-files)))))))) (when image-path (throw 'icon (if (featurep 'imagemagick)