contrib/lisp/org-contacts.el: Fix a bug when contacts don't have an email address
* contrib/lisp/org-contacts.el (org-contacts-complete-tags-props, org-contacts-complete-group): Fix a bug when contacts don't have an email address.
This commit is contained in:
parent
bd83216f38
commit
75021a1fc2
1 changed files with 16 additions and 12 deletions
|
@ -516,11 +516,12 @@ A group FOO is composed of contacts with the tag FOO."
|
||||||
;; returned by `org-contacts-filter'.
|
;; returned by `org-contacts-filter'.
|
||||||
for contact-name = (car contact)
|
for contact-name = (car contact)
|
||||||
;; Grab the first email of the contact
|
;; Grab the first email of the contact
|
||||||
for email = (org-contacts-strip-link (car (org-contacts-split-property
|
for email = (org-contacts-strip-link
|
||||||
(or
|
(or (car (org-contacts-split-property
|
||||||
(cdr (assoc-string org-contacts-email-property
|
(or
|
||||||
(caddr contact)))
|
(cdr (assoc-string org-contacts-email-property
|
||||||
""))))
|
(caddr contact)))
|
||||||
|
""))) ""))
|
||||||
;; If the user has an email address, append USER <EMAIL>.
|
;; If the user has an email address, append USER <EMAIL>.
|
||||||
if email collect (org-contacts-format-email contact-name email))
|
if email collect (org-contacts-format-email contact-name email))
|
||||||
", ")))
|
", ")))
|
||||||
|
@ -528,7 +529,7 @@ A group FOO is composed of contacts with the tag FOO."
|
||||||
(completion-table-case-fold completion-list
|
(completion-table-case-fold completion-list
|
||||||
(not org-contacts-completion-ignore-case))))))))
|
(not org-contacts-completion-ignore-case))))))))
|
||||||
|
|
||||||
(defun org-contacts-complete-tags-props (start end matcher)
|
(defun org-contacts-complete-tags-props (start end string)
|
||||||
"Insert emails that match the tags expression.
|
"Insert emails that match the tags expression.
|
||||||
|
|
||||||
For example: FOO-BAR will match entries tagged with FOO but not
|
For example: FOO-BAR will match entries tagged with FOO but not
|
||||||
|
@ -538,25 +539,28 @@ See (org) Matching tags and properties for a complete
|
||||||
description."
|
description."
|
||||||
(let* ((completion-ignore-case org-contacts-completion-ignore-case)
|
(let* ((completion-ignore-case org-contacts-completion-ignore-case)
|
||||||
(completion-p (org-string-match-p
|
(completion-p (org-string-match-p
|
||||||
(concat "^" org-contacts-tags-props-prefix) string)))
|
(concat "^" org-contacts-tags-props-prefix) string)))
|
||||||
(when completion-p
|
(when completion-p
|
||||||
(let ((result
|
(let ((result
|
||||||
(mapconcat
|
(mapconcat
|
||||||
'identity
|
'identity
|
||||||
(loop for contact in (org-contacts-db)
|
(loop for contact in (org-contacts-db)
|
||||||
for contact-name = (car contact)
|
for contact-name = (car contact)
|
||||||
for email = (org-contacts-strip-link (car (org-contacts-split-property
|
for email = (org-contacts-strip-link (or (car (org-contacts-split-property
|
||||||
(or
|
(or
|
||||||
(cdr (assoc-string org-contacts-email-property
|
(cdr (assoc-string org-contacts-email-property
|
||||||
(caddr contact)))
|
(caddr contact)))
|
||||||
""))))
|
""))) ""))
|
||||||
for tags = (cdr (assoc "TAGS" (nth 2 contact)))
|
for tags = (cdr (assoc "TAGS" (nth 2 contact)))
|
||||||
for tags-list = (if tags
|
for tags-list = (if tags
|
||||||
(split-string (substring (cdr (assoc "TAGS" (nth 2 contact))) 1 -1) ":")
|
(split-string (substring (cdr (assoc "TAGS" (nth 2 contact))) 1 -1) ":")
|
||||||
'())
|
'())
|
||||||
if (let ((todo-only nil))
|
for marker = (second contact)
|
||||||
(eval (cdr (org-make-tags-matcher matcher))))
|
if (with-current-buffer (marker-buffer marker)
|
||||||
|
(save-excursion
|
||||||
|
(goto-char marker)
|
||||||
|
(let (todo-only)
|
||||||
|
(eval (cdr (org-make-tags-matcher (subseq string 1)))))))
|
||||||
collect (org-contacts-format-email contact-name email))
|
collect (org-contacts-format-email contact-name email))
|
||||||
",")))
|
",")))
|
||||||
(when (not (string= "" result))
|
(when (not (string= "" result))
|
||||||
|
|
Loading…
Reference in a new issue