1
0
Fork
You've already forked ajrepl
0
No description
  • Janet 92.2%
  • Emacs Lisp 7.8%
Find a file
2025年10月04日 13:55:41 +09:00
ajrepl git subrepo pull ajrepl/janet-last-expression 2025年04月27日 23:13:57 +09:00
jeat git subrepo pull jeat 2025年04月27日 23:13:49 +09:00
test Use jeat instead of juat 2024年08月01日 16:32:17 +09:00
.jeat.janet Use jeat instead of juat 2024年08月01日 16:32:17 +09:00
ajrepl-core.el Remove some last ouput related commands 2025年08月04日 20:19:32 +09:00
ajrepl-experiment.el Add some newlines to timestampify prompt 2025年08月09日 13:48:52 +09:00
ajrepl.el Allow customization of command to start repl 2025年10月04日 12:00:35 +09:00
project.janet Update to non-tree-sitter version 2021年12月01日 15:04:41 +09:00
README.md Update README 2025年10月04日 13:55:41 +09:00

ajrepl

A mode for interacting with a Janet REPL

Setup

How to set things up varies a bit depending on how one manages one's Emacs, e.g. straight.el, Doom, etc. What's common to all situations is likely:

  • Ensure janet-ts-mode or janet-mode is installed and configured. (If using janet-mode, replace janet-ts-mode and janet-ts-mode-hook below with janet-mode and janet-mode-hook respectively.)

  • Clone this repository.

Manual

  • If you cloned to ~/src/ajrepl, add the following to your .emacs-equivalent:
    (add-to-list 'load-path
     (expand-file-name "~/src/ajrepl"))
    (require 'ajrepl)
    (add-hook 'janet-ts-mode-hook
     #'ajrepl-interaction-mode)
    

Elpaca

  • Add something like the following to your .emacs-equivalent:
    (use-package ajrepl
     :elpaca (:host github
     :repo "sogaiu/ajrepl"
     :files ("*.el" "ajrepl"))
     :config
     (add-hook 'janet-ts-mode-hook
     #'ajrepl-interaction-mode))
    

straight.el

  • Add something like the following to your .emacs-equivalent:
    (straight-use-package
     '(ajrepl :host github
     :repo "sogaiu/ajrepl"
     :files ("*.el" "ajrepl")))
    (use-package ajrepl
     :straight t
     :config
     (add-hook 'janet-ts-mode-hook
     #'ajrepl-interaction-mode))
    

Doom

  • The following might work for Doom:
    (package! ajrepl
     :recipe (:type git
     :host github
     :repo "sogaiu/ajrepl"
     :files (:defaults ("ajrepl/"
     "ajrepl/*"))))
    (use-package! ajrepl
     :after janet-ts-mode
     :config
     (add-hook 'janet-ts-mode-hook
     #'ajrepl-interaction-mode))
    

package.el

  • Sorry, no support for that. The manual instructions should work though.

Usage

  1. Open a Janet file

  2. Start an interactive REPL for Janet by M-x ajrepl.

    A buffer for a Janet repl should appear.

  3. Various forms of sending things to the REPL should be possible, e.g.

    • Send buffer (C-c C-b)
    • Send expression at point (C-x C-e)
    • Send top-level expression at point (C-M-x)
    • Send expression upscoped (C-c C-u) - see below for details
    • Send region (C-c C-r)

    If Emacs' menus are enabled, there should be a Ajrepl menu which shows the above (and other) commands.

Misc Notes

ajrepl-send-expression-upscoped can be handy when evaluating forms such as (import ...) which might otherwise lead to output one might not be interested in.

Experimental Commands

There's also a file named ajrepl-experiment.el that contains some experimental (aka "may not stick around") functionality.

If the file is required, it should add some additional things to the Ajrepl menu. Alternatively, using the "Enable Experimental Features" menu item under the Ajrepl menu may work too.

Credits

  • dylan-hachmann - custom command for starting repl
  • sarna - discussion about repl buffer messiness
  • sbocq - discussion and code about eval-defun

Issues

  • The REPL buffer gets very messy due to prompt information from janet.

    There are a couple ways this might be mitigated / addressed:

    1. There are some commands in ajrepl-experiment.el (see above for how to enable) that are an attempt to improve this situation:

      • ajrepl-simplify-repl-prompt
      • ajrepl-timestampify-repl-prompt

      For more details, have a look starting at this issue comment and later.

    2. Removing -s from ajrepl-start-cmd-line (which by default is '("janet" "-s")) as described here.