summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-12-30 11:20:22 +0200
committerThanos Apollo <[email protected]>2023-12-30 11:20:22 +0200
commit942e58e47e6a2924ce8bb3cd6e8367e9932c8c96 (patch)
treeba4952316f12a24cd05b88ace100c6c85bda974a /gnosis.el
parent9bd366ef4e33a70d205003e06cf92c6af3832b7c (diff)
Add gnosis-select-image
Prompt user to select image from gnosis-images-dir and return it's path as a string.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index 44e7100..0eef228 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -474,6 +474,15 @@ By default, DIR value is `gnosis-images-dir' & REGEX value is \"^[^.]\""
(gnosis-directory-files path regex))
else if (string-match-p regex (file-name-nondirectory path))
collect (list (file-relative-name path dir))))))
+
+(defun gnosis-select-image (&optional prompt)
+ "Return PATH for file in `gnosis-images-dir'.
+
+Optionally, add cusotm PROMPT."
+ (let* ((prompt (or prompt "Select image: "))
+ (image (completing-read prompt (gnosis-directory-files gnosis-images-dir))))
+ image))
+
(defun gnosis-get-tags--unique ()
"Return a list of unique strings for tags in gnosis-db."
(cl-loop for tags in (gnosis-select 'tags 'notes)