summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-04-10 23:16:44 +0300
committerThanos Apollo <[email protected]>2024-04-10 23:16:44 +0300
commit4afb569b3c328b7b445a8eb50fce71c8d4833ed0 (patch)
treeec45c96522e1c1ca57dc7824f6b48c3891faf3a5 /gnosis.el
parent11b15d260b55603de73eb03f9a4d292dc2fc3ce2 (diff)
[fix] gnosis-display-image: Adjust for empty strings
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el17
1 files changed, 8 insertions, 9 deletions
diff --git a/gnosis.el b/gnosis.el
index 5f3648b..5a3bb0c 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -373,19 +373,18 @@ If FALSE t, use gnosis-face-false face"
"Display image for note ID.
IMAGE is the image type to display, usually should be either `images'
-or `extra-image'. Instead of using `extra-image' on review use
-`gnosis-display-extra'
+or `extra-image'. Instead of using `extra-image' post review, prefer
+`gnosis-display-extra' which displays the `extra-image' as well.
-`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."
+Refer to `gnosis-db-schema-extras' for informations on images stored."
(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
- (insert "\n\n")
- (insert-image image))))
+ (cond ((and img (file-exists-p path-to-image))
+ (insert "\n\n")
+ (insert-image image))
+ ((or (not img) (string-empty-p img))
+ (insert "\n\n")))))
(defun gnosis-display-extra (id)
"Display extra information & extra-image for note ID."