syscfg/emacs/module/module-ellama-capture-defin...

44 lines
1.8 KiB
EmacsLisp

;;; module-ellama-capture-definition.el --- Ellama capture definitions
;;;
;;; Commentary:
;;;
;;; This file provides functions to interactively add definitions to
;;; the Ellama context. This can be useful, for example, when dealing
;;; with custom data formats, such as denote notes, where the training
;;; data is unlikely to contain information about the format.
;;;
;;; Code:
(require 'ellama)
(defun ellama-capture-add-definition ()
"Interactively choose and add a definition to the Ellama context."
(interactive)
(let* ((funcs (apropos-internal "^ellama-capture-add-.*-definition$"))
(choices (mapcar (lambda (func)
(string-match "ellama-capture-add-\\(.*\\)-definition" (symbol-name func))
(match-string 1 (symbol-name func)))
funcs))
(choice (completing-read "Choose definition to add: " choices nil t)))
(if (fboundp (intern (format "ellama-capture-add-%s-definition" choice)))
(funcall (intern (format "ellama-capture-add-%s-definition" choice)))
(message "No function found for %s" choice))))
(defun ellama-capture-add-filetag-definition ()
"Add the filetag definition to the Ellama context."
(interactive)
(let ((filetag-definition
"filetag: Note categorization system.
Syntax: '# +filetags: :tag1:tag2:tag3:'
- Tags enclosed in colons
- Multiple tags allowed
- Placed at file start
Example: '# +filetags: :work:project:urgent:'
Purpose: Efficient note filtering and searching.
Usage: When prompted about filetags, use only this syntax.")
(ellama-context-add-text filetag-definition)
(message "Filetag definition added to Ellama context"))))
(provide 'module-ellama-capture-definitions)
;;; module-ellama-capture-definitions.el ends here.