From 4725416fbdfe0044417f83a23b808e7f8bf3682b Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sat, 25 Mar 2023 01:43:11 +0700 Subject: [PATCH] Use shortcut keybindings in buffer to ease sending messages to Khoj --- src/interface/emacs/khoj.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/interface/emacs/khoj.el b/src/interface/emacs/khoj.el index cd1bac6a..32b4236c 100644 --- a/src/interface/emacs/khoj.el +++ b/src/interface/emacs/khoj.el @@ -134,7 +134,7 @@ NO-PAGING FILTER)) "C-x M | music\n")))) (defvar khoj--rerank nil "Track when re-rank of results triggered.") -(defvar khoj--reference-count 0 "Track number of references current inserted into chat bufffer.") +(defvar khoj--reference-count 0 "Track number of references currently in chat bufffer.") (defun khoj--search-markdown () "Set content-type to `markdown'." (interactive) (setq khoj--content-type "markdown")) (defun khoj--search-org () "Set content-type to `org-mode'." (interactive) (setq khoj--content-type "org")) (defun khoj--search-ledger () "Set content-type to `ledger'." (interactive) (setq khoj--content-type "ledger")) @@ -336,6 +336,7 @@ Render results in BUFFER-NAME using QUERY, CONTENT-TYPE." (defun khoj--chat () "Chat with Khoj." + (interactive) (when (not (get-buffer khoj--chat-buffer-name)) (khoj--load-chat-history khoj--chat-buffer-name)) (switch-to-buffer khoj--chat-buffer-name) @@ -359,6 +360,9 @@ Render results in BUFFER-NAME using QUERY, CONTENT-TYPE." (progn (org-mode) (visual-line-mode) (khoj--add-hover-text-to-footnote-refs (point-min)) + (use-local-map (copy-keymap org-mode-map)) + (local-set-key (kbd "m") #'khoj--chat) + (local-set-key (kbd "C-x m") #'khoj--chat) (read-only-mode t))))) (defun khoj--add-hover-text-to-footnote-refs (start-pos)