Show complete Khoj keybindings when initiate search in Emacs

- The keybindings to select search types was previously confusing as
  it only highlighted the final symbol to press (the C-x was shown but
  it wasn't made apparent that it had to be pressed before)

- Previously some keybindings unrelated to khoj were also being shown
  in the which-key popup. Now only the khoj keybindings are visible
This commit is contained in:
Debanjum Singh Solanky
2022-08-06 16:27:23 +03:00
parent 4696eadc02
commit e95686c89c

View File

@@ -95,12 +95,9 @@ C-x i | images
(defun khoj--display-keybinding-info ()
"Display information on keybindings to customize khoj search.
Use `which-key` if available, else display simple message in echo area"
(if (fboundp 'which-key--create-buffer-and-show)
(which-key--create-buffer-and-show
(kbd "C-x")
(symbolp (khoj--make-search-keymap))
'(lambda (binding) (string-prefix-p "khoj--" (cdr binding)))
"Khoj Bindings")
(if (fboundp 'which-key-show-full-keymap)
(let ((khoj--keymap (khoj--make-search-keymap)))
(which-key-show-full-keymap 'khoj--keymap))
(message "%s" khoj--keybindings-info-message)))
(defun khoj--extract-entries-as-markdown (json-response query)
@@ -262,6 +259,7 @@ Use `which-key` if available, else display simple message in echo area"
(defun khoj--minibuffer-exit-advice (&rest _args)
(khoj--incremental-search t))
;;;###autoload
(defun khoj ()
"Natural, Incremental Search for your personal notes, transactions and music using Khoj"