[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb 886cfd0 054/350: Change gnorb tags field to plain
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb 886cfd0 054/350: Change gnorb tags field to plain org tags field |
Date: |
Mon, 14 Aug 2017 11:46:02 -0400 (EDT) |
branch: externals/ebdb
commit 886cfd08b53afeb90a0d75eee7a749ba76b5ea25
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Change gnorb tags field to plain org tags field
There was no reason to keep this under the gnorb package.
* ebdb-org.el (ebdb-org-tags): Tags collection variable moves here.
(ebdb-org-field-tags): As does the class, plus its various methods.
* ebdb-gnorb.el: Remove stuff from here.
* ebdb-migrate.el (gnorb-ebdb-org-tag-field): Keep this in the
migration file, it's not good for anything else.
(ebdb-migrate-vector-to-class): Adjust the name of the class we're
creating.
---
ebdb-gnorb.el | 45 ++-------------------------------------------
ebdb-migrate.el | 10 ++++++++--
ebdb-org.el | 40 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 50 insertions(+), 45 deletions(-)
diff --git a/ebdb-gnorb.el b/ebdb-gnorb.el
index b7873ca..485326d 100644
--- a/ebdb-gnorb.el
+++ b/ebdb-gnorb.el
@@ -19,23 +19,14 @@
;;; Commentary:
-;; Bits and pieces useful for tying EBDB in with Gnorb. This file
-;; will eventually be moved to the Gnorb package.
+;; Bits and pieces useful for tying EBDB in with Gnorb. Everything in
+;; this file can be moved elsewhere.
;;; Code:
(cl-defstruct gnorb-ebdb-link
subject date group id)
-(defvar gnorb-ebdb-org-tags nil
- "Variable holding tags defined for EBDB records.
-
-This list is added to the result of
-`org-global-tags-completion-table' when producing a list of
-potential tags for completion.")
-
-(push '(gnorb-ebdb-field-tags ";" ";") ebdb-separator-alist)
-
(defclass gnorb-ebdb-field-messages (ebdb-field-user)
((messages
:type (list-of gnorb-ebdb-link)
@@ -46,36 +37,4 @@ potential tags for completion.")
(cl-defmethod ebdb-string ((_field gnorb-ebdb-field-messages))
"Some messages")
-(defcustom gnorb-ebdb-org-tag-field 'org-tags
- "The name (as a symbol) of the field to use for org tags."
- :group 'gnorb-ebdb
- :type 'symbol)
-
-(defclass gnorb-ebdb-field-tags (ebdb-field-user)
- ((tags
- :type (list-of string)
- :initarg :tags
- :custom (repeat string)
- :initform nil))
- :human-readable "gnorb tags")
-
-(cl-defmethod ebdb-string ((field gnorb-ebdb-field-tags))
- (ebdb-concat 'gnorb-ebdb-field-tags (slot-value field 'tags)))
-
-(cl-defmethod ebdb-read ((field (subclass gnorb-ebdb-field-tags)) &optional
slots obj)
- (let* ((crm-separator (cadr (assq 'gnorb-ebdb-field-tags
ebdb-separator-alist)))
- (val (completing-read-multiple
- "Tags: "
- (append (org-global-tags-completion-table)
- (when gnorb-ebdb-org-tags
- (mapcar #'list gnorb-ebdb-org-tags)))
- nil nil
- (when obj (ebdb-string obj)))))
- (cl-call-next-method field (plist-put slots :tags val))))
-
-(cl-defmethod ebdb-init-field ((field gnorb-ebdb-field-tags) _record)
- (let ((tags (slot-value field 'tags)))
- (dolist (tag tags)
- (add-to-list 'gnorb-ebdb-org-tags tag))))
-
(provide 'ebdb-gnorb)
diff --git a/ebdb-migrate.el b/ebdb-migrate.el
index 430095c..751d70f 100644
--- a/ebdb-migrate.el
+++ b/ebdb-migrate.el
@@ -354,6 +354,11 @@ checked for a score to add to the mail addresses in the
same record."
:group 'ebdb-mua-gnus-scoring
:type 'symbol)
+(defcustom gnorb-ebdb-org-tag-field 'org-tags
+ "The name (as a symbol) of the field to use for org tags."
+ :group 'gnorb-ebdb
+ :type 'symbol)
+
;;;###autoload
(defun ebdb-migrate-from-bbdb ()
"Migrate from BBDB to EBDB.
@@ -366,6 +371,7 @@ Assume that the variable `bbdb-file' points to an existing
file
holding valid contacts in a previous BBDB format."
(require 'url-handlers)
(require 'ebdb-gnorb)
+ (require 'ebdb-org)
(require 'ebdb-gnus)
(with-current-buffer (find-file-noselect bbdb-file)
(when (and (/= (point-min) (point-max))
@@ -542,10 +548,10 @@ holding valid contacts in a previous BBDB format."
:messages val)
fields)))
((eq lab gnorb-ebdb-org-tag-field)
- (push (make-instance 'gnorb-ebdb-field-tags
+ (push (make-instance 'ebdb-org-field-tags
:tags (if (listp val)
val
- (ebdb-split gnorb-ebdb-org-tag-field
val)))
+ (split-string val ";" t t)))
fields))
((memq lab (list bbdb/gnus-score-field
bbdb/gnus-split-private-field
diff --git a/ebdb-org.el b/ebdb-org.el
index e1aa151..ab1f6ee 100644
--- a/ebdb-org.el
+++ b/ebdb-org.el
@@ -44,6 +44,9 @@
;; When calling `org-store-link' on a contact, a "ebdb:uuid/" style
;; link is created by default.
+;; This file also defines a "tags" field class, for tagging EBDB
+;; contacts with Org tags.
+
;;; Code:
(if (fboundp 'org-link-set-parameters)
@@ -105,5 +108,42 @@ italicized, in all other cases it is left unchanged."
(format "<text:span text:style-name=\"Emphasis\">%s</text:span>" desc))
(t desc)))
+(defvar ebdb-org-tags nil
+ "Variable holding tags defined for EBDB records.
+
+This list is added to the result of
+`org-global-tags-completion-table' when producing a list of
+potential tags for completion.")
+
+(push '(ebdb-org-field-tags ";" ";") ebdb-separator-alist)
+
+
+(defclass ebdb-org-field-tags (ebdb-field-user)
+ ((tags
+ :type (list-of string)
+ :initarg :tags
+ :custom (repeat string)
+ :initform nil))
+ :human-readable "org tags")
+
+(cl-defmethod ebdb-string ((field ebdb-org-field-tags))
+ (ebdb-concat 'ebdb-org-field-tags (slot-value field 'tags)))
+
+(cl-defmethod ebdb-read ((field (subclass ebdb-org-field-tags)) &optional
slots obj)
+ (let* ((crm-separator (cadr (assq 'ebdb-org-field-tags
ebdb-separator-alist)))
+ (val (completing-read-multiple
+ "Tags: "
+ (append (org-global-tags-completion-table)
+ (when ebdb-org-tags
+ (mapcar #'list ebdb-org-tags)))
+ nil nil
+ (when obj (ebdb-string obj)))))
+ (cl-call-next-method field (plist-put slots :tags val))))
+
+(cl-defmethod ebdb-init-field ((field ebdb-org-field-tags) _record)
+ (let ((tags (slot-value field 'tags)))
+ (dolist (tag tags)
+ (add-to-list 'ebdb-org-tags tag))))
+
(provide 'ebdb-org)
;;; ebdb-org.el ends here
- [elpa] externals/ebdb e178321 051/350: Trailing code in last commit, (continued)
- [elpa] externals/ebdb e178321 051/350: Trailing code in last commit, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb c212316 014/350: First commit of buffer improvements, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb dbd3559 042/350: Do away with ebdb-seen-uuids, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 7570ed9 040/350: Protect against non-present records in role delete method, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb c44b910 056/350: New ebdb-copy-mail-as-kill command, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 10b0fa4 057/350: Use save-excursion in ebdb-toggle-all-record-marks, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a2d2116 058/350: Use eieio-object-p instead of vectorp, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a158434 055/350: Remove ebdb-browse-url, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e50a437 043/350: When unloading, don't remove records from the db's record slot, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5ce28dc 048/350: Remove ebdb-file-coding-system variable, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 886cfd0 054/350: Change gnorb tags field to plain org tags field,
Eric Abrahamsen <=
- [elpa] externals/ebdb 9a42885 061/350: ebdb-prompt-for-mail should return single mails with no prompt, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e4f1cf5 046/350: Fix broken quoting for organization simple name reading, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 9e2c0e8 049/350: Fix logic of loading records from multiple databases, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb bd9dd94 072/350: Use ebdb-defunct face on defunct role fields, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 2ec61be 059/350: Fixup bbdb-mode keymap, menu, and docstring, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e49e9da 077/350: Using wrong var name in ebdb-edit-field, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 794babc 069/350: Fix mail field action, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 7d41fb9 076/350: Small tweaks to ebdb-load, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5156eb2 079/350: Rename ebdb-display-one-record to ebdb-search-single-record, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 3a0048f 041/350: Stop pretended init and delete are the same for records and fields, Eric Abrahamsen, 2017/08/14