summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-02-28 00:27:42 +0200
committerThanos Apollo <[email protected]>2024-02-28 00:27:42 +0200
commitaa3c2f8f5815f01da1f2d6ce50c7dc6d24beb075 (patch)
treed9142fa1b8cdbe5bc8721ef1175fa90677f0337b /gnosis.el
parent6ee271486b9a2c1467434bf6c23cb804f905a0f2 (diff)
gnosis-display-image: Refactor
gnosis-display-image now takes image to display as argument. This should allow gnosis-display-image to be used with extra-image
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el14
1 files changed, 11 insertions, 3 deletions
diff --git a/gnosis.el b/gnosis.el
index b89a5e2..b1527f0 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -333,9 +333,17 @@ If FALSE t, use gnosis-face-false face"
(insert (propertize "\n\n-----\n" 'face 'gnosis-face-seperator))
(fill-paragraph (insert "\n" (propertize extras 'face 'gnosis-face-extra)))))
-(defun gnosis-display-image (id)
- "Display image for note ID."
- (let* ((img (gnosis-get 'images 'extras `(= id ,id)))
+(cl-defun gnosis-display-image (id &optional (image 'images))
+ "Display image for note ID.
+
+IMAGE is the image type to display, should be either `images' or
+`extra-image'.
+
+`images' is the image to display before user-input, while
+`extra-image' is the image to display after user-input.
+
+Refer to `gnosis-db-schema-extras' for more."
+ (let* ((img (gnosis-get image 'extras `(= id ,id)))
(path-to-image (expand-file-name (or img "") (file-name-as-directory gnosis-images-dir)))
(image (create-image path-to-image 'png nil :width gnosis-image-width :height gnosis-image-height)))
(when img