From 5f446b1440775063349630aea3896ff0fb5b0dfe Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Wed, 18 Jan 2023 20:59:19 -0300 Subject: [PATCH 1/8] Convert main khoj.el entrypoint into transient menu for richer configuration --- src/interface/emacs/khoj.el | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/interface/emacs/khoj.el b/src/interface/emacs/khoj.el index 33948c7b..18452c15 100644 --- a/src/interface/emacs/khoj.el +++ b/src/interface/emacs/khoj.el @@ -6,7 +6,7 @@ ;; Description: Natural, Incremental Search for your Second Brain ;; Keywords: search, org-mode, outlines, markdown, beancount, ledger, image ;; Version: 0.2.2 -;; Package-Requires: ((emacs "27.1")) +;; Package-Requires: ((emacs "27.1") (transient "0.3.0")) ;; URL: https://github.com/debanjum/khoj/tree/master/src/interface/emacs ;; This file is NOT part of GNU Emacs. @@ -48,6 +48,7 @@ (require 'url) (require 'json) +(require 'transient) (defcustom khoj-server-url "http://localhost:8000" "Location of Khoj API server." @@ -332,14 +333,10 @@ Render results in BUFFER-NAME." (remove-hook 'post-command-hook #'khoj--incremental-search) (remove-hook 'minibuffer-exit-hook #'khoj--teardown-incremental-search)) - -;;;###autoload -(defun khoj () +(defun khoj-incremental () "Natural, Incremental Search for your personal notes, transactions and music." (interactive) (let* ((khoj-buffer-name (get-buffer-create khoj--buffer-name))) - ;; 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)))) ;; switch to khoj results buffer (switch-to-buffer khoj-buffer-name) ;; open and setup minibuffer for incremental search @@ -356,6 +353,32 @@ Render results in BUFFER-NAME." (add-hook 'minibuffer-exit-hook #'khoj--teardown-incremental-search)) ; teardown khoj incremental search on minibuffer exit (read-string khoj--query-prompt)))) +(transient-define-argument khoj--content-type-switch () + :class 'transient-switches + :argument-format "--content-type=%s" + :argument-regexp ".+" + ;; set content type to last used or based on current buffer or to default + :init-value (lambda (obj) (oset obj value (format "--content-type=%s" (or khoj--search-type (khoj--buffer-name-to-search-type (buffer-name)))))) + :choices '("org" "markdown" "ledger" "music" "image")) + +(transient-define-suffix khoj--search (&optional args) + (interactive (list (transient-args transient-current-command))) + (progn + ;; set search type to last used or based on current buffer or to default + (setq khoj--search-type (or (transient-arg-value "--content-type=" args) (khoj--buffer-name-to-search-type (buffer-name)))) + ;; set results count to last used or to default + (setq khoj-results-count (or (transient-arg-value "--results-count=" args) khoj-results-count)) + ;; trigger incremental search + (call-interactively #'khoj-incremental))) + + +;;;###autoload +(transient-define-prefix khoj () + [["Set" + ("t" "Content Type" khoj--content-type-switch) + ("n" "Results Count" "--results-count=" :init-value (lambda (obj) (oset obj value (format "%s" khoj-results-count))))]] + [["Act" ("s" "Search" khoj--search)]]) + ;;;###autoload (defun khoj-simple (query) "Natural Search for QUERY on your personal notes, transactions, music and images." From 216b17cfd0d4e3db830e1fa3ed0b1660d5fa0842 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Wed, 18 Jan 2023 22:00:12 -0300 Subject: [PATCH 2/8] Dynamically populate content type choices when khoj transient invoked --- src/interface/emacs/khoj.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/interface/emacs/khoj.el b/src/interface/emacs/khoj.el index 18452c15..138c05c7 100644 --- a/src/interface/emacs/khoj.el +++ b/src/interface/emacs/khoj.el @@ -359,7 +359,8 @@ Render results in BUFFER-NAME." :argument-regexp ".+" ;; set content type to last used or based on current buffer or to default :init-value (lambda (obj) (oset obj value (format "--content-type=%s" (or khoj--search-type (khoj--buffer-name-to-search-type (buffer-name)))))) - :choices '("org" "markdown" "ledger" "music" "image")) + ;; dynamically set choices to content types enabled on khoj backend + :choices (mapcar #'symbol-name (khoj--get-enabled-content-types))) (transient-define-suffix khoj--search (&optional args) (interactive (list (transient-args transient-current-command))) From 00daea16dfdc29f68db70d9b2c38477f588dfeaf Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Wed, 18 Jan 2023 22:01:17 -0300 Subject: [PATCH 3/8] Allow setting default-search-type to image. Make docstrings compact --- src/interface/emacs/khoj.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/interface/emacs/khoj.el b/src/interface/emacs/khoj.el index 138c05c7..5da0bac6 100644 --- a/src/interface/emacs/khoj.el +++ b/src/interface/emacs/khoj.el @@ -76,13 +76,14 @@ :type '(choice (const "org") (const "markdown") (const "ledger") + (const "image") (const "music"))) (defvar khoj--minibuffer-window nil - "Minibuffer window being used by user to enter query.") + "Minibuffer window used to enter query.") (defconst khoj--query-prompt "🦅Khoj: " - "Query prompt shown to user in the minibuffer.") + "Query prompt shown in the minibuffer.") (defconst khoj--buffer-name "*🦅Khoj*" "Name of buffer to show results from Khoj.") @@ -97,7 +98,7 @@ NO-PAGING FILTER)) (defun khoj--keybindings-info-message () - "Show available khoj keybindings in-context, when user invokes Khoj." + "Show available khoj keybindings in-context, when khoj invoked." (let ((enabled-content-types (khoj--get-enabled-content-types))) (concat " @@ -110,7 +111,7 @@ NO-PAGING FILTER)) (when (member 'ledger enabled-content-types) "C-x l | ledger\n") (when (member 'image enabled-content-types) - "C-x i | images\n") + "C-x i | image\n") (when (member 'music enabled-content-types) "C-x M | music\n")))) From a8d0c7d90514f1e380cae5345800d63a8e43193b Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Wed, 18 Jan 2023 22:13:49 -0300 Subject: [PATCH 4/8] Rename search type to more apt content type in khoj.el --- src/interface/emacs/khoj.el | 70 ++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/interface/emacs/khoj.el b/src/interface/emacs/khoj.el index 5da0bac6..6323c051 100644 --- a/src/interface/emacs/khoj.el +++ b/src/interface/emacs/khoj.el @@ -70,7 +70,7 @@ :group 'khoj :type 'integer) -(defcustom khoj-default-search-type "org" +(defcustom khoj-default-content-type "org" "The default content type to perform search on." :group 'khoj :type '(choice (const "org") @@ -88,7 +88,7 @@ (defconst khoj--buffer-name "*🦅Khoj*" "Name of buffer to show results from Khoj.") -(defvar khoj--search-type "org" +(defvar khoj--content-type "org" "The type of content to perform search on.") (declare-function beancount-mode "beancount" ()) @@ -102,7 +102,7 @@ NO-PAGING FILTER)) (let ((enabled-content-types (khoj--get-enabled-content-types))) (concat " - Set Search Type + Set Content Type -------------------------\n" (when (member 'markdown enabled-content-types) "C-x m | markdown\n") @@ -116,11 +116,11 @@ NO-PAGING FILTER)) "C-x M | music\n")))) (defvar khoj--rerank nil "Track when re-rank of results triggered.") -(defun khoj--search-markdown () "Set search-type to `markdown'." (interactive) (setq khoj--search-type "markdown")) -(defun khoj--search-org () "Set search-type to `org-mode'." (interactive) (setq khoj--search-type "org")) -(defun khoj--search-ledger () "Set search-type to `ledger'." (interactive) (setq khoj--search-type "ledger")) -(defun khoj--search-images () "Set search-type to image." (interactive) (setq khoj--search-type "image")) -(defun khoj--search-music () "Set search-type to music." (interactive) (setq khoj--search-type "music")) +(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")) +(defun khoj--search-images () "Set content-type to image." (interactive) (setq khoj--content-type "image")) +(defun khoj--search-music () "Set content-type to music." (interactive) (setq khoj--content-type "music")) (defun khoj--improve-rank () "Use cross-encoder to rerank search results." (interactive) (khoj--incremental-search t)) (defun khoj--make-search-keymap (&optional existing-keymap) "Setup keymap to configure Khoj search. Build of EXISTING-KEYMAP when passed." @@ -221,8 +221,8 @@ Use `which-key` if available, else display simple message in echo area" (format "%s\n\n" (cdr (assoc 'entry args)))) json-response))))) -(defun khoj--buffer-name-to-search-type (buffer-name) - "Infer search type based on BUFFER-NAME." +(defun khoj--buffer-name-to-content-type (buffer-name) + "Infer content type based on BUFFER-NAME." (let ((enabled-content-types (khoj--get-enabled-content-types)) (file-extension (file-name-extension buffer-name))) (cond @@ -230,7 +230,7 @@ Use `which-key` if available, else display simple message in echo area" ((and (member 'ledger enabled-content-types) (or (equal file-extension "bean") (equal file-extension "beancount"))) "ledger") ((and (member 'org enabled-content-types) (equal file-extension "org")) "org") ((and (member 'markdown enabled-content-types) (or (equal file-extension "markdown") (equal file-extension "md"))) "markdown") - (t khoj-default-search-type)))) + (t khoj-default-content-type)))) (defun khoj--get-enabled-content-types () "Get content types enabled for search from API." @@ -248,14 +248,14 @@ Use `which-key` if available, else display simple message in echo area" (lambda (a) (not (eq (cdr a) :null))) content-type)))))) -(defun khoj--construct-api-query (query search-type &optional rerank) - "Construct API Query from QUERY, SEARCH-TYPE and (optional) RERANK params." +(defun khoj--construct-api-query (query content-type &optional rerank) + "Construct API Query from QUERY, CONTENT-TYPE and (optional) RERANK params." (let ((rerank (or rerank "false")) (encoded-query (url-hexify-string query))) - (format "%s/api/search?q=%s&t=%s&r=%s&n=%s" khoj-server-url encoded-query search-type rerank khoj-results-count))) + (format "%s/api/search?q=%s&t=%s&r=%s&n=%s" khoj-server-url encoded-query content-type rerank khoj-results-count))) -(defun khoj--query-api-and-render-results (query search-type query-url buffer-name) - "Query Khoj API using QUERY, SEARCH-TYPE, QUERY-URL. +(defun khoj--query-api-and-render-results (query content-type query-url buffer-name) + "Query Khoj API using QUERY, CONTENT-TYPE, QUERY-URL. Render results in BUFFER-NAME." ;; get json response from api (with-current-buffer buffer-name @@ -269,17 +269,17 @@ Render results in BUFFER-NAME." (json-response (json-parse-buffer :object-type 'alist))) (erase-buffer) (insert - (cond ((or (equal search-type "org") (equal search-type "music")) (khoj--extract-entries-as-org json-response query)) - ((equal search-type "markdown") (khoj--extract-entries-as-markdown json-response query)) - ((equal search-type "ledger") (khoj--extract-entries-as-ledger json-response query)) - ((equal search-type "image") (khoj--extract-entries-as-images json-response query)) + (cond ((or (equal content-type "org") (equal content-type "music")) (khoj--extract-entries-as-org json-response query)) + ((equal content-type "markdown") (khoj--extract-entries-as-markdown json-response query)) + ((equal content-type "ledger") (khoj--extract-entries-as-ledger json-response query)) + ((equal content-type "image") (khoj--extract-entries-as-images json-response query)) (t (format "%s" json-response)))) - (cond ((equal search-type "org") (org-mode)) - ((equal search-type "markdown") (markdown-mode)) - ((equal search-type "ledger") (beancount-mode)) - ((equal search-type "music") (progn (org-mode) + (cond ((equal content-type "org") (org-mode)) + ((equal content-type "markdown") (markdown-mode)) + ((equal content-type "ledger") (beancount-mode)) + ((equal content-type "music") (progn (org-mode) (org-music-mode))) - ((equal search-type "image") (progn (shr-render-region (point-min) (point-max)) + ((equal content-type "image") (progn (shr-render-region (point-min) (point-max)) (goto-char (point-min)))) (t (fundamental-mode)))) (read-only-mode t))) @@ -290,7 +290,7 @@ Render results in BUFFER-NAME." (let* ((rerank-str (cond (rerank "true") (t "false"))) (khoj-buffer-name (get-buffer-create khoj--buffer-name)) (query (minibuffer-contents-no-properties)) - (query-url (khoj--construct-api-query query khoj--search-type rerank-str))) + (query-url (khoj--construct-api-query query khoj--content-type rerank-str))) ;; Query khoj API only when user in khoj minibuffer and non-empty query ;; Prevents querying if ;; 1. user hasn't started typing query @@ -311,7 +311,7 @@ Render results in BUFFER-NAME." (message "Khoj: Rerank Results")) (khoj--query-api-and-render-results query - khoj--search-type + khoj--content-type query-url khoj-buffer-name)))))) @@ -359,15 +359,15 @@ Render results in BUFFER-NAME." :argument-format "--content-type=%s" :argument-regexp ".+" ;; set content type to last used or based on current buffer or to default - :init-value (lambda (obj) (oset obj value (format "--content-type=%s" (or khoj--search-type (khoj--buffer-name-to-search-type (buffer-name)))))) + :init-value (lambda (obj) (oset obj value (format "--content-type=%s" (or khoj--content-type (khoj--buffer-name-to-content-type (buffer-name)))))) ;; dynamically set choices to content types enabled on khoj backend :choices (mapcar #'symbol-name (khoj--get-enabled-content-types))) (transient-define-suffix khoj--search (&optional args) (interactive (list (transient-args transient-current-command))) (progn - ;; set search type to last used or based on current buffer or to default - (setq khoj--search-type (or (transient-arg-value "--content-type=" args) (khoj--buffer-name-to-search-type (buffer-name)))) + ;; set content type to last used or based on current buffer or to default + (setq khoj--content-type (or (transient-arg-value "--content-type=" args) (khoj--buffer-name-to-content-type (buffer-name)))) ;; set results count to last used or to default (setq khoj-results-count (or (transient-arg-value "--results-count=" args) khoj-results-count)) ;; trigger incremental search @@ -386,13 +386,13 @@ Render results in BUFFER-NAME." "Natural Search for QUERY on your personal notes, transactions, music and images." (interactive "s🦅Khoj: ") (let* ((rerank "true") - (default-type (khoj--buffer-name-to-search-type (buffer-name))) - (search-type (completing-read "Type: " '("org" "markdown" "ledger" "music" "image") nil t default-type)) - (query-url (khoj--construct-api-query query search-type rerank)) - (buffer-name (get-buffer-create (format "*%s (q:%s t:%s)*" khoj--buffer-name query search-type)))) + (default-content-type (khoj--buffer-name-to-content-type (buffer-name))) + (content-type (completing-read "Type: " '("org" "markdown" "ledger" "music" "image") nil t default-content-type)) + (query-url (khoj--construct-api-query query content-type rerank)) + (buffer-name (get-buffer-create (format "*%s (q:%s t:%s)*" khoj--buffer-name query content-type)))) (khoj--query-api-and-render-results query - search-type + content-type query-url buffer-name) (switch-to-buffer buffer-name))) From 9d64a009fd93eafbf723044ff88c8c2f7d88bac4 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Wed, 18 Jan 2023 23:07:59 -0300 Subject: [PATCH 5/8] Allow updating khoj content index from within khoj.el - Split transient config menu by type --- src/interface/emacs/khoj.el | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/interface/emacs/khoj.el b/src/interface/emacs/khoj.el index 6323c051..4f2ec347 100644 --- a/src/interface/emacs/khoj.el +++ b/src/interface/emacs/khoj.el @@ -373,13 +373,28 @@ Render results in BUFFER-NAME." ;; trigger incremental search (call-interactively #'khoj-incremental))) +(transient-define-suffix khoj--update (&optional args) + (interactive (list (transient-args transient-current-command))) + (let* ((force-update (if (member "--force-update" args) "true" "false")) + (content-type (or (transient-arg-value "--content-type=" args) (khoj--buffer-name-to-content-type (buffer-name)))) + (config-url (format "%s/api/update?t=%s&force=%s" khoj-server-url content-type force-update)) + (url-request-method "GET")) + ;; Call khoj API to update content type + (url-retrieve + config-url + (lambda (_) (message "Khoj %s index %supdated!" content-type (if (member "--force-update" args) "force " "")))))) ;;;###autoload (transient-define-prefix khoj () [["Set" - ("t" "Content Type" khoj--content-type-switch) - ("n" "Results Count" "--results-count=" :init-value (lambda (obj) (oset obj value (format "%s" khoj-results-count))))]] - [["Act" ("s" "Search" khoj--search)]]) + ("t" "Content Type" khoj--content-type-switch)] + ["Set Search" + ("n" "Results Count" "--results-count=" :init-value (lambda (obj) (oset obj value (format "%s" khoj-results-count))))] + ["Set Update" + ("-f" "Force Update" "--force-update")]] + [["Act" + ("s" "Search" khoj--search) + ("u" "Update" khoj--update)]]) ;;;###autoload (defun khoj-simple (query) From 87c7cf4272c214e167132a7180041985baec04e4 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Thu, 19 Jan 2023 01:04:05 -0300 Subject: [PATCH 6/8] Use single khoj func as entrypoint. Group khoj.el code into sections - Give more relevant, specific name to khoj suffix commands - Remove `khoj-simple'. Have single `khoj' function for entrypoint --- src/interface/emacs/khoj.el | 74 ++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 26 deletions(-) diff --git a/src/interface/emacs/khoj.el b/src/interface/emacs/khoj.el index 4f2ec347..dd627943 100644 --- a/src/interface/emacs/khoj.el +++ b/src/interface/emacs/khoj.el @@ -50,6 +50,11 @@ (require 'json) (require 'transient) + +;; ------------------------- +;; Khoj Static Configuration +;; ------------------------- + (defcustom khoj-server-url "http://localhost:8000" "Location of Khoj API server." :group 'khoj @@ -79,6 +84,11 @@ (const "image") (const "music"))) + +;; -------------------------- +;; Khoj Dynamic Configuration +;; -------------------------- + (defvar khoj--minibuffer-window nil "Minibuffer window used to enter query.") @@ -105,7 +115,7 @@ NO-PAGING FILTER)) Set Content Type -------------------------\n" (when (member 'markdown enabled-content-types) - "C-x m | markdown\n") + "C-x m | markdown\n") (when (member 'org enabled-content-types) "C-x o | org-mode\n") (when (member 'ledger enabled-content-types) @@ -150,6 +160,11 @@ Use `which-key` if available, else display simple message in echo area" nil t t)) (message "%s" (khoj--keybindings-info-message)))) + +;; ----------------------------------------------- +;; Extract and Render Entries of each Content Type +;; ----------------------------------------------- + (defun khoj--extract-entries-as-markdown (json-response query) "Convert JSON-RESPONSE, QUERY from API to markdown entries." ;; remove leading (, ) or SPC from extracted entries string @@ -232,6 +247,11 @@ Use `which-key` if available, else display simple message in echo area" ((and (member 'markdown enabled-content-types) (or (equal file-extension "markdown") (equal file-extension "md"))) "markdown") (t khoj-default-content-type)))) + +;; -------------- +;; Query Khoj API +;; -------------- + (defun khoj--get-enabled-content-types () "Get content types enabled for search from API." (let ((config-url (format "%s/api/config/data" khoj-server-url)) @@ -285,6 +305,10 @@ Render results in BUFFER-NAME." (read-only-mode t))) +;; ------------------ +;; Incremental Search +;; ------------------ + (defun khoj--incremental-search (&optional rerank) "Perform Incremental Search on Khoj. Allow optional RERANK of results." (let* ((rerank-str (cond (rerank "true") (t "false"))) @@ -354,6 +378,11 @@ Render results in BUFFER-NAME." (add-hook 'minibuffer-exit-hook #'khoj--teardown-incremental-search)) ; teardown khoj incremental search on minibuffer exit (read-string khoj--query-prompt)))) + +;; --------- +;; Khoj Menu +;; --------- + (transient-define-argument khoj--content-type-switch () :class 'transient-switches :argument-format "--content-type=%s" @@ -363,7 +392,7 @@ Render results in BUFFER-NAME." ;; dynamically set choices to content types enabled on khoj backend :choices (mapcar #'symbol-name (khoj--get-enabled-content-types))) -(transient-define-suffix khoj--search (&optional args) +(transient-define-suffix khoj--search-command (&optional args) (interactive (list (transient-args transient-current-command))) (progn ;; set content type to last used or based on current buffer or to default @@ -373,19 +402,17 @@ Render results in BUFFER-NAME." ;; trigger incremental search (call-interactively #'khoj-incremental))) -(transient-define-suffix khoj--update (&optional args) +(transient-define-suffix khoj--update-command (&optional args) + "Call khoj API to update index of specified content type." (interactive (list (transient-args transient-current-command))) (let* ((force-update (if (member "--force-update" args) "true" "false")) (content-type (or (transient-arg-value "--content-type=" args) (khoj--buffer-name-to-content-type (buffer-name)))) - (config-url (format "%s/api/update?t=%s&force=%s" khoj-server-url content-type force-update)) + (update-url (format "%s/api/update?t=%s&force=%s" khoj-server-url content-type force-update)) (url-request-method "GET")) - ;; Call khoj API to update content type - (url-retrieve - config-url - (lambda (_) (message "Khoj %s index %supdated!" content-type (if (member "--force-update" args) "force " "")))))) + (url-retrieve update-url (lambda (_) (message "Khoj %s index %supdated!" content-type (if (member "--force-update" args) "force " "")))))) -;;;###autoload -(transient-define-prefix khoj () +(transient-define-prefix khoj-menu () + "Create Khoj Menu to Configure and Execute Commands." [["Set" ("t" "Content Type" khoj--content-type-switch)] ["Set Search" @@ -393,24 +420,19 @@ Render results in BUFFER-NAME." ["Set Update" ("-f" "Force Update" "--force-update")]] [["Act" - ("s" "Search" khoj--search) - ("u" "Update" khoj--update)]]) + ("s" "Search" khoj--search-command) + ("u" "Update" khoj--update-command)]]) + + +;; ---------- +;; Entrypoint +;; ---------- ;;;###autoload -(defun khoj-simple (query) - "Natural Search for QUERY on your personal notes, transactions, music and images." - (interactive "s🦅Khoj: ") - (let* ((rerank "true") - (default-content-type (khoj--buffer-name-to-content-type (buffer-name))) - (content-type (completing-read "Type: " '("org" "markdown" "ledger" "music" "image") nil t default-content-type)) - (query-url (khoj--construct-api-query query content-type rerank)) - (buffer-name (get-buffer-create (format "*%s (q:%s t:%s)*" khoj--buffer-name query content-type)))) - (khoj--query-api-and-render-results - query - content-type - query-url - buffer-name) - (switch-to-buffer buffer-name))) +(defun khoj () + "Natural, Incremental Search for your personal notes, transactions and images." + (interactive) + (khoj-menu)) (provide 'khoj) From 5d0f369186f76902da01767c75b91d7525d10441 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Thu, 19 Jan 2023 02:47:07 -0300 Subject: [PATCH 7/8] Add ability to quit khoj transient with standard q keybinding --- src/interface/emacs/khoj.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/interface/emacs/khoj.el b/src/interface/emacs/khoj.el index dd627943..77c6649c 100644 --- a/src/interface/emacs/khoj.el +++ b/src/interface/emacs/khoj.el @@ -421,7 +421,8 @@ Render results in BUFFER-NAME." ("-f" "Force Update" "--force-update")]] [["Act" ("s" "Search" khoj--search-command) - ("u" "Update" khoj--update-command)]]) + ("u" "Update" khoj--update-command) + ("q" "Quit" transient-quit-one)]]) ;; ---------- From 0dd1cba2722ceaeb5d55c441ca02d9b36dc14471 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Thu, 19 Jan 2023 03:02:59 -0300 Subject: [PATCH 8/8] Rename configuration sections in khoj.el transient menu --- src/interface/emacs/khoj.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/interface/emacs/khoj.el b/src/interface/emacs/khoj.el index 77c6649c..9083d8fc 100644 --- a/src/interface/emacs/khoj.el +++ b/src/interface/emacs/khoj.el @@ -413,11 +413,11 @@ Render results in BUFFER-NAME." (transient-define-prefix khoj-menu () "Create Khoj Menu to Configure and Execute Commands." - [["Set" + [["Configure General" ("t" "Content Type" khoj--content-type-switch)] - ["Set Search" + ["Configure Search" ("n" "Results Count" "--results-count=" :init-value (lambda (obj) (oset obj value (format "%s" khoj-results-count))))] - ["Set Update" + ["Configure Update" ("-f" "Force Update" "--force-update")]] [["Act" ("s" "Search" khoj--search-command)