Fix documentation strings and simplify not null checks

This commit is contained in:
Debanjum Singh Solanky
2023-05-02 21:39:47 +08:00
parent 731ef5688f
commit 948a4274e4

View File

@@ -226,7 +226,7 @@ for example), set this to the full interpreter path."
:group 'khoj) :group 'khoj)
(defcustom khoj-org-directories nil (defcustom khoj-org-directories nil
"List of directories with org-mode files to index on khoj server." "List of directories with `org-mode' files to index on khoj server."
:type '(repeat string) :type '(repeat string)
:group 'khoj) :group 'khoj)
@@ -259,7 +259,7 @@ Auto invokes setup steps on calling main entrypoint."
"Install or upgrade the khoj server." "Install or upgrade the khoj server."
(with-temp-buffer (with-temp-buffer
(message "khoj.el: Installing server...") (message "khoj.el: Installing server...")
(if (/= (apply 'call-process khoj-server-python-command (if (/= (apply #'call-process khoj-server-python-command
nil t nil nil t nil
"-m" "pip" "install" "--upgrade" "-m" "pip" "install" "--upgrade"
'("khoj-assistant")) '("khoj-assistant"))
@@ -316,11 +316,11 @@ Auto invokes setup steps on calling main entrypoint."
"Check if the khoj server has been started." "Check if the khoj server has been started."
;; check for when server process handled from within emacs ;; check for when server process handled from within emacs
(if (and khoj--server-process (if (and khoj--server-process
(not (null (process-live-p khoj--server-process)))) (process-live-p khoj--server-process))
t t
;; else general check via ping to khoj-server-url ;; else general check via ping to khoj-server-url
(if (ignore-errors (if (ignore-errors
(not (null (url-retrieve-synchronously (format "%s/api/config/data/default" khoj-server-url))))) (url-retrieve-synchronously (format "%s/api/config/data/default" khoj-server-url)))
;; Successful ping to non-emacs khoj server indicates it is started and ready. ;; Successful ping to non-emacs khoj server indicates it is started and ready.
;; So update ready state tracker variable (and implicitly return true for started) ;; So update ready state tracker variable (and implicitly return true for started)
(setq khoj--server-ready? t) (setq khoj--server-ready? t)
@@ -470,7 +470,7 @@ CONFIG is json obtained from Khoj config API."
(message "khoj.el: ⚙️ Updated khoj server configuration."))))) (message "khoj.el: ⚙️ Updated khoj server configuration.")))))
(defun khoj-setup (&optional interact) (defun khoj-setup (&optional interact)
"Install, start and configure Khoj server." "Install, start and configure Khoj server. Get permission if INTERACT is non-nil."
(interactive "p") (interactive "p")
;; Setup khoj server if not running ;; Setup khoj server if not running
(let* ((not-started (not (khoj--server-started?))) (let* ((not-started (not (khoj--server-started?)))