[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb bc71bda 099/350: Many fixes to migration routine
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb bc71bda 099/350: Many fixes to migration routine |
Date: |
Mon, 14 Aug 2017 11:46:15 -0400 (EDT) |
branch: externals/ebdb
commit bc71bda8038fa21aece8795413c37e082664255e
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Many fixes to migration routine
Fixes #15
Thanks to Andy Cowling for reporting.
* ebdb-migrate.el (ebdb-migrate-vector-to-class): Had accumulated many
small bugs.
(ebdb-migrate-parse-records): This is the weird part, no idea how
this had ever worked.
* ebdb.el: Tweak requires and autoloads, as well as parts of the role
adoption routine.
* ebdb-gnus.el: Autoload message-make-domain.
---
ebdb-gnus.el | 2 ++
ebdb-migrate.el | 33 ++++++++++++++++++++++-----------
ebdb.el | 8 +++++---
3 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/ebdb-gnus.el b/ebdb-gnus.el
index 00feef1..8af8e58 100644
--- a/ebdb-gnus.el
+++ b/ebdb-gnus.el
@@ -27,6 +27,8 @@
(require 'ebdb-mua)
(require 'gnus)
+(autoload 'message-make-domain "message")
+
(defgroup ebdb-mua nil
"Variables that specify the EBDB-MUA interface"
:group 'ebdb)
diff --git a/ebdb-migrate.el b/ebdb-migrate.el
index dbabffa..dffbf69 100644
--- a/ebdb-migrate.el
+++ b/ebdb-migrate.el
@@ -375,7 +375,7 @@ holding valid contacts in a previous BBDB format."
(require 'ebdb-gnus)
(with-current-buffer (find-file-noselect bbdb-file)
(when (and (/= (point-min) (point-max))
- (yes-or-no-p "Upgrade from previous version of BBDB?"))
+ (yes-or-no-p "Upgrade from previous version of BBDB? "))
(let ((v-records (ebdb-migrate-parse-records))
(target-db (if (= (length ebdb-db-list) 1)
(car ebdb-db-list)
@@ -522,11 +522,13 @@ holding valid contacts in a previous BBDB format."
:timestamp
(apply #'encode-time
(parse-time-string val)))))
- ((eq lab ebdb-mail-alias-field)
+ ((eq lab 'mail-alias)
(push (make-instance 'ebdb-field-mail-alias
- :alias val)
+ :alias val
+ :address (car-safe mails))
fields))
- ((string-match-p val url-handler-regexp)
+ ((and (stringp v)
+ (string-match-p val url-handler-regexp))
(push (make-instance 'ebdb-field-url
:url val)
fields))
@@ -547,6 +549,15 @@ holding valid contacts in a previous BBDB format."
:notes val)))
((eq lab 'messages)
(unless (stringp val)
+ (setq val
+ (mapcar
+ (lambda (s)
+ (make-gnorb-ebdb-link
+ :subject (aref s 1)
+ :date (aref s 2)
+ :group (aref s 3)
+ :id (aref s 4)))
+ val))
(push (make-instance 'gnorb-ebdb-field-messages
:messages val)
fields)))
@@ -554,7 +565,7 @@ holding valid contacts in a previous BBDB format."
(push (make-instance 'ebdb-org-field-tags
:tags (if (listp val)
val
- (split-string val ";" t t)))
+ (split-string val ";" t " ")))
fields))
((memq lab (list bbdb/gnus-score-field
bbdb/gnus-split-private-field
@@ -596,18 +607,18 @@ holding valid contacts in a previous BBDB format."
(widen)
(goto-char (point-min))
;; look backwards for file-format, and convert if necessary.
- (let ((file-format (save-excursion
- (if (re-search-backward
- "^;+[ \t]*file-\\(format\\|version\\):[
\t]*\\([0-9]+\\)[ \t]*$" nil t)
- (string-to-number (match-string 2)))))
+ (let ((file-format
+ (if (re-search-forward
+ "^;+[ \t]*file-\\(format\\|version\\):[ \t]*\\([0-9]+\\)[
\t]*$" nil t)
+ (string-to-number (match-string 2))))
migrate records)
(unless file-format ; current file-format, but no file-format: line.
(error "BBDB corrupted: no file-format line"))
(if (> file-format ebdb-file-format)
- (error "BBDB version %s understands file format %s but not %s."
+ (error "EBDB version %s understands file format %s but not %s."
ebdb-version ebdb-file-format file-format)
(setq migrate (< file-format ebdb-file-format)))
-
+ (forward-char)
(or (eobp) (looking-at "\\[")
(error "BBDB corrupted: no following bracket"))
diff --git a/ebdb.el b/ebdb.el
index b781725..c18a654 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -45,6 +45,7 @@
(require 'timezone)
(require 'cl-lib)
(require 'seq)
+(require 'subr-x)
(require 'pcase)
(require 'eieio)
(require 'eieio-base)
@@ -52,7 +53,7 @@
(eval-when-compile ; pacify the compiler.
(autoload 'widget-group-match "wid-edit")
- (autoload 'ebdb-migrate "ebdb-migrate")
+ (autoload 'ebdb-migrate-from-bbdb "ebdb-migrate")
(autoload 'ebdb-do-records "ebdb-com")
(autoload 'ebdb-append-display-p "ebdb-com")
(autoload 'ebdb-toggle-records-layout "ebdb-com")
@@ -2583,7 +2584,7 @@ be moved to a role at ORG.
Currently only works for mail fields."
(let ((roles (slot-value record 'organizations))
(org-domain (slot-value org 'domain))
- org mail-domain)
+ mail-domain)
(dolist (r roles)
(when (and (string= (slot-value r 'org-uuid) (ebdb-record-uuid org))
org-domain)
@@ -2635,7 +2636,8 @@ appropriate person record."
_slot
(field ebdb-field-role))
(let ((org (ebdb-gethash (slot-value field 'org-uuid) 'uuid)))
- (ebdb-record-adopt-role-fields record org t)))
+ (when org
+ (ebdb-record-adopt-role-fields record org t))))
(cl-defmethod ebdb-record-change-name ((org ebdb-record-organization)
&optional name)
(let ((new-name (or name (ebdb-read 'ebdb-field-name-simple nil (slot-value
org 'name)))))
- [elpa] externals/ebdb 1fe77aa 152/350: Tiny tweak to snarfing, (continued)
- [elpa] externals/ebdb 1fe77aa 152/350: Tiny tweak to snarfing, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 189314d 151/350: Fix up Org link following, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 52d3d54 113/350: Remove all pop-up-window-size type options, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 4cd4a0c 123/350: Simplify searching, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5b24d54 126/350: Special-case mail symbol in ebdb-record-field, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5613bc2 137/350: Fix bug in ebdb-record-field-slot-query, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 86b386d 141/350: Compiler-inspired fixes, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 05f67d6 081/350: Fix merging procedure, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 1ded570 086/350: Note new database-related commands in manual, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ef673e2 094/350: Improve organization searching, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb bc71bda 099/350: Many fixes to migration routine,
Eric Abrahamsen <=
- [elpa] externals/ebdb 548e05d 106/350: Tweaks to MUA interactive commands, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb dd83c7e 115/350: Short-circuit ebdb-info, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a0eada8 128/350: Change some of the EBDB buffer formatting defaults, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 20906ae 131/350: ebdb-prompt-for-record should load if necessary, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 1bc78ab 133/350: Add helm-ebdb file, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ed3e270 119/350: Reverse order of args in return value of ebdb-popup-window, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ed6e228 136/350: Make ebdb-annotate-message more class agnostic, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb aa2d973 147/350: Allow optional records argument to ebdb-initialize, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 42f6dce 130/350: Add "Hacking EBDB" section to manual, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5dda311 118/350: Force mode line update after renaming EBDB buffers, Eric Abrahamsen, 2017/08/14