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

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

[elpa] externals/ebdb 7a19553 06/13: Shift base ebdb-fmt-record implemen


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 7a19553 06/13: Shift base ebdb-fmt-record implementation to ebdb-formatter-freeform
Date: Tue, 15 Jan 2019 11:15:51 -0500 (EST)

branch: externals/ebdb
commit 7a195530ade609e04122738dd68b4a3c0c148ff1
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Shift base ebdb-fmt-record implementation to ebdb-formatter-freeform
    
    * ebdb-com.el (ebdb-fmt-record): This behavior is common to most
      freeform formatters.
    * ebdb-format.el (ebdb-fmt-record): So define it here.
---
 ebdb-com.el    | 23 +----------------------
 ebdb-format.el | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/ebdb-com.el b/ebdb-com.el
index 32e5bad..65b49ca 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -671,28 +671,7 @@ Print the first line, add an ellipsis, and add a tooltip."
 
 (cl-defmethod ebdb-fmt-record ((fmt ebdb-formatter-ebdb)
                               (record ebdb-record))
-  (pcase-let* ((header-classes (cdr (assoc (eieio-object-class-name record)
-                                          (slot-value fmt 'header))))
-              ((map header-fields body-fields)
-               (seq-group-by
-                (lambda (f)
-                  ;; FIXME: Consider doing the header/body split in
-                  ;; `ebdb-fmt-process-fields', we've already got the
-                  ;; formatter there.
-                  (if (ebdb-foo-in-list-p (alist-get 'class f)
-                                          header-classes)
-                      'header-fields
-                    'body-fields))
-                (ebdb-fmt-process-fields
-                 fmt record
-                 (ebdb-fmt-sort-fields
-                  fmt record
-                  (ebdb-fmt-collect-fields
-                   fmt record))))))
-    (concat
-     (ebdb-fmt-record-header fmt record header-fields)
-     (ebdb-fmt-compose-fields fmt record body-fields 1)
-     "\n")))
+  (concat (cl-call-next-method) "\n"))
 
 (cl-defmethod ebdb-fmt-record-header ((fmt ebdb-formatter-ebdb)
                                      (record ebdb-record)
diff --git a/ebdb-format.el b/ebdb-format.el
index 4435512..8de3f1a 100644
--- a/ebdb-format.el
+++ b/ebdb-format.el
@@ -398,6 +398,30 @@ multiple instances in a single alist."
                outlist)))
       (nreverse outlist))))
 
+(cl-defmethod ebdb-fmt-record ((fmt ebdb-formatter-freeform)
+                              (record ebdb-record))
+  (pcase-let* ((header-classes (cdr (assoc (eieio-object-class-name record)
+                                          (slot-value fmt 'header))))
+              ((map header-fields body-fields)
+               (seq-group-by
+                (lambda (f)
+                  ;; FIXME: Consider doing the header/body split in
+                  ;; `ebdb-fmt-process-fields', we've already got the
+                  ;; formatter there.
+                  (if (ebdb-foo-in-list-p (alist-get 'class f)
+                                          header-classes)
+                      'header-fields
+                    'body-fields))
+                (ebdb-fmt-process-fields
+                 fmt record
+                 (ebdb-fmt-sort-fields
+                  fmt record
+                  (ebdb-fmt-collect-fields
+                   fmt record))))))
+    (concat
+     (ebdb-fmt-record-header fmt record header-fields)
+     (ebdb-fmt-compose-fields fmt record body-fields 1))))
+
 ;; Tabular formatting
 
 (cl-defmethod ebdb-fmt-record ((fmt ebdb-formatter-tabular)



reply via email to

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