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

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

[elpa] externals/ebdb 81e23c3 134/350: Simplify record mail citing


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 81e23c3 134/350: Simplify record mail citing
Date: Mon, 14 Aug 2017 11:46:21 -0400 (EDT)

branch: externals/ebdb
commit 81e23c3b5d58bcf8adabf30b6994b64808fcdc92
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Simplify record mail citing
    
    * ebdb.el (ebdb-records-cite-mail): The inline version is the same, we
      only need one :around method. And, instead of checking if records is
      non-nil, just use a list specializer for the records argument.
---
 ebdb.el | 37 ++++++++++++++-----------------------
 1 file changed, 14 insertions(+), 23 deletions(-)

diff --git a/ebdb.el b/ebdb.el
index 677a504..edbe275 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -4497,21 +4497,14 @@ This is a generic function that dispatches on the value 
of
                 (format "- %s" elt))
               list "\n")))
 
-(cl-defmethod ebdb-records-cite-mail :around ((style (eql inline))
-                                             (records list)
-                                             &context (major-mode org-mode))
-  (let ((list (cl-call-next-method)))
-    (mapconcat #'identity list " ")))
-
 (cl-defmethod ebdb-records-cite-mail
-    (_style records &context (major-mode org-mode))
+    (_style (records list) &context (major-mode org-mode))
   "Insert RECORDS as a list of org links."
-  (when records
-    (mapcar (lambda (pair)
-                (format "[[mailto:%s][%s]]";
-                        (slot-value (cdr pair) 'mail)
-                        (ebdb-string (car pair))))
-              records)))
+  (mapcar (lambda (pair)
+           (format "[[mailto:%s][%s]]";
+                   (slot-value (cdr pair) 'mail)
+                   (ebdb-string (car pair))))
+         records))
 
 (cl-defmethod ebdb-records-cite-mail :around ((style (eql list))
                                              (records list)
@@ -4522,20 +4515,18 @@ This is a generic function that dispatches on the value 
of
               list "\n")))
 
 (cl-defmethod ebdb-records-cite-mail :around ((style (eql inline))
-                                             (records list)
-                                             &context (major-mode html-mode))
+                                             (records list))
   (let ((list (cl-call-next-method)))
     (mapconcat #'identity list " ")))
 
 (cl-defmethod ebdb-records-cite-mail
-    (style records &context (major-mode html-mode))
-  (when records
-    (mapcar
-     (lambda (pair)
-       (format "<a href=\"mailto:%s>%s</a>"
-              (slot-value (cdr pair) 'mail)
-              (ebdb-string (car pair))))
-     records)))
+    (_style (records list) &context (major-mode html-mode))
+  (mapcar
+   (lambda (pair)
+     (format "<a href=\"mailto:%s>%s</a>"
+            (slot-value (cdr pair) 'mail)
+            (ebdb-string (car pair))))
+   records))
 
 
 ;;; Loading and saving EBDB



reply via email to

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