mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 13:23:15 +00:00
Set Query as Heading of Image Search Results Emacs Buffer
This commit is contained in:
@@ -56,13 +56,14 @@
|
|||||||
(lambda (args) (format "%s" (cdr (assoc 'Entry args))))
|
(lambda (args) (format "%s" (cdr (assoc 'Entry args))))
|
||||||
json-response))))
|
json-response))))
|
||||||
|
|
||||||
(defun semantic-search--extract-entries-as-images (json-response)
|
(defun semantic-search--extract-entries-as-images (json-response query)
|
||||||
"Convert json response from API to org-mode entries with images"
|
"Convert json response from API to org-mode entries with images"
|
||||||
;; remove leading (, ) or SPC from extracted entries string
|
;; remove leading (, ) or SPC from extracted entries string
|
||||||
(replace-regexp-in-string
|
(replace-regexp-in-string
|
||||||
"^[\(\) ]" ""
|
"^[\(\) ]" ""
|
||||||
;; extract entries from response as single string and convert to entries
|
;; extract entries from response as single string and convert to entries
|
||||||
(format "* Results \n%s"
|
(format "* %s \n%s"
|
||||||
|
query
|
||||||
(mapcar
|
(mapcar
|
||||||
(lambda (args) (format "\n** \n [[%s]]" (cdr (assoc 'Entry args))))
|
(lambda (args) (format "\n** \n [[%s]]" (cdr (assoc 'Entry args))))
|
||||||
json-response))))
|
json-response))))
|
||||||
@@ -111,7 +112,7 @@
|
|||||||
(insert
|
(insert
|
||||||
(cond ((or (equal search-type "notes") (equal search-type "music")) (semantic-search--extract-entries-as-org json-response))
|
(cond ((or (equal search-type "notes") (equal search-type "music")) (semantic-search--extract-entries-as-org json-response))
|
||||||
((equal search-type "ledger") (semantic-search--extract-entries-as-ledger json-response))
|
((equal search-type "ledger") (semantic-search--extract-entries-as-ledger json-response))
|
||||||
((equal search-type "image") (semantic-search--extract-entries-as-images json-response))
|
((equal search-type "image") (semantic-search--extract-entries-as-images json-response query))
|
||||||
(t (format "%s" json-response)))))
|
(t (format "%s" json-response)))))
|
||||||
(cond ((equal search-type "notes") (org-mode))
|
(cond ((equal search-type "notes") (org-mode))
|
||||||
((equal search-type "music") (progn (org-mode)
|
((equal search-type "music") (progn (org-mode)
|
||||||
|
|||||||
Reference in New Issue
Block a user