From 942e58e47e6a2924ce8bb3cd6e8367e9932c8c96 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sat, 30 Dec 2023 11:20:22 +0200 Subject: Add gnosis-select-image Prompt user to select image from gnosis-images-dir and return it's path as a string. --- gnosis.el | 9 +++++++++ 1 file changed, 9 insertions(+) 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) -- cgit v1.2.3