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

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

[elpa] externals/ebdb 980927f 02/13: Switch from cond to pcase in ebdb-r


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 980927f 02/13: Switch from cond to pcase in ebdb-record-field
Date: Tue, 15 Jan 2019 11:15:50 -0500 (EST)

branch: externals/ebdb
commit 980927ff3dfdb238e7b168f0088353fec29db86e
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Switch from cond to pcase in ebdb-record-field
    
    * ebdb.el (ebdb-record-field): Preparatory to making this method more
      interesting.
---
 ebdb.el | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/ebdb.el b/ebdb.el
index 3e2e6b1..bfd8dcf 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -4836,21 +4836,22 @@ also be one of the special symbols below.
 
 (cl-defmethod ebdb-record-field ((record ebdb-record)
                                 (field symbol))
-  (cond ((eq field 'firstname) (ebdb-record-firstname record))
-       ((eq field 'lastname) (ebdb-record-lastname record))
-       ((eq field 'affix)    (slot-value (slot-value record 'name) 'affix))
-       ((eq field 'mail-canon) (ebdb-record-mail-canon record)) ; derived 
(cached) field
-       ;; Mail is special-cased, because mail addresses can come from
-       ;; more than one slot.
-       ((eq field 'mail) (ebdb-record-mail record nil nil t))
-       ((eq field 'mail-aka) (ebdb-record-mail-aka record)) ; derived (cached) 
field
-       ((eq field 'aka-all)  (append (ebdb-record-aka record) ; derived field
-                                     (ebdb-record-mail-aka record)))
-       ;; Otherwise assume it is a valid slot name.
-       (t
-        (when (and (slot-exists-p record field)
-                   (slot-boundp record field))
-          (slot-value record field)))))
+  (pcase field
+    ('firstname (ebdb-record-firstname record))
+    ('lastname (ebdb-record-lastname record))
+    ('affix    (slot-value (slot-value record 'name) 'affix))
+    ('mail-canon (ebdb-record-mail-canon record)) ; derived (cached) field
+    ;; Mail is special-cased, because mail addresses can come from
+    ;; more than one slot.
+    ('mail (ebdb-record-mail record nil nil t))
+    ('mail-aka (ebdb-record-mail-aka record)) ; derived (cached) field
+    ('aka-all  (append (ebdb-record-aka record) ; derived field
+                      (ebdb-record-mail-aka record)))
+    ;; Otherwise assume it is a valid slot name.
+    (_
+     (when (and (slot-exists-p record field)
+               (slot-boundp record field))
+       (slot-value record field)))))
 
 (cl-defmethod ebdb-record-field ((record ebdb-record)
                                 (f-class (subclass ebdb-field-user)))



reply via email to

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