branch: externals/ebdb
commit 5726c97426ddef356f099e70ccdb0a2df8f9d3ab
Author: Eric Abrahamsen <[email protected]>
Commit: Eric Abrahamsen <[email protected]>
Add a ebdb-fmt-field implementation for images
* ebdb-com.el (ebdb-fmt-field): This used to be hard-coded.
---
ebdb-com.el | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/ebdb-com.el b/ebdb-com.el
index bf98178..2a9c95a 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -642,6 +642,21 @@ Print the first line, add an ellipsis, and add a tooltip."
(propertize value 'face 'ebdb-role-defunct)
value))))
+(cl-defmethod ebdb-fmt-field ((_fmt ebdb-formatter-ebdb)
+ (field ebdb-field-image)
+ _style
+ (record ebdb-record))
+ (if (display-images-p)
+ (progn
+ (require 'image)
+ (propertize
+ " "
+ ;; Cribbed from `insert-image'.
+ (list 'display (ebdb-field-image-get field record)
+ 'rear-nonsticky '(display)
+ 'keymap image-map)))
+ "<img>"))
+
(defsubst ebdb-indent-string (string column)
"Indent nonempty lines in STRING to COLUMN (except first line).
This happens in addition to any pre-defined indentation of STRING."