documentation/docs/clients/emacs.md
Query your Second Brain from Emacs
| Search | Chat |
|---|---|
:::info[Self Hosting] If you are self-hosting the Khoj server modify the install steps below:
khoj-server-url to your Khoj server URL. By default, use http://127.0.0.1:42110.khoj-api-key if your Khoj server runs in anonymous mode. For example, khoj --anonymous-mode
:::~/.emacs.d/init.elKhoj will index your org-agenda files, by default
;; Install Khoj.el
M-x package-install khoj
; Set your Khoj API key
(setq khoj-api-key "YOUR_KHOJ_CLOUD_API_KEY")
(setq khoj-server-url "https://app.khoj.dev")
Khoj will index your org-agenda files, by default
;; Install Khoj client from MELPA Stable
(use-package khoj
:ensure t
:pin melpa-stable
:bind ("C-c s" . 'khoj)
:config (setq khoj-api-key "YOUR_KHOJ_CLOUD_API_KEY"
khoj-server-url "https://app.khoj.dev"))
Configures the specified org files, directories to be indexed by Khoj
;; Install Khoj client from MELPA Stable
(use-package khoj
:ensure t
:pin melpa-stable
:bind ("C-c s" . 'khoj)
:config (setq khoj-api-key "YOUR_KHOJ_CLOUD_API_KEY"
khoj-server-url "https://app.khoj.dev"
khoj-index-directories '("~/docs/org-roam" "~/docs/notes")
khoj-index-files '("~/docs/todo.org" "~/docs/work.org")))
Configures the specified org files, directories to be indexed by Khoj
;; Install Khoj client using Straight.el
(use-package khoj
:after org
:straight (khoj :type git :host github :repo "khoj-ai/khoj" :files (:defaults "src/interface/emacs/khoj.el"))
:bind ("C-c s" . 'khoj)
:config (setq khoj-api-key "YOUR_KHOJ_CLOUD_API_KEY"
khoj-server-url "https://app.khoj.dev"
khoj-org-directories '("~/docs/org-roam" "~/docs/notes")
khoj-org-files '("~/docs/todo.org" "~/docs/work.org")))
See Khoj Search for details
C-c s s (or M-x khoj RET s) to open khoj searchE.g. "What is the meaning of life?", "My life goals for 2023"
See Khoj Chat for details
C-c s c (or M-x khoj RET c) to open khoj chatE.g. "When did I file my taxes last year?"
This feature finds entries similar to the one you are currently on.
C-c s f (or M-x khoj RET f) to find similar entriesAdd query filters during search to narrow down results further
e.g. What is the meaning of life? -"god" +"none" dt>"last week"
Use C-c C-o 2 to open the current result at cursor in its source org file
M-x org-open-at-point on the current entry and opens the second link in the entry.o 2 will also work
Hit C-c s (or M-x khoj) to open the khoj menu above. Then:
t until you preferred content type is selected in the khoj menu
Content Type specifies the content to perform Search, Update or Find Similar actions onn twice and then enter number of results you want to see
Results Count is used by the Search and Find Similar actions-f u to force update the khoj content index
The Force Update switch is only used by the Update actionUse your Emacs package manager to upgrade khoj.el
M-x package-refresh-contentM-x package-reinstall khojM-x straight-pull-package khoj