summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-02-28 01:54:27 +0200
committerThanos Apollo <[email protected]>2024-02-28 01:54:27 +0200
commit6d6d58a93ea647cca16ec5f9b60ff41058a3dc75 (patch)
tree76766697f49520fe58e66080aa41bbb594dc7b15
parent042079c20223a0075f0a6c53e8f6f59f04872103 (diff)
gnosis-select-images: Refactor
Refactor gnsois-select-images to prompt to select for extra-image as well, returns a cons (image . second-images). This way we won't have to recreate a needless function like gnosis-select-second-image.
-rw-r--r--gnosis.el15
1 files changed, 10 insertions, 5 deletions
diff --git a/gnosis.el b/gnosis.el
index 3b95ba6..43801f9 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -782,15 +782,20 @@ By default, DIR value is `gnosis-images-dir' & REGEX value is \"^[^.]\""
else if (string-match-p regex (file-name-nondirectory path))
collect (list (file-relative-name path dir))))))
-(defun gnosis-select-image (&optional prompt)
+(defun gnosis-select-images (&optional prompt)
"Return PATH for file in `gnosis-images-dir'.
Optionally, add cusotm PROMPT."
- (if (y-or-n-p "Add image?")
+ (if (y-or-n-p "Include images?")
(let* ((prompt (or prompt "Select image: "))
- (image (funcall gnosis-completing-read-function prompt
- (cons nil (gnosis-directory-files gnosis-images-dir)))))
- (if (string= image "nil") nil image))
+ (image (if (y-or-n-p "Add review image?")
+ (funcall gnosis-completing-read-function prompt
+ (cons nil (gnosis-directory-files gnosis-images-dir)))
+ nil))
+ (extra-image (if (y-or-n-p "Add post review image?")
+ (funcall gnosis-completing-read-function prompt
+ (cons nil (gnosis-directory-files gnosis-images-dir))))))
+ (cons image extra-image))
nil))
(defun gnosis-get-tags--unique ()