diff --git a/le-janet.el b/le-janet.el new file mode 100644 index 00000000..67dac2e0 --- /dev/null +++ b/le-janet.el @@ -0,0 +1,37 @@ +;;; le-janet.el --- Description -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2025 John Bonini +;; +;; This file is not part of GNU Emacs. +;; +;;; Commentary: +;; +;; Description +;; +;;; Code: + +(require 'janet-mode) ;; janet-ts-mode? +(require 'ajrepl) + +(declare-function ajrepl-trim-trailing-newline-maybe "ext:ajrepl") +(declare-function ajrepl-get-process "ext:ajrepl") + +(defun lispy--eval-janet (code-str) + "Eval CODE-STR as janet code. Return repl output." + (with-current-buffer ajrepl-repl-buffer-name + (goto-char (point-max)) + (insert (ajrepl-trim-trailing-newline-maybe code-str)) + (comint-send-input) + (let ((command-output-begin (point)) + (response-timeout 5)) + (while (null (save-excursion + (let ((inhibit-field-text-motion t)) + (goto-char command-output-begin) + (re-search-forward "^repl:[0-9]*:> " nil t)))) + (accept-process-output (ajrepl-get-process) response-timeout) + (goto-char (point-max))) + (goto-char (point-max)) + (buffer-substring-no-properties command-output-begin (line-end-position 0))))) + +(provide 'le-janet) +;;; le-janet.el ends here diff --git a/lispy.el b/lispy.el index e2f20427..2ca011f0 100644 --- a/lispy.el +++ b/lispy.el @@ -4221,7 +4221,9 @@ SYMBOL is a string." (lisp-mode le-lisp lispy--eval-lisp) (hy-mode - le-hy lispy--eval-hy))) + le-hy lispy--eval-hy) + (janet-mode ;; janet-ts-mode? + le-janet lispy--eval-janet))) (defvar lispy-eval-output nil "The eval function may set this when there's output.")