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

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

[elpa] externals/ebdb 3cba3d7 01/13: Rejigger insertion of newlines in r


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 3cba3d7 01/13: Rejigger insertion of newlines in record formatting
Date: Tue, 15 Jan 2019 11:15:50 -0500 (EST)

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

    Rejigger insertion of newlines in record formatting
    
    * ebdb-com.el (ebdb-fmt-record, ebdb-fmt-record-header,
      ebdb-fmt-compose-fields): Fairly classic error re making sure there
      are always newlines in the right place.
---
 ebdb-com.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/ebdb-com.el b/ebdb-com.el
index 471786b..82c42f9 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -688,7 +688,8 @@ Print the first line, add an ellipsis, and add a tooltip."
                    fmt record))))))
     (concat
      (ebdb-fmt-record-header fmt record header-fields)
-     (ebdb-fmt-compose-fields fmt record body-fields 1))))
+     (ebdb-fmt-compose-fields fmt record body-fields 1)
+     "\n")))
 
 (cl-defmethod ebdb-fmt-record-header ((fmt ebdb-formatter-ebdb)
                                      (record ebdb-record)
@@ -716,6 +717,11 @@ Print the first line, add an ellipsis, and add a tooltip."
                               inst " "))
                  header-fields " "))))))
 
+(cl-defmethod ebdb-fmt-record-header :around ((fmt 
ebdb-formatter-ebdb-multiline)
+                                             (record ebdb-record)
+                                             &optional header-fields)
+  (concat (cl-call-next-method) "\n"))
+
 (cl-defmethod ebdb-fmt-compose-fields ((fmt ebdb-formatter-ebdb-multiline)
                                       (record ebdb-record)
                                       &optional
@@ -760,7 +766,6 @@ string."
           (fill-column (window-body-width)))
       (with-current-buffer (get-buffer-create "format test")
        (erase-buffer)
-       (insert "\n")
        (mapc
         (pcase-lambda (`(,label . ,fields))
           (let ((start (point)))
@@ -784,7 +789,6 @@ string."
              (when ebdb-fill-field-values
                (fill-region start (point))))))
         field-pairs)
-       (insert "\n")
        (buffer-string)))))
 
 (cl-defmethod ebdb-fmt-compose-fields ((fmt ebdb-formatter-ebdb-oneline)
@@ -797,8 +801,7 @@ string."
       (mapconcat (pcase-lambda ((map inst style))
                   (mapconcat (lambda (f) (ebdb-fmt-field fmt f style record))
                              inst " "))
-                field-list ", ")))
-   "\n"))
+                field-list ", ")))))
 
 (cl-defgeneric ebdb-make-buffer-name (&context (major-mode t))
   "Return the buffer to be used by EBDB.



reply via email to

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