Initialize the Khoj Transient menu on first run instead of load

This prevents Khoj from polling the Khoj server until explicitly
invoked via `khoj' entrypoint function.

Previously it'd make a request to the khoj server every time Emacs or
khoj.el was loaded

Closes #243
This commit is contained in:
Debanjum Singh Solanky 2023-10-13 18:48:26 -07:00
parent b669aa2395
commit f64fa06e22

View file

@ -1092,6 +1092,9 @@ Paragraph only starts at first text after blank line."
;; Khoj Menu ;; Khoj Menu
;; --------- ;; ---------
(defun khoj--setup-and-show-menu ()
"Create Transient menu for khoj and show it."
;; Create the Khoj Transient menu
(transient-define-argument khoj--content-type-switch () (transient-define-argument khoj--content-type-switch ()
:class 'transient-switches :class 'transient-switches
:argument-format "--content-type=%s" :argument-format "--content-type=%s"
@ -1153,6 +1156,9 @@ Paragraph only starts at first text after blank line."
("u" "Update" khoj--update-command) ("u" "Update" khoj--update-command)
("q" "Quit" transient-quit-one)]]) ("q" "Quit" transient-quit-one)]])
;; Show the Khoj Transient menu
(khoj--menu))
;; ---------- ;; ----------
;; Entrypoint ;; Entrypoint
@ -1164,7 +1170,7 @@ Paragraph only starts at first text after blank line."
(interactive) (interactive)
(when khoj-auto-setup (when khoj-auto-setup
(khoj-setup t)) (khoj-setup t))
(khoj--menu)) (khoj--setup-and-show-menu))
(provide 'khoj) (provide 'khoj)