alhassy/repl-driven-development

formatting of display output

jasonjckn opened this issue · 4 comments

image

The formatting is a bit weird it shows the command glued together with the output, is there a way to fix this?|

image

Seems like this issue only reproduces with

(repl-driven-development
   [C-x C-t]
   "mvn com.github.johnpoth:jshell-maven-plugin:1.3:run -q -f /Users/j/d/play/rama/rama-examples -Djshell.options=--enable-preview,-R,-ea,--feedback,silent"

   :name 'java-eval
   :prompt "jshell>"
   :input-rewrite-fn #'repl-driven-development--strip-out-C-style-comments&newlines
   :init "/set mode EmacsJavaMode normal -command
/set format EmacsJavaMode display \"{pre}added import {name}{post}\" import-added
/set format EmacsJavaMode display \"{pre}re-added import {name}{post}\" import-modified,replaced
/set format EmacsJavaMode result \"{type} {name} = {value}{post}\" added,modified,replaced-primary-ok
/set truncation EmacsJavaMode 40000
/set feedback EmacsJavaMode
System.out.println(\"Enjoy Java with Emacs (。◕‿◕。))\")")

but not

(repl-driven-development
   [C-x C-t]
   ;; enable assertions, and add everything installed, via `mvn', in scope.
   (format "jshell --class-path %s --enable-preview -R -ea --feedback silent"
           (concat ".:" (shell-command-to-string "find ~/.m2/repository -name \"*.jar\" -type f 2>/dev/null | tr '\n' ':'")))

   :name 'java-eval
   :prompt "jshell>"
   :input-rewrite-fn #'repl-driven-development--strip-out-C-style-comments&newlines
   :init "/set mode EmacsJavaMode normal -command
/set format EmacsJavaMode display \"{pre}added import {name}{post}\" import-added
/set format EmacsJavaMode display \"{pre}re-added import {name}{post}\" import-modified,replaced
/set format EmacsJavaMode result \"{type} {name} = {value}{post}\" added,modified,replaced-primary-ok
/set truncation EmacsJavaMode 40000
/set feedback EmacsJavaMode
System.out.println(\"Enjoy Java with Emacs (。◕‿◕。))\")")

Hey @jasonjckn,

  • I couldn't reproduce this issue ---but I suspect that may be because I don't use the jshell-maven-plugin.
  • (Aside: I have alternative approach to this plugin, in my init.el somewhere, but I have not had the time to clean it up and add it to this package properly. Stay tuned!)
  • Note that your ...--feedback,silent options are essentially overidden by your :init setup, which registers a different feedback mode altogether. Consider reading the docs of repl-driven-development--preconfigured-java-REPL, e.g., https://github.com/alhassy/repl-driven-development/blob/main/repl-driven-development.el#L847
  • Anyhow, could you please verify that the latest version of this package resolves your issue.

Hey @jasonjckn,

* I couldn't reproduce this issue ---but I suspect that may be because I don't use the jshell-maven-plugin.

I had an easier time reproducing the issue with the jshell maven plugin yah. Today, i've just now reproduced the issue with jshell alone. https://drive.google.com/file/d/1-ASVml_ooCsy5CLcxsBxalkAxgEPKT8E/view?usp=sharing

(repl-driven-development
   [C-x C-t]
   ;; enable assertions, and add everything installed, via `mvn', in scope.
   (format "jshell --class-path %s --enable-preview -R -ea" ;;  --feedback silent
           (concat ".:"
                   (string-trim
                    (shell-command-to-string "cd /Users/j/d/play/rama/rama-examples; mvn -q exec:exec -Dexec.executable=echo -Dexec.args=\"%classpath\""))))



   :name 'java-eval
   :prompt "jshell>"
   ;; :blink 'pulsar-blue
   :input-rewrite-fn #'repl-driven-development--strip-out-C-style-comments&newlines
   :init "/set mode EmacsJavaMode normal -command
/set format EmacsJavaMode display \"{pre}added import {name}{post}\" import-added
/set format EmacsJavaMode display \"{pre}re-added import {name}{post}\" import-modified,replaced
/set format EmacsJavaMode result \"{type} {name} = {value}{post}\" added,modified,replaced-primary-ok
/set truncation EmacsJavaMode 80000
/set feedback EmacsJavaMode
System.out.println(\"Enjoy Java with Emacs (。◕‿◕。))\")")
* (Aside: I have alternative approach to this plugin, in my init.el somewhere, but I have not had the time to clean it up and add it to this package properly. Stay tuned!)

Looking forward to it!

* Note that your `...--feedback,silent` options are essentially overidden by your `:init` setup, which registers a different feedback mode altogether. Consider reading the docs of `repl-driven-development--preconfigured-java-REPL`, e.g., https://github.com/alhassy/repl-driven-development/blob/main/repl-driven-development.el#L847

Your explanation makes sense, but I was just copying your code here: https://github.com/alhassy/repl-driven-development/blob/main/repl-driven-development.el#L915 . I tried fiddling with these settings and it made no difference.

* Anyhow, could you please verify that the latest version of this package resolves your issue.

I'm still able to reproduce the bug, sometimes you have to evaluate the java code 10-20x times before you see the weird output.

if you'd like, i can try to repro on vanilla doom config, instead of my customized doom config.