From 7f03eafaad2e5746949c0bebb98353e939c51ade Mon Sep 17 00:00:00 2001 From: stardiviner Date: Fri, 21 Jul 2023 09:51:15 +0800 Subject: [PATCH] extract properties Org entry headline at `position' as data API for better contacts searching. --- org-contacts.el | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/org-contacts.el b/org-contacts.el index c2dd195..59d59a8 100644 --- a/org-contacts.el +++ b/org-contacts.el @@ -1296,10 +1296,26 @@ Each element has the form (NAME . (FILE . POSITION))." (with-current-buffer (get-buffer (file-name-nondirectory file)) (org-map-entries (lambda () - (let ((name (substring-no-properties (org-get-heading t t t t))) - (file (buffer-file-name)) - (position (point))) - `(:name ,name :file ,file :position ,position)))))) + (let* ((name (substring-no-properties (org-get-heading t t t t))) + (file (buffer-file-name)) + (position (point)) + ;; extract properties Org entry headline at `position' as data API for better contacts searching. + (entry-properties (org-entry-properties position 'standard)) + (property-name-chinese (cdr (assoc (upcase "NAME(Chinese)") entry-properties))) + (property-name-english (cdr (assoc (upcase "NAME(English)") entry-properties))) + (property-nick (cdr (assoc "NICK" entry-properties))) + (property-email (cdr (assoc "EMAIL" entry-properties))) + (property-mobile (cdr (assoc "MOBILE" entry-properties))) + (property-wechat (cdr (assoc (upcase "WeChat") entry-properties))) + (property-qq (cdr (assoc "QQ" entry-properties)))) + (list :name name :file file :position position + :name-chinese property-name-chinese + :name-english property-name-english + :nick property-nick + :email property-email + :mobile property-email + :wechat property-wechat + :qq property-qq)))))) (org-contacts-files)))) ;;;###autoload