[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb 189314d 151/350: Fix up Org link following
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb 189314d 151/350: Fix up Org link following |
Date: |
Mon, 14 Aug 2017 11:46:25 -0400 (EDT) |
branch: externals/ebdb
commit 189314d12d67e6f379c9a19f19498bca3576e206
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Fix up Org link following
* ebdb-org.el (ebdb-org-open): We have better search routines now, use
them.
---
ebdb-org.el | 44 +++++++++++++++++++++++---------------------
1 file changed, 23 insertions(+), 21 deletions(-)
diff --git a/ebdb-org.el b/ebdb-org.el
index 17123cc..e5cbe48 100644
--- a/ebdb-org.el
+++ b/ebdb-org.el
@@ -24,16 +24,19 @@
;; type; at some point we'll reproduce the Agenda anniversary
;; mechanisms from org-bbdb.el.
-;; EBDB links can come in several varieties. A plain string is simply
-;; fed directly to `bbdb-search'. Otherwise, the string can be
-;; prefixed with a field type, to search only on those field values.
-;; The prefix is separated with a forward slash. Examples:
+;; EBDB links can come in several varieties. A plain string is
+;; matched against record names in the database. Otherwise, the
+;; string can be prefixed with a field type, to search only on those
+;; field values. The prefix is separated with a forward slash.
+;; Examples:
;; 1. "ebdb:uuid/af1373d6-4ba1-46a7-aa4b-845db01bc2ab" (link to unique
;; record)
;; 2. "ebdb:mail/google.com" (all records with google.com email
-;; addresses)
+;; addresses). These field name "shorthands" include "uuid", "mail",
+;; "phone", "address", "notes", and "tags" (this last for the
+;; `ebdb-org-field-tags' class defined in this file).
;; 3. "ebdb:ebdb-field-foobar/baz" (search on a particular field
;; class)
@@ -80,22 +83,21 @@
(defun ebdb-org-open (link)
"Follow a EBDB link."
- (let ((bits (split-string link "/" t))
- records)
- (if (string-match-p "^ebdb-field-" (car bits))
- (message "Following field type links not implemented yet.")
- (setq records
- (pcase bits
- (`("uuid" ,key) (list (ebdb-gethash key 'uuid)))
- (`(,key) (ebdb-search (ebdb-records) key))
- (`("mail" ,key) (ebdb-search (ebdb-records) nil nil key))
- (`("phone" ,key) (ebdb-search (ebdb-records) nil nil nil nil key))
- (`("address" ,key) (ebdb-search (ebdb-records) nil nil nil nil
nil key))
- (_ 'unknown)))
- (cond
- ((eql records 'unknown) (message "Unknown field prefix: %s" (nth 1
bits)))
- ((null records) (message "No records found"))
- (t (ebdb-display-records records nil nil nil (ebdb-popup-window)))))))
+ (let ((records
+ (pcase (split-string link "/" t)
+ (`("uuid" ,key) (list (ebdb-gethash key 'uuid)))
+ (`(,key) (ebdb-search (ebdb-records) `((ebdb-field-name ,key))))
+ (`("mail" ,key) (ebdb-search (ebdb-records) `((ebdb-field-mail
,key))))
+ (`("phone" ,key) (ebdb-search (ebdb-records) `((ebdb-field-phone
,key))))
+ (`("address" ,key) (ebdb-search (ebdb-records) `((ebdb-field-address
,key))))
+ (`("notes" ,key) (ebdb-search (ebdb-records) `((ebdb-field-notes
,key))))
+ (`("tags" ,key) (ebdb-search (ebdb-records) `((ebdb-org-field-tags
,key))))
+ (`(,(and field (guard (child-of-class-p (intern-soft field)
'ebdb-field))) ,key)
+ (ebdb-search (ebdb-records) `((,(intern-soft field) ,key))))
+ (`(,other ,key) (error "Unknown field search prefix: %s" other)))))
+ (if records
+ (ebdb-display-records records nil nil nil (ebdb-popup-window))
+ (message "No records found"))))
(defun ebdb-org-export (path desc format)
"Create the export version of a EBDB link specified by PATH or DESC.
- [elpa] externals/ebdb 4688493 125/350: Wrap ebdb-parse in save-match-data, (continued)
- [elpa] externals/ebdb 4688493 125/350: Wrap ebdb-parse in save-match-data, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 587ebbc 129/350: Use ebdb-prompt-for-record in org link completion, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 8f82b0f 121/350: Complete changes from ed3e270, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 9edc54f 120/350: Merge snarf branch, basic framework of snarfing in place, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 61b533c 127/350: Simplify ebdb-record-field for strings, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb b610b96 138/350: ebdb-record-search can accept symbols for search type, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb b9da0f4 142/350: Check Organization headers and display/update organization records, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 6fe34b0 145/350: Fix bugs in ebdb-annotate-message, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb f0b0a32 093/350: Fix organization name matching in migration, Eric Abrahamsen, 2017/08/14
- [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 <=
- [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, 2017/08/14
- [elpa] externals/ebdb 548e05d 106/350: Tweaks to MUA interactive commands, Eric Abrahamsen, 2017/08/14