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