Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Phel REPL usage with Emacs#762

jasalt started this conversation inGeneral
Discussion options

jasalt
Oct 31, 2024
Collaborator

The Interactive Lang Tools advertised in Phel docs has not been updated for a couple years, it's docs are a bit broken and original creator states that he's not maintaining it at the moment (https://codeberg.org/mmontone/interactive-lang-tools/issues/2#issuecomment-2415676).

I gave ita try but couldn't get it loading without errors so far, and went with more simple approach sending and evaluating region in Phel REPL running in inferior shell process eg. inmistty using some mostly copy-pasted code:

(defunsend-region-to-process (argbegend)"Send the current region to a process buffer.The first time it's called, will prompt for the buffer tosend to. Subsequent calls send to the same buffer, unless aprefix argument is used (C-u), or the buffer no longer has anactive process. -- https://emacs.stackexchange.com/a/37889/42614"  (interactive"P\nr")  (if (or arg;; user asks for selection          (not (boundp'process-target));; target not set;; or target is not set to an active process:          (not (process-live-p (get-buffer-process                                process-target))))      (setq process-target            (completing-read"Process:"             (seq-map (lambda (el) (buffer-name (process-buffer el)))                      (process-list)))))  (process-send-region process-target beg end);; If target buffer is *mistty*, also evaluate sent region;; by calling missty-send-command  (let ((buf-name (let ((str process-target))  (setq parts (split-string str""t))  (car (last parts))))); Extract "actual" buffer name(if (string= buf-name"*mistty*")(with-current-buffer buf-name  (call-interactively'mistty-send-command)))))

This is then bound to hotkey inphel-mode configuration:

(use-package phel-mode; derived from clojure-mode:mode"\\.phel\\'";; TODO workaround for lsp-warning coming from lsp hooked to clojure-mode:config (setq lsp-warn-no-matched-clientsnil):bind ("C-M-x". send-region-to-process)  )

While ILT has features more up to par to eg. Clojure Nrepl and Emacs Cider, something more simple like this is maybe a better starting point with it's current state.

Demo:

phel-repl-emacs-wp2.mp4
You must be logged in to vote

Replies: 1 comment

Comment options

jasalt
Jan 1, 2025
Collaborator Author

Made a few improvements to the config and created a file for ithttps://github.com/jasalt/.emacs.d/blob/main/personal/phel.el.

Added processing for the text to make it more REPL friendly before passing it to process, plus eval options and keys more inline to Emacs Lisp (eval region, buffer or "current" sexp) plus extra function evaluating the first sexp of the next comment block.

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
General
Labels
None yet
1 participant
@jasalt

[8]ページ先頭

©2009-2025 Movatter.jp