From bc7477ea3efafcabdd04ec8c3d5de7f643de8677 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Tue, 14 Feb 2023 15:44:22 -0600 Subject: [PATCH] Move Emacs, Obsidian plugin code out from under src/khoj directory - What - The Emacs and Obsidian interfaces stay in their original directories under src/ - src/khoj now only contains code meant for pypi packaging - Benefits - This avoids having to update khoj MELPA, Obsidian plugin config as the Emacs, Obsidian code is under their original directories - It separates the code in src/khoj meant for python packaging from code for external interfaces like Emacs and Obsidian --- .github/workflows/build_khoj_el.yml | 6 ++-- .github/workflows/test_khoj_el.yml | 12 ++++---- MANIFEST.in | 4 +-- README.md | 22 +++++++------- src/{khoj => }/interface/emacs/README.org | 28 +++++++++--------- src/{khoj => }/interface/emacs/khoj.el | 2 +- .../interface/emacs/tests/khoj-tests.el | 2 +- .../interface/obsidian/.editorconfig | 0 .../interface/obsidian/.eslintignore | 0 src/{khoj => }/interface/obsidian/.eslintrc | 0 src/{khoj => }/interface/obsidian/.gitignore | 0 src/{khoj => }/interface/obsidian/.npmrc | 0 src/{khoj => }/interface/obsidian/LICENSE | 0 src/{khoj => }/interface/obsidian/README.md | 0 ..._obsidian_codebase_visualization_0.2.1.png | Bin .../obsidian/docs/khoj_on_obsidian_0.2.5.png | Bin .../interface/obsidian/esbuild.config.mjs | 0 .../interface/obsidian/manifest.json | 0 .../interface/obsidian/package.json | 0 src/{khoj => }/interface/obsidian/src/main.ts | 0 .../interface/obsidian/src/modal.ts | 0 .../interface/obsidian/src/settings.ts | 0 .../interface/obsidian/src/utils.ts | 0 src/{khoj => }/interface/obsidian/styles.css | 0 .../interface/obsidian/tsconfig.json | 0 .../interface/obsidian/version-bump.mjs | 0 .../interface/obsidian/versions.json | 0 tests/data/markdown/interface_emacs_readme.md | 2 +- 28 files changed, 39 insertions(+), 39 deletions(-) rename src/{khoj => }/interface/emacs/README.org (75%) rename src/{khoj => }/interface/emacs/khoj.el (99%) rename src/{khoj => }/interface/emacs/tests/khoj-tests.el (98%) rename src/{khoj => }/interface/obsidian/.editorconfig (100%) rename src/{khoj => }/interface/obsidian/.eslintignore (100%) rename src/{khoj => }/interface/obsidian/.eslintrc (100%) rename src/{khoj => }/interface/obsidian/.gitignore (100%) rename src/{khoj => }/interface/obsidian/.npmrc (100%) rename src/{khoj => }/interface/obsidian/LICENSE (100%) rename src/{khoj => }/interface/obsidian/README.md (100%) rename src/{khoj => }/interface/obsidian/docs/khoj_obsidian_codebase_visualization_0.2.1.png (100%) rename src/{khoj => }/interface/obsidian/docs/khoj_on_obsidian_0.2.5.png (100%) rename src/{khoj => }/interface/obsidian/esbuild.config.mjs (100%) rename src/{khoj => }/interface/obsidian/manifest.json (100%) rename src/{khoj => }/interface/obsidian/package.json (100%) rename src/{khoj => }/interface/obsidian/src/main.ts (100%) rename src/{khoj => }/interface/obsidian/src/modal.ts (100%) rename src/{khoj => }/interface/obsidian/src/settings.ts (100%) rename src/{khoj => }/interface/obsidian/src/utils.ts (100%) rename src/{khoj => }/interface/obsidian/styles.css (100%) rename src/{khoj => }/interface/obsidian/tsconfig.json (100%) rename src/{khoj => }/interface/obsidian/version-bump.mjs (100%) rename src/{khoj => }/interface/obsidian/versions.json (100%) diff --git a/.github/workflows/build_khoj_el.yml b/.github/workflows/build_khoj_el.yml index f4d9a8bf..b7dba2a4 100644 --- a/.github/workflows/build_khoj_el.yml +++ b/.github/workflows/build_khoj_el.yml @@ -7,13 +7,13 @@ on: branches: - 'master' paths: - - src/khoj/interface/emacs/*.el + - src/interface/emacs/*.el - .github/workflows/build_khoj_el.yml pull_request: branches: - 'master' paths: - - src/khoj/interface/emacs/*.el + - src/interface/emacs/*.el - .github/workflows/build_khoj_el.yml jobs: @@ -33,7 +33,7 @@ jobs: - name: Run env: # Khoj recipe from https://github.com/melpa/melpa/pull/8321/files - RECIPE: (khoj :fetcher github :repo "debanjum/khoj" :files ("src/khoj/interface/emacs/*.el")) + RECIPE: (khoj :fetcher github :repo "debanjum/khoj" :files ("src/interface/emacs/*.el")) EXIST_OK: true LOCAL_REPO: ${{ github.workspace }} run: echo $GITHUB_REF && make -C ~/melpazoid diff --git a/.github/workflows/test_khoj_el.yml b/.github/workflows/test_khoj_el.yml index 6f4f2bd2..eb1803c1 100644 --- a/.github/workflows/test_khoj_el.yml +++ b/.github/workflows/test_khoj_el.yml @@ -5,15 +5,15 @@ on: branches: - 'master' paths: - - src/khoj/interface/emacs/*.el - - src/khoj/interface/emacs/tests/*.el + - src/interface/emacs/*.el + - src/interface/emacs/tests/*.el - .github/workflows/test_khoj_el.yml pull_request: branches: - 'master' paths: - - src/khoj/interface/emacs/*.el - - src/khoj/interface/emacs/tests/*.el + - src/interface/emacs/*.el + - src/interface/emacs/tests/*.el - .github/workflows/test_khoj_el.yml jobs: @@ -44,6 +44,6 @@ jobs: (unless package-archive-contents (package-refresh-contents)) \ (unless (package-installed-p 'transient) (package-install 'transient)))" \ -l ert \ - -l ./src/khoj/interface/emacs/khoj.el \ - -l ./src/khoj/interface/emacs/tests/khoj-tests.el \ + -l ./src/interface/emacs/khoj.el \ + -l ./src/interface/emacs/tests/khoj-tests.el \ -f ert-run-tests-batch-and-exit diff --git a/MANIFEST.in b/MANIFEST.in index ab496dc0..326a776c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,6 +2,6 @@ include README.md graft src/khoj/interface/* prune src/khoj/interface/web/images* prune docs* -prune src/khoj/interface/obsidian* -prune src/khoj/interface/emacs* +prune src/interface/obsidian* +prune src/interface/emacs* global-exclude .DS_Store *.py[cod] \ No newline at end of file diff --git a/README.md b/README.md index 88eaeb00..ed29b56f 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ **Supported Plugins** -[![Khoj on Obsidian](https://img.shields.io/badge/Obsidian-%23483699.svg?style=for-the-badge&logo=obsidian&logoColor=white)](https://github.com/debanjum/khoj/tree/master/src/khoj/interface/obsidian#readme) -[![Khoj on Emacs](https://img.shields.io/badge/Emacs-%237F5AB6.svg?&style=for-the-badge&logo=gnu-emacs&logoColor=white)](https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#readme) +[![Khoj on Obsidian](https://img.shields.io/badge/Obsidian-%23483699.svg?style=for-the-badge&logo=obsidian&logoColor=white)](https://github.com/debanjum/khoj/tree/master/src/interface/obsidian#readme) +[![Khoj on Emacs](https://img.shields.io/badge/Emacs-%237F5AB6.svg?&style=for-the-badge&logo=gnu-emacs&logoColor=white)](https://github.com/debanjum/khoj/tree/master/src/interface/emacs#readme) ## Table of Contents @@ -59,7 +59,7 @@ - **Incremental**: Incremental search for a fast, search-as-you-type experience - **Pluggable**: Modular architecture makes it easy to plug in new data sources, frontends and ML models - **Multiple Sources**: Search your Org-mode and Markdown notes, Beancount transactions and Photos -- **Multiple Interfaces**: Search using a [Web Browser](./src/khoj/interface/web/index.html), [Emacs](./src/khoj/interface/emacs/khoj.el) or the [API](http://localhost:8000/docs) +- **Multiple Interfaces**: Search using a [Web Browser](./src/khoj/interface/web/index.html), [Emacs](./src/interface/emacs/khoj.el) or the [API](http://localhost:8000/docs) ## Demos ### Khoj in Obsidian @@ -83,9 +83,9 @@ https://user-images.githubusercontent.com/6413477/184735169-92c78bf1-d827-4663-9 - Install Khoj via pip - Start Khoj app -- Add this readme and [khoj.el readme](https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs) as org-mode for Khoj to index +- Add this readme and [khoj.el readme](https://github.com/debanjum/khoj/tree/master/src/interface/emacs) as org-mode for Khoj to index - Search \"*Setup editor*\" on the Web and Emacs. Re-rank the results for better accuracy -- Top result is what we are looking for, the [section to Install Khoj.el on Emacs](https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#2-Install-Khojel) +- Top result is what we are looking for, the [section to Install Khoj.el on Emacs](https://github.com/debanjum/khoj/tree/master/src/interface/emacs#2-Install-Khojel)
Analysis @@ -107,8 +107,8 @@ https://user-images.githubusercontent.com/6413477/184735169-92c78bf1-d827-4663-9 ## Setup These are the general setup instructions for Khoj. -- Check the [Khoj.el Readme](https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#Setup) to setup Khoj with Emacs -- Check the [Khoj Obsidian Readme](https://github.com/debanjum/khoj/tree/master/src/khoj/interface/obsidian#Setup) to setup Khoj with Obsidian
+- Check the [Khoj.el Readme](https://github.com/debanjum/khoj/tree/master/src/interface/emacs#Setup) to setup Khoj with Emacs +- Check the [Khoj Obsidian Readme](https://github.com/debanjum/khoj/tree/master/src/interface/obsidian#Setup) to setup Khoj with Obsidian
Its simpler as it can skip the configure step below. ### 1. Install @@ -132,10 +132,10 @@ khoj ### Interfaces - **Khoj via Obsidian** - - [Install](https://github.com/debanjum/khoj/tree/master/src/khoj/interface/obsidian#2-Setup-Plugin) the Khoj Obsidian plugin + - [Install](https://github.com/debanjum/khoj/tree/master/src/interface/obsidian#2-Setup-Plugin) the Khoj Obsidian plugin - Click the *Khoj search* icon 🔎 on the [Ribbon](https://help.obsidian.md/User+interface/Workspace/Ribbon) or Search for *Khoj: Search* in the [Command Palette](https://help.obsidian.md/Plugins/Command+palette) - **Khoj via Emacs** - - [Install](https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#installation) [khoj.el](./src/khoj/interface/emacs/khoj.el) + - [Install](https://github.com/debanjum/khoj/tree/master/src/interface/emacs#installation) [khoj.el](./src/interface/emacs/khoj.el) - Run `M-x khoj ` - **Khoj via Web** - Open via desktop interface or directly @@ -169,11 +169,11 @@ pip install --upgrade khoj-assistant ### Upgrade Khoj on Emacs - Use your Emacs Package Manager to Upgrade -- See [khoj.el readme](https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#Upgrade) for details +- See [khoj.el readme](https://github.com/debanjum/khoj/tree/master/src/interface/emacs#Upgrade) for details ### Upgrade Khoj on Obsidian - Upgrade via the Community plugins tab on the settings pane in the Obsidian app -- See the [khoj plugin readme](https://github.com/debanjum/khoj/tree/master/src/khoj/interface/obsidian#2-Setup-Plugin) for details +- See the [khoj plugin readme](https://github.com/debanjum/khoj/tree/master/src/interface/obsidian#2-Setup-Plugin) for details ## Uninstall Khoj 1. (Optional) Hit `Ctrl-C` in the terminal running the khoj server to stop it diff --git a/src/khoj/interface/emacs/README.org b/src/interface/emacs/README.org similarity index 75% rename from src/khoj/interface/emacs/README.org rename to src/interface/emacs/README.org index 7337bb90..114322e3 100644 --- a/src/khoj/interface/emacs/README.org +++ b/src/interface/emacs/README.org @@ -4,19 +4,19 @@ /Natural, Incremental Search for your Second Brain/ ** Table of Contents - - [[https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#features][Features]] - - [[https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#Interface][Interface]] - - [[https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#Setup][Setup]] - - [[https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#1-Setup-Backend][Setup Backend]] - - [[https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#2-Install-Khojel][Install Khoj.el]] - - [[https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#Use][Use]] - - [[https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#Search][Search]] - - [[https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#Find-similar-entries][Find Similar Entries]] - - [[https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#Advanced-usage][Advanced Usage]] - - [[https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#Khoj-menu][Khoj Menu]] - - [[https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#Upgrade][Upgrade]] - - [[https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#Upgrade-Khoj-Backend][Upgrade Backend]] - - [[https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs#Upgrade-Khojel][Upgrade Khoj.el]] + - [[https://github.com/debanjum/khoj/tree/master/src/interface/emacs#features][Features]] + - [[https://github.com/debanjum/khoj/tree/master/src/interface/emacs#Interface][Interface]] + - [[https://github.com/debanjum/khoj/tree/master/src/interface/emacs#Setup][Setup]] + - [[https://github.com/debanjum/khoj/tree/master/src/interface/emacs#1-Setup-Backend][Setup Backend]] + - [[https://github.com/debanjum/khoj/tree/master/src/interface/emacs#2-Install-Khojel][Install Khoj.el]] + - [[https://github.com/debanjum/khoj/tree/master/src/interface/emacs#Use][Use]] + - [[https://github.com/debanjum/khoj/tree/master/src/interface/emacs#Search][Search]] + - [[https://github.com/debanjum/khoj/tree/master/src/interface/emacs#Find-similar-entries][Find Similar Entries]] + - [[https://github.com/debanjum/khoj/tree/master/src/interface/emacs#Advanced-usage][Advanced Usage]] + - [[https://github.com/debanjum/khoj/tree/master/src/interface/emacs#Khoj-menu][Khoj Menu]] + - [[https://github.com/debanjum/khoj/tree/master/src/interface/emacs#Upgrade][Upgrade]] + - [[https://github.com/debanjum/khoj/tree/master/src/interface/emacs#Upgrade-Khoj-Backend][Upgrade Backend]] + - [[https://github.com/debanjum/khoj/tree/master/src/interface/emacs#Upgrade-Khojel][Upgrade Khoj.el]] ** Features - *Natural*: Advanced natural language understanding using Transformer based ML Models @@ -58,7 +58,7 @@ ;; Install Khoj Package using Straight.el (use-package khoj :after org - :straight (khoj :type git :host github :repo "debanjum/khoj" :files (:defaults "src/khoj/interface/emacs/khoj.el")) + :straight (khoj :type git :host github :repo "debanjum/khoj" :files (:defaults "src/interface/emacs/khoj.el")) :bind ("C-c s" . 'khoj)) #+end_src diff --git a/src/khoj/interface/emacs/khoj.el b/src/interface/emacs/khoj.el similarity index 99% rename from src/khoj/interface/emacs/khoj.el rename to src/interface/emacs/khoj.el index 582e9a56..e526d33a 100644 --- a/src/khoj/interface/emacs/khoj.el +++ b/src/interface/emacs/khoj.el @@ -7,7 +7,7 @@ ;; Keywords: search, org-mode, outlines, markdown, beancount, ledger, image ;; Version: 0.3.0 ;; Package-Requires: ((emacs "27.1") (transient "0.3.0")) -;; URL: https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs +;; URL: https://github.com/debanjum/khoj/tree/master/src/interface/emacs ;; This file is NOT part of GNU Emacs. diff --git a/src/khoj/interface/emacs/tests/khoj-tests.el b/src/interface/emacs/tests/khoj-tests.el similarity index 98% rename from src/khoj/interface/emacs/tests/khoj-tests.el rename to src/interface/emacs/tests/khoj-tests.el index dea957a6..b780153e 100644 --- a/src/khoj/interface/emacs/tests/khoj-tests.el +++ b/src/interface/emacs/tests/khoj-tests.el @@ -5,7 +5,7 @@ ;; Author: Debanjum Singh Solanky ;; Version: 0.0.0 ;; Package-Requires: ((emacs "27.1") (transient "0.3.0")) -;; URL: https://github.com/debanjum/khoj/tree/master/src/khoj/interface/emacs +;; URL: https://github.com/debanjum/khoj/tree/master/src/interface/emacs ;;; License: diff --git a/src/khoj/interface/obsidian/.editorconfig b/src/interface/obsidian/.editorconfig similarity index 100% rename from src/khoj/interface/obsidian/.editorconfig rename to src/interface/obsidian/.editorconfig diff --git a/src/khoj/interface/obsidian/.eslintignore b/src/interface/obsidian/.eslintignore similarity index 100% rename from src/khoj/interface/obsidian/.eslintignore rename to src/interface/obsidian/.eslintignore diff --git a/src/khoj/interface/obsidian/.eslintrc b/src/interface/obsidian/.eslintrc similarity index 100% rename from src/khoj/interface/obsidian/.eslintrc rename to src/interface/obsidian/.eslintrc diff --git a/src/khoj/interface/obsidian/.gitignore b/src/interface/obsidian/.gitignore similarity index 100% rename from src/khoj/interface/obsidian/.gitignore rename to src/interface/obsidian/.gitignore diff --git a/src/khoj/interface/obsidian/.npmrc b/src/interface/obsidian/.npmrc similarity index 100% rename from src/khoj/interface/obsidian/.npmrc rename to src/interface/obsidian/.npmrc diff --git a/src/khoj/interface/obsidian/LICENSE b/src/interface/obsidian/LICENSE similarity index 100% rename from src/khoj/interface/obsidian/LICENSE rename to src/interface/obsidian/LICENSE diff --git a/src/khoj/interface/obsidian/README.md b/src/interface/obsidian/README.md similarity index 100% rename from src/khoj/interface/obsidian/README.md rename to src/interface/obsidian/README.md diff --git a/src/khoj/interface/obsidian/docs/khoj_obsidian_codebase_visualization_0.2.1.png b/src/interface/obsidian/docs/khoj_obsidian_codebase_visualization_0.2.1.png similarity index 100% rename from src/khoj/interface/obsidian/docs/khoj_obsidian_codebase_visualization_0.2.1.png rename to src/interface/obsidian/docs/khoj_obsidian_codebase_visualization_0.2.1.png diff --git a/src/khoj/interface/obsidian/docs/khoj_on_obsidian_0.2.5.png b/src/interface/obsidian/docs/khoj_on_obsidian_0.2.5.png similarity index 100% rename from src/khoj/interface/obsidian/docs/khoj_on_obsidian_0.2.5.png rename to src/interface/obsidian/docs/khoj_on_obsidian_0.2.5.png diff --git a/src/khoj/interface/obsidian/esbuild.config.mjs b/src/interface/obsidian/esbuild.config.mjs similarity index 100% rename from src/khoj/interface/obsidian/esbuild.config.mjs rename to src/interface/obsidian/esbuild.config.mjs diff --git a/src/khoj/interface/obsidian/manifest.json b/src/interface/obsidian/manifest.json similarity index 100% rename from src/khoj/interface/obsidian/manifest.json rename to src/interface/obsidian/manifest.json diff --git a/src/khoj/interface/obsidian/package.json b/src/interface/obsidian/package.json similarity index 100% rename from src/khoj/interface/obsidian/package.json rename to src/interface/obsidian/package.json diff --git a/src/khoj/interface/obsidian/src/main.ts b/src/interface/obsidian/src/main.ts similarity index 100% rename from src/khoj/interface/obsidian/src/main.ts rename to src/interface/obsidian/src/main.ts diff --git a/src/khoj/interface/obsidian/src/modal.ts b/src/interface/obsidian/src/modal.ts similarity index 100% rename from src/khoj/interface/obsidian/src/modal.ts rename to src/interface/obsidian/src/modal.ts diff --git a/src/khoj/interface/obsidian/src/settings.ts b/src/interface/obsidian/src/settings.ts similarity index 100% rename from src/khoj/interface/obsidian/src/settings.ts rename to src/interface/obsidian/src/settings.ts diff --git a/src/khoj/interface/obsidian/src/utils.ts b/src/interface/obsidian/src/utils.ts similarity index 100% rename from src/khoj/interface/obsidian/src/utils.ts rename to src/interface/obsidian/src/utils.ts diff --git a/src/khoj/interface/obsidian/styles.css b/src/interface/obsidian/styles.css similarity index 100% rename from src/khoj/interface/obsidian/styles.css rename to src/interface/obsidian/styles.css diff --git a/src/khoj/interface/obsidian/tsconfig.json b/src/interface/obsidian/tsconfig.json similarity index 100% rename from src/khoj/interface/obsidian/tsconfig.json rename to src/interface/obsidian/tsconfig.json diff --git a/src/khoj/interface/obsidian/version-bump.mjs b/src/interface/obsidian/version-bump.mjs similarity index 100% rename from src/khoj/interface/obsidian/version-bump.mjs rename to src/interface/obsidian/version-bump.mjs diff --git a/src/khoj/interface/obsidian/versions.json b/src/interface/obsidian/versions.json similarity index 100% rename from src/khoj/interface/obsidian/versions.json rename to src/interface/obsidian/versions.json diff --git a/tests/data/markdown/interface_emacs_readme.md b/tests/data/markdown/interface_emacs_readme.md index 6ed46325..c61abf80 100644 --- a/tests/data/markdown/interface_emacs_readme.md +++ b/tests/data/markdown/interface_emacs_readme.md @@ -28,7 +28,7 @@ ;; Khoj Package for Semantic Search (use-package khoj :after org - :straight (khoj :type git :host github :repo "debanjum/khoj" :files (:defaults "src/khoj/interface/emacs/khoj.el")) + :straight (khoj :type git :host github :repo "debanjum/khoj" :files (:defaults "src/interface/emacs/khoj.el")) :bind ("C-c s" . 'khoj)) ``` - With [Quelpa](https://github.com/quelpa/quelpa#installation)