From aa3c2f8f5815f01da1f2d6ce50c7dc6d24beb075 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 28 Feb 2024 00:27:42 +0200 Subject: 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 --- gnosis.el | 14 +++++++++++--- 1 file 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 -- cgit v1.2.3