branch: externals/ebdb
commit 3cba3d7405127169034d226aad95dc21654fbffc
Author: Eric Abrahamsen <[email protected]>
Commit: Eric Abrahamsen <[email protected]>
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.