[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/org-contacts-rebased 18ba907 114/118: Try to support diff
From: |
Stefan Monnier |
Subject: |
[elpa] scratch/org-contacts-rebased 18ba907 114/118: Try to support different type of AVATAR property. |
Date: |
Fri, 12 Nov 2021 15:37:15 -0500 (EST) |
branch: scratch/org-contacts-rebased
commit 18ba90737ce3d8e286f9e7d08cdd949161b2e057
Author: stardiviner <numbchild@gmail.com>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Try to support different type of AVATAR property.
- Support [[file:dir/filename.png]] link
- Support empty value
- Support default value
---
org-contacts.el | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/org-contacts.el b/org-contacts.el
index 9f775c5..6e0b16d 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -898,13 +898,24 @@ address."
(setq pom (or pom (point)))
(catch 'icon
;; Use `org-contacts-icon-property'
- (let ((image-data (org-entry-get pom org-contacts-icon-property)))
- (when image-data
+ (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))))))))
+ (when image-path
(throw 'icon
(if (fboundp 'gnus-rescale-image)
- (gnus-rescale-image (create-image image-data)
+ ;; FIXME `gnus-rescale-image' does not support rescale
`create-image' spec.
+ (gnus-rescale-image (create-image image-path)
(cons org-contacts-icon-size
org-contacts-icon-size))
- (create-image image-data)))))
+ (create-image image-path)))))
;; Next, try Gravatar
(when org-contacts-icon-use-gravatar
(let* ((email-list (org-entry-get pom org-contacts-email-property))
- [elpa] scratch/org-contacts-rebased cfa1db0 081/118: Remove some home-grown copies of cl-lib functions., (continued)
- [elpa] scratch/org-contacts-rebased cfa1db0 081/118: Remove some home-grown copies of cl-lib functions., Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased ee973b2 087/118: Deprecate `org-find-if' in favor of `cl-find-if', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 204548b 092/118: Fix function declarations, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 79d7a88 096/118: org-contacts.el: Add support for org-id generated link., Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased a603ab3 099/118: org-contacts.el: replace obsolete alias `loop' with `cl-loop', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 38f7b80 100/118: org-contacts.el: Only use org-id-store-link if org-id is loaded, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 3d068b7 104/118: org-contacts.el: Display contacts buffer result., Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased fd660ce 111/118: Tidy up whitespace, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 7b87e73 106/118: Prefer HTTPS to HTTP in most links, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 03dc64d 110/118: Change how completion is done, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 18ba907 114/118: Try to support different type of AVATAR property.,
Stefan Monnier <=
- [elpa] scratch/org-contacts-rebased 45bc95a 083/118: org-contacts: Fix org-contacts-matcher for BIRTHDAYs, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 49dd482 089/118: Use `string-match-p' instead of `org-string-match-p', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 124cc7a 098/118: org-contacts.el: Add usage comments, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased b2837af 109/118: simplify logic, remove unused variables, switch to lexical binding, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 5174678 116/118: Fix AVATAR property value not exist problem, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 1be8aa9 069/118: Merge branch 'maint', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 9c233be 070/118: Revert "Update copyright years.", Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased fc25530 074/118: contrib/lisp/org-contacts.el: Add a hook to allow users to plug completion functions, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased d3509e4 076/118: contrib/lisp/org-contacts.el: Complete contacts using tags and properties, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 6bcb093 079/118: contrib: Fix error messages., Stefan Monnier, 2021/11/12