branch: externals/org-contacts commit a242901453d37facb17a1c8bd6277c96bb7e83b9 Author: stardiviner <numbch...@gmail.com> Commit: stardiviner <numbch...@gmail.com>
Fix `org-contacts--all-contacts` logic --- org-contacts.el | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/org-contacts.el b/org-contacts.el index 2f234b116c..03d8fa4a7a 100644 --- a/org-contacts.el +++ b/org-contacts.el @@ -1470,29 +1470,30 @@ Each element has the form (NAME . (FILE . POSITION))." (car (mapcar (lambda (file) (unless (buffer-live-p (get-buffer (file-name-nondirectory file))) - (with-current-buffer (find-file-noselect file) - (org-map-entries - (lambda () - (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))))))) + (find-file-noselect file)) + (with-current-buffer (find-file-noselect file) + (org-map-entries + (lambda () + (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)))) (setq org-contacts-all-contacts