mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 05:39:13 +00:00
Allow switching search type in the middle of querying Khoj on Emacs
- More generally, this allows configuring the khoj search anytime while in khoj minibuffer window - Earlier could only configure search type at the start of the search
This commit is contained in:
@@ -243,8 +243,6 @@
|
|||||||
(let* ((khoj-buffer-name (get-buffer-create khoj--buffer-name)))
|
(let* ((khoj-buffer-name (get-buffer-create khoj--buffer-name)))
|
||||||
;; set khoj search type to last used or based on current buffer
|
;; set khoj search type to last used or based on current buffer
|
||||||
(setq khoj--search-type (or khoj--search-type (khoj--buffer-name-to-search-type (buffer-name))))
|
(setq khoj--search-type (or khoj--search-type (khoj--buffer-name-to-search-type (buffer-name))))
|
||||||
;; setup temporary keymap for khoj
|
|
||||||
(set-transient-map (khoj--search-keymap) t)
|
|
||||||
;; setup rerank to improve results once user idle for KHOJ--RERANK-AFTER-IDLE-TIME seconds
|
;; setup rerank to improve results once user idle for KHOJ--RERANK-AFTER-IDLE-TIME seconds
|
||||||
(setq khoj--rerank-timer (run-with-idle-timer khoj--rerank-after-idle-time t 'khoj--incremental-search t))
|
(setq khoj--rerank-timer (run-with-idle-timer khoj--rerank-after-idle-time t 'khoj--incremental-search t))
|
||||||
;; switch to khoj results buffer
|
;; switch to khoj results buffer
|
||||||
@@ -252,6 +250,8 @@
|
|||||||
;; open and setup minibuffer for incremental search
|
;; open and setup minibuffer for incremental search
|
||||||
(minibuffer-with-setup-hook
|
(minibuffer-with-setup-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
;; Add khoj keybindings for configuring search to minibuffer keybindings
|
||||||
|
(khoj--make-search-keymap minibuffer-local-map)
|
||||||
;; set current (mini-)buffer entered as khoj minibuffer
|
;; set current (mini-)buffer entered as khoj minibuffer
|
||||||
;; used to query khoj API only when user in khoj minibuffer
|
;; used to query khoj API only when user in khoj minibuffer
|
||||||
(setq khoj--minibuffer-window (current-buffer))
|
(setq khoj--minibuffer-window (current-buffer))
|
||||||
|
|||||||
Reference in New Issue
Block a user