MITRA Emacs Extensions
Emacs Extensions
Dharmamitra Emacs Extension
The Dharmamitra Emacs Extension brings the power of Dharmamitra's translation and analysis tools directly into the Emacs environment.

Features
- Grammar analysis for Sanskrit
- English translations for Sanskrit, Chinese, Tibetan, Pali
- Segmentation and lemmatization
- Detailed grammatical analysis with meanings
Installation
- Download
dharmamitra.elfrom the repository. - Add the following to your
.emacsorinit.el:
;; Add the directory containing dharmamitra.el to load-path
(add-to-list 'load-path "/path/to/directory/containing/dharmamitra")
(require 'dharmamitra)
Configuration
Translation Settings
By default, translations are included in the analysis output. To disable translations (which makes the system significantly faster), add this to your .emacs:
(setq dharmamitra-text-include-translation nil)
To re-enable translations:
(setq dharmamitra-text-include-translation t)
Key Bindings
In order to enable the key binding, add this to your .emacs:
;; Bind to a different key globally
(global-set-key (kbd "C-c g") #'dharmamitra-text-analyze-grammar)
;; Or bind for specific modes
(add-hook 'sanskrit-mode-hook
(lambda ()
(local-set-key (kbd "C-c g") #'dharmamitra-text-analyze-grammar)))
Usage
- Select the text you want to analyze.
- Press
C-c g(or your custom keybinding). - The analysis will appear in a separate buffer showing:
- Original text
- Segmented form
- Lemmatized form
- Translation (if enabled)
- Detailed grammatical analysis
The analysis buffer will be named *Dharmamitra Text Grammar*.
Requirements
- Emacs 26.1 or later
curl(for API requests)- Internet connection to access
dharmamitra.org
MITRA Search for Emacs
dharmamitra-search.el lets you highlight any text in any buffer, hit a single key, and instantly browse cross-lingual search results (Sanskrit · Tibetan · Chinese · Pāli) returned by Dharmamitra's semantic-search API. This brings most of the functionality of MITRA Search directly into the emacs editor and allows to search the entire DharmaNexus corpus comfortably.

(screenshot: mark text → C-c C-d → clickable results window)
⏳ Installation
Manual Installation
If you don’t use a package manager like straight.el, you can install dharmamitra-search.el manually in just a few steps:
-
Download the file
Clone the repository or downloaddharmamitra-search.eldirectly and place it in a directory of your choice, for example~/.emacs.d/lisp/. -
Add it to your load path
In your.emacsorinit.elfile:
emacs-lisp (add-to-list 'load-path "~/.emacs.d/lisp/") (require 'dharmamitra-search) - Bind the search command to a key
You can customize this as you like. For example:
emacs-lisp (global-set-key (kbd "C-c C-d") #'dharmamitra-search-region) - Optional: Customize settings
RunM-x customize-group RET dharmamitra-search RETto adjust the API endpoint or appearance.
straight.el / use-package
(use-package dharmamitra-search
:straight (dharmamitra-search
:type git
:host github
:repo "https://github.com/dharmamitra/dharmamitra-search-emacs")
:bind ("C-c C-d" . dharmamitra-search-region))