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

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

[elpa] externals/ebdb dc5d03e 01/21: Change behavior of ebdb-fmt-compose


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb dc5d03e 01/21: Change behavior of ebdb-fmt-compose-field
Date: Sun, 17 Sep 2017 15:32:45 -0400 (EDT)

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

    Change behavior of ebdb-fmt-compose-field
    
    * ebdb-format.el (ebdb-fmt-compose-field): This function should not
      mapconcat the field-instance strings, that should be up to the
      formatter.
    * ebdb-com.el (ebdb-fmt-record-header, ebdb-fmt-record-body): Handle
      the new return value.
---
 ebdb-com.el    | 26 +++++++++++++++-----------
 ebdb-format.el | 12 ++++++------
 2 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/ebdb-com.el b/ebdb-com.el
index a6f0407..43723ea 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -515,21 +515,22 @@ This happens in addition to any pre-defined indentation 
of STRING."
         ;; they're not displayed yet!  How do we resolve this...?
         (fill-column (window-text-width))
         (fill-prefix (make-string (+ 5 indent) ?\s))
-        (paragraph-start "[^:]+:[^\n]+$"))
+        (paragraph-start "[^:]+:[^\n]+$")
+        field-string)
 
     (dolist (c field-list)
       (insert (format label-fmt (car c)))
       (put-text-property (line-beginning-position) (point) 'face 'ebdb-label)
-      (insert
-       (concat
-       ": "
-       ;; If I understood the mechanics of filling better, I
-       ;; could probably do away with `ebdb-indent-string'
-       ;; altogether.
-       (ebdb-indent-string (cdr c) (+ indent 5))))
+      (insert (setq field-string
+                   (concat
+                    ": "
+                    ;; If I understood the mechanics of filling better, I
+                    ;; could probably do away with `ebdb-indent-string'
+                    ;; altogether.
+                    (ebdb-indent-string (mapconcat #'identity (cdr c) ", ") (+ 
indent 5)))))
       ;; If there are newlines in the value string, assume the field
       ;; knows what's it's doing re filling and formatting.
-      (unless (or (string-match-p "\n" (cdr c))
+      (unless (or (string-match-p "\n" field-string)
                  (null ebdb-fill-field-values))
        (fill-paragraph))
       (insert "\n"))))
@@ -538,7 +539,10 @@ This happens in addition to any pre-defined indentation of 
STRING."
                                    (_record ebdb-record)
                                    (field-list list))
   (insert " ")
-  (insert (mapconcat #'cdr field-list ", ")))
+  (insert (mapconcat (lambda (elt)
+                      (mapconcat #'identity
+                                 (cdr elt) " "))
+                    field-list ", ")))
 
 (cl-defmethod ebdb-fmt-record-header ((_fmt ebdb-formatter-ebdb)
                                      (record ebdb-record)
@@ -571,7 +575,7 @@ This happens in addition to any pre-defined indentation of 
STRING."
        ;; differently.  Conveniently, this also allows us to always
        ;; keep the image at the end of the header.
        (unless (eql (plist-get f :class) 'ebdb-field-image)
-         (cdr f)))
+         (mapconcat #'identity (cdr f) " ")))
       field-list
       ", "))
     ;; TODO: Check if image is in field-list, not if it exists!
diff --git a/ebdb-format.el b/ebdb-format.el
index 46726e1..47b4f48 100644
--- a/ebdb-format.el
+++ b/ebdb-format.el
@@ -162,22 +162,22 @@ The FIELD-PLIST structure is that returned by
 `ebdb-fmt-collect-fields'.  It is a plist with three
 keys: :class, :style, and :inst.
 
-This function passes the class and field instances to FMT,
-which formats them appropriately."
+This function passes the class and field instances to FMT, which
+formats them appropriately, and returns a list of (LABEL
+FIELD-STRING1 FIELD-STRING2 ..)."
   (let* ((style (plist-get field-plist :style))
         (inst (plist-get field-plist :inst))
         (label (ebdb-fmt-field-label fmt
                                      (if (= 1 (length inst))
                                          (car inst)
-                                      (plist-get field-plist :class))
+                                       (plist-get field-plist :class))
                                      style
                                      record)))
     (cons label
-         (mapconcat
+         (mapcar
           (lambda (f)
             (ebdb-fmt-field fmt f style record))
-          inst
-          ", "))))
+          inst))))
 
 (cl-defmethod ebdb-fmt-field-label ((_fmt ebdb-formatter)
                                    (cls (subclass ebdb-field))



reply via email to

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