[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb 15f5bd8 6/6: Don't do anything clever with phone n
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb 15f5bd8 6/6: Don't do anything clever with phone numbers by default |
Date: |
Tue, 19 May 2020 15:49:21 -0400 (EDT) |
branch: externals/ebdb
commit 15f5bd8228be10b14f6c357519bfebfbf50d98aa
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Don't do anything clever with phone numbers by default
Fixes #89
* ebdb.el (ebdb-string): Just dump the string out.
(ebdb-parse): Accept everything between the area code and an extension
as the number, don't do any "parsing". People can use i18n libs if
they want.
---
ebdb.el | 45 +++++++++++++++++----------------------------
1 file changed, 17 insertions(+), 28 deletions(-)
diff --git a/ebdb.el b/ebdb.el
index 977bacf..1fcd5ab 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -1915,17 +1915,7 @@ The result looks like this:
(when extension
(push (format "X%d" extension) outstring))
(when number
- (let ((numstring (split-string number "" t)))
- (push
- (apply #'format (cl-case (length numstring)
- (7
- "%s%s%s-%s%s%s%s")
- (8
- "%s%s%s%s-%s%s%s%s")
- (t
- number))
- numstring)
- outstring)))
+ (push number outstring))
(when area-code
(push (format "(%d) " area-code) outstring))
(when country-code
@@ -1993,25 +1983,24 @@ The result looks like this:
(plist-put slots :area-code (string-to-number (match-string
1))))
(goto-char (match-end 0)))))
;; There is no full regexp for the main phone number. We just
- ;; chomp up any and all numbers that come after the area code,
- ;; until we hit an extension, or the end of the buffer. All
- ;; phone slots but "number" are actually saved as numbers. The
- ;; "number" is saved as a string, partially for ease in
- ;; formatting, partially because if it's too long Emacs turns it
+ ;; chomp up everything that comes after the area code, until we
+ ;; hit an extension, or the end of the buffer. All phone slots
+ ;; but "number" are actually saved as numbers. The "number" is
+ ;; saved as a string, partially because it isn't really a
+ ;; number, partially because if it's too long Emacs turns it
;; into a float, which is a pain in the ass.
- (unless (plist-member slots :number)
- (while (and (< (point) (point-max))
- (null (looking-at-p ext-regexp))
- (looking-at "[ \t]?\\([0-9]+\\)[- .]?"))
- (setq acc (concat acc (match-string-no-properties 1)))
- (goto-char (match-end 0)))
- (setq slots
- (plist-put slots :number acc)))
- (unless (plist-member slots :number)
- (when (looking-at ext-regexp)
+ (when (and (< (point) (point-max))
+ (re-search-forward (format "\\([^[:blank:]]+\\)\\(%s\\)?"
+ ext-regexp)))
+ (unless (plist-member slots :number)
(setq slots
- (plist-put slots :extension (string-to-number
- (match-string 1)))))))
+ (plist-put slots :number (match-string 1))))
+ (unless (or (plist-member slots :extension)
+ (null (match-string 2)))
+ (setq slots
+ (plist-put slots :extension
+ (string-to-number
+ (match-string 2)))))))
(cl-call-next-method class string slots)))
(cl-defmethod cl-print-object ((phone ebdb-field-phone) stream)
- [elpa] externals/ebdb updated (5d8b473 -> 15f5bd8), Eric Abrahamsen, 2020/05/19
- [elpa] externals/ebdb 4f72046 1/6: New defcustoms handling formatting of anniversary dates, Eric Abrahamsen, 2020/05/19
- [elpa] externals/ebdb d0321ab 2/6: Fix to previous anniversary display defcustoms, Eric Abrahamsen, 2020/05/19
- [elpa] externals/ebdb 4027218 3/6: Have ebdb-record-mail sort mails by priority, Eric Abrahamsen, 2020/05/19
- [elpa] externals/ebdb 3913555 4/6: Update last commit, Eric Abrahamsen, 2020/05/19
- [elpa] externals/ebdb f28b665 5/6: Prevent sort from actually altering record mails, Eric Abrahamsen, 2020/05/19
- [elpa] externals/ebdb 15f5bd8 6/6: Don't do anything clever with phone numbers by default,
Eric Abrahamsen <=