emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ebdb 0904c14 281/350: Split ebdb-org-open into two func


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 0904c14 281/350: Split ebdb-org-open into two functions
Date: Mon, 14 Aug 2017 11:46:54 -0400 (EDT)

branch: externals/ebdb
commit 0904c1441e002828bb2bee9df5204631cad3c6b5
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Split ebdb-org-open into two functions
    
    * ebdb-org.el (ebdb-org-retrieve): New function only parses an Org
      link and retrieves the matching records (doesn't display them).
      (ebdb-org-open): This function now only calls `ebdb-org-retrieve'
      and displays the results.
---
 ebdb-org.el | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/ebdb-org.el b/ebdb-org.el
index ea7697a..9489196 100644
--- a/ebdb-org.el
+++ b/ebdb-org.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2016-2017  Free Software Foundation, Inc.
 
 ;; Author: Eric Abrahamsen <address@hidden>
-;; Keywords: 
+;; Keywords:
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -84,22 +84,24 @@
 
 (defun ebdb-org-open (link)
   "Follow a EBDB link."
-  (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 _) (error "Unknown field search prefix: %s" other)))))
+  (let ((records (ebdb-org-retrieve link)))
     (if records
        (ebdb-display-records records nil nil nil (ebdb-popup-window))
       (message "No records found"))))
 
+(defun ebdb-org-retrieve (link)
+  (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 _) (error "Unknown field search prefix: %s" other))))
+
 (defun ebdb-org-export (path desc format)
   "Create the export version of a EBDB link specified by PATH or DESC.
 If exporting to either HTML or LaTeX FORMAT the link will be



reply via email to

[Prev in Thread] Current Thread [Next in Thread]