Improve khoj.el messages to convey state of khoj server

- Remove waiting for server message as it hides the messages from the
  server
- Fix the nil message that were being rendered, by checking before
  showing messages from server
- Consistently prefix messages from khoj with khoj.el
This commit is contained in:
Debanjum Singh Solanky
2023-04-28 11:15:13 +08:00
parent 76df393eb5
commit f046523b33

View File

@@ -304,7 +304,8 @@ Auto invokes setup steps on calling main entrypoint."
(string-match "main.py" msg)
(string-match "api.py" msg)))
(dolist (line (split-string msg "\n"))
(message "khoj.el: %s" (nth 1 (split-string line " " t " *"))))))
(when (string-match " " line)
(message "khoj.el: %s" (nth 1 (split-string line " " t " *")))))))
;; call default process filter to write output to process buffer
(internal-default-process-filter process msg))))
(set-process-query-on-exit-flag khoj--server-process nil)
@@ -481,7 +482,6 @@ CONFIG is json obtained from Khoj config API."
;; Wait until server is ready
;; As server can be started but not ready to use/configure
(while (not khoj--server-ready?)
(message "Khoj: Waiting for server to start...")
(sit-for 0.5))
;; Configure server once it's ready
@@ -848,7 +848,7 @@ RECEIVE-DATE is the message receive date."
(progn
(when rerank
(setq khoj--rerank t)
(message "Khoj: Rerank Results"))
(message "khoj.el: Rerank Results"))
(khoj--query-search-api-and-render-results
query-url
khoj--content-type
@@ -865,7 +865,7 @@ RECEIVE-DATE is the message receive date."
(defun khoj--teardown-incremental-search ()
"Teardown hooks used for incremental search."
(message "Khoj: Teardown Incremental Search")
(message "khoj.el: Teardown Incremental Search")
;; unset khoj minibuffer window
(setq khoj--minibuffer-window nil)
;; delete open connections to khoj server
@@ -1001,7 +1001,7 @@ Paragraph only starts at first text after blank line."
(url-request-method "GET"))
(progn
(setq khoj--content-type content-type)
(url-retrieve update-url (lambda (_) (message "Khoj %s index %supdated!" content-type (if (member "--force-update" args) "force " "")))))))
(url-retrieve update-url (lambda (_) (message "khoj.el: %s index %supdated!" content-type (if (member "--force-update" args) "force " "")))))))
(transient-define-suffix khoj--chat-command (&optional _)
"Command to Chat with Khoj."