contrib/lisp/org-contacts.el: Various formatting improvements and bug fixes
* contrib/lisp/org-contacts.el (org-contacts-ignore-property): Improve formatting and spelling. (org-contacts-complete-name): Improve formatting. (org-contacts-vcard-format): Improve formatting and silent byte compiler. (org-contacts-split-property): Fix a bug where `omit-nulls' were not forced to `t' when `separators' was nil.
This commit is contained in:
parent
e6b5811004
commit
fa4869123d
1 changed files with 20 additions and 17 deletions
|
@ -87,7 +87,8 @@ When set to nil, all your Org files will be used."
|
||||||
:group 'org-contacts)
|
:group 'org-contacts)
|
||||||
|
|
||||||
(defcustom org-contacts-ignore-property "IGNORE"
|
(defcustom org-contacts-ignore-property "IGNORE"
|
||||||
"Name of the property, which values will be ignored when complete or export to vcard."
|
"Name of the property, which values will be ignored when
|
||||||
|
completing or exporting to vcard."
|
||||||
:type 'string
|
:type 'string
|
||||||
:group 'org-contacts)
|
:group 'org-contacts)
|
||||||
|
|
||||||
|
@ -502,13 +503,14 @@ A group FOO is composed of contacts with the tag FOO."
|
||||||
|
|
||||||
;; Build the list of the email addresses which has
|
;; Build the list of the email addresses which has
|
||||||
;; been expired
|
;; been expired
|
||||||
for ignore-list = (org-contacts-split-property (or
|
for ignore-list = (org-contacts-split-property
|
||||||
(cdr (assoc-string org-contacts-ignore-property
|
(or (cdr (assoc-string org-contacts-ignore-property
|
||||||
(caddr contact))) ""))
|
(caddr contact))) ""))
|
||||||
;; Build the list of the user email addresses.
|
;; Build the list of the user email addresses.
|
||||||
for email-list = (org-contacts-remove-ignored-property-values ignore-list
|
for email-list = (org-contacts-remove-ignored-property-values
|
||||||
(org-contacts-split-property (or
|
ignore-list
|
||||||
(cdr (assoc-string org-contacts-email-property
|
(org-contacts-split-property
|
||||||
|
(or (cdr (assoc-string org-contacts-email-property
|
||||||
(caddr contact))) "")))
|
(caddr contact))) "")))
|
||||||
;; If the user has email addresses…
|
;; If the user has email addresses…
|
||||||
if email-list
|
if email-list
|
||||||
|
@ -891,13 +893,14 @@ to do our best."
|
||||||
(n (org-contacts-vcard-encode-name name))
|
(n (org-contacts-vcard-encode-name name))
|
||||||
(email (cdr (assoc-string org-contacts-email-property properties)))
|
(email (cdr (assoc-string org-contacts-email-property properties)))
|
||||||
(tel (cdr (assoc-string org-contacts-tel-property properties)))
|
(tel (cdr (assoc-string org-contacts-tel-property properties)))
|
||||||
(ignore (cdr (assoc-string org-contacts-ignore-property properties)))
|
(ignore-list (cdr (assoc-string org-contacts-ignore-property properties)))
|
||||||
|
(ignore-list (when ignore-list
|
||||||
|
(org-contacts-split-property ignore-list)))
|
||||||
(note (cdr (assoc-string org-contacts-note-property properties)))
|
(note (cdr (assoc-string org-contacts-note-property properties)))
|
||||||
(bday (org-contacts-vcard-escape (cdr (assoc-string org-contacts-birthday-property properties))))
|
(bday (org-contacts-vcard-escape (cdr (assoc-string org-contacts-birthday-property properties))))
|
||||||
(addr (cdr (assoc-string org-contacts-address-property properties)))
|
(addr (cdr (assoc-string org-contacts-address-property properties)))
|
||||||
(nick (org-contacts-vcard-escape (cdr (assoc-string org-contacts-nickname-property properties))))
|
(nick (org-contacts-vcard-escape (cdr (assoc-string org-contacts-nickname-property properties))))
|
||||||
(head (format "BEGIN:VCARD\nVERSION:3.0\nN:%s\nFN:%s\n" n name))
|
(head (format "BEGIN:VCARD\nVERSION:3.0\nN:%s\nFN:%s\n" n name))
|
||||||
(ignore-list (when ignore (setq ignore-list (org-contacts-split-property ignore))))
|
|
||||||
emails-list result phones-list)
|
emails-list result phones-list)
|
||||||
(concat head
|
(concat head
|
||||||
(when email (progn
|
(when email (progn
|
||||||
|
@ -995,9 +998,9 @@ normally \"[,; \f\t\n\r\v]+\", and OMIT-NULLS is forced to t.
|
||||||
If OMIT-NULLS is t, zero-length substrings are omitted from the list \(so
|
If OMIT-NULLS is t, zero-length substrings are omitted from the list \(so
|
||||||
that for the default value of SEPARATORS leading and trailing whitespace
|
that for the default value of SEPARATORS leading and trailing whitespace
|
||||||
are effectively trimmed). If nil, all zero-length substrings are retained."
|
are effectively trimmed). If nil, all zero-length substrings are retained."
|
||||||
(let* ((keep-nulls (or nil omit-nulls))
|
(let* ((omit-nulls (if separators omit-nulls t))
|
||||||
(rexp (or separators org-contacts-property-values-separators))
|
(rexp (or separators org-contacts-property-values-separators))
|
||||||
(inputlist (split-string string rexp keep-nulls))
|
(inputlist (split-string string rexp omit-nulls))
|
||||||
(linkstring "")
|
(linkstring "")
|
||||||
(bufferstring "")
|
(bufferstring "")
|
||||||
(proplist (list "")))
|
(proplist (list "")))
|
||||||
|
|
Loading…
Reference in a new issue