[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/org-contacts-rebased 9dec69a 056/118: contrib/lisp/org-co
From: |
Stefan Monnier |
Subject: |
[elpa] scratch/org-contacts-rebased 9dec69a 056/118: contrib/lisp/org-contacts: Introduce the constant `org-contacts-property-values-separators' |
Date: |
Fri, 12 Nov 2021 15:37:03 -0500 (EST) |
branch: scratch/org-contacts-rebased
commit 9dec69a9442b241fee1fafd804afc5b26cad5bac
Author: Michael Strey <mstrey@strey.biz>
Commit: Grégoire Jadi <gregoire.jadi@gmail.com>
contrib/lisp/org-contacts: Introduce the constant
`org-contacts-property-values-separators'
* contrib/lisp/org-contacts.el (org-contacts-property-values-separators):
Definition of a new constant that will be used as default value of
separators for `org-contacts-split-property'.
* contrib/lisp/org-contacts.el (org-contacts-vcard-format): We are now
using the default separator in general.
* contrib/lisp/org-contacts.el (org-contacts-show-map): Line break
corrected.
* contrib/lisp/org-contacts.el (org-contacts-split-property): Correct
the comment describing the function. Application of the newly
defined constant `org-contacts-property-values-separators'.
---
org-contacts.el | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/org-contacts.el b/org-contacts.el
index eb3fc09..84ebc9d 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -174,6 +174,11 @@ This overrides `org-email-link-description-format' if set."
(declare-function std11-narrow-to-header "ext:std11")
(declare-function std11-fetch-field "ext:std11")
+(defconst org-contacts-property-values-separators "[,; \f\t\n\r\v]+"
+ "The default value of separators for `org-contacts-split-property'.
+
+A regexp matching strings of whitespace, `,' and `;'.")
+
(defvar org-contacts-keymap
(let ((map (make-sparse-keymap)))
(define-key map "M" 'org-contacts-view-send-email)
@@ -850,7 +855,7 @@ to do our best."
(head (format "BEGIN:VCARD\nVERSION:3.0\nN:%s\nFN:%s\n" n name)))
(concat head
(when email (progn
- (setq emails-list (org-contacts-split-property email
"[,; ]+"))
+ (setq emails-list (org-contacts-split-property email))
(setq result "")
(while emails-list
(setq result (concat result "EMAIL:"
(org-contacts-strip-link (car emails-list)) "\n"))
@@ -859,7 +864,7 @@ to do our best."
(when addr
(format "ADR:;;%s\n" (replace-regexp-in-string "\\, ?" ";" addr)))
(when tel (progn
- (setq phones-list (org-contacts-split-property tel "[,;
]+"))
+ (setq phones-list (org-contacts-split-property tel))
(setq result "")
(while phones-list
(setq result (concat result "TEL:"
(org-contacts-strip-link (car phones-list)) "\n"))
@@ -912,7 +917,8 @@ Requires google-maps-el."
collect (cons (list addr) (list :label (string-to-char (car contact)))))))
(defun org-contacts-strip-link (link)
- "Remove brackets, description, link type and colon from an org link string
and return the pure link target."
+ "Remove brackets, description, link type and colon from an org
+link string and return the pure link target."
(let (startpos colonpos endpos)
(setq startpos (string-match (regexp-opt '("[[tel:" "[[mailto:")) link))
(if startpos
@@ -935,16 +941,16 @@ splitting points. The substrings matching SEPARATORS are
removed, and
the substrings between the splitting points are collected as a list,
which is returned.
-If SEPARATORS is non-nil, it should be a regular expression matching text
-which separates, but is not part of, the substrings. If nil it defaults to
-`split-string-default-separators', normally \"[ \\f\\t\\n\\r\\v]+\", and
-OMIT-NULLS is forced to t.
+If SEPARATORS is non-nil, it should be a regular expression
+matching text which separates, but is not part of, the
+substrings. If nil it defaults to `org-contacts-property-values-separators',
+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
that for the default value of SEPARATORS leading and trailing whitespace
are effectively trimmed). If nil, all zero-length substrings are retained."
(let* ((keep-nulls (or nil omit-nulls))
- (rexp (or separators split-string-default-separators))
+ (rexp (or separators org-contacts-property-values-separators))
(inputlist (split-string string rexp keep-nulls))
(linkstring "")
(bufferstring "")
- [elpa] scratch/org-contacts-rebased f4f5ff3 050/118: org-contacts.el (org-contacts-export-as-vcard): Don't use non-existent function `org-install-letbind', (continued)
- [elpa] scratch/org-contacts-rebased f4f5ff3 050/118: org-contacts.el (org-contacts-export-as-vcard): Don't use non-existent function `org-install-letbind', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased f07f259 049/118: org-contacts.el, add tel property, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 7f9ad6a 059/118: contrib/lisp/org-contacts.el: Permit to unload properly `org-contacts', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased c71bbd2 060/118: contrib/lisp/org-contacts.el (org-contacts-vcard-format): Silence byte-compiler, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased f259246 063/118: contrib/lisp/org-contacts.el: Add a complex org-contacts template to the file header, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased dbe6325 065/118: org-contacts: Ensure contacts cache is updated if it contains markers with no buffer, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased f62bfeb 066/118: org-contacts: use `org-' prefixed variants of cl functions, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 13d35c9 072/118: Update copyright years again., Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased b970428 091/118: Rationalize `org-link-(un)escape', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 5a2519c 048/118: org-contacts.el, add note property, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 9dec69a 056/118: contrib/lisp/org-contacts: Introduce the constant `org-contacts-property-values-separators',
Stefan Monnier <=
- [elpa] scratch/org-contacts-rebased 5e67fd8 068/118: Update copyright years., Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 666da7a 061/118: contrib/lisp/org-contacts.el: Add a feature, which can ignore emails or phones with property, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 7d47f48 062/118: contrib/lisp/org-contacts.el: Various formatting improvements and bug fixes, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased a452869 067/118: un-hexify TEL links in vCard export, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased e6e9fd8 071/118: Merge branch 'maint', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased dc57e62 058/118: org-contacts: Fix org-contacts-gnus-article-from-goto, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 19baaca 073/118: Merge branch 'maint', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 5be58f1 075/118: contrib/lisp/org-contacts.el: Factorize the construction of the database, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 5e05b4d 077/118: contrib/lisp/org-contacts.el: Fix a bug when contacts don't have an email address, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 9c27250 078/118: contrib/lisp/org-contacts.el: Allow the user to customize interactively the vcard export, Stefan Monnier, 2021/11/12