Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions le-janet.el
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion lispy.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down