Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove empty lines from results #14

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

fleimgruber
Copy link

This is a tentative fix for #8. It was tested with the code block

#+BEGIN_SRC julia :session :results output
1 + 1

# comment

212
#+END_SRC

i.e. running with a session and taking the output as evaluation results - which is a workaround for #9 as seen in #9 (comment).

Given that source block a user would see the result

#+RESULTS:
: 2
: 
: 
: 
: 212

whereas something like

#+RESULTS:
: 2
: 212

would be expected.

ob-julia is mainly based on ob-R. It looks as if inferior-ess-send-input works differently for Julia and R sessions in ESS. Specifically, in ob-R the result of evaluation is essentially one string containing the desired output. In ob-julia the result is one string per source block line (including "\n" for each comment line). These strings get concatenated to the final result containing all those newlines. The approach taken here is to replace excessive (i.e. three) consecutive newline characters with an appropriate number of newlines (i.e. one) in the resulting output string.

This does not feel like the correct fix, more like a workaround, but works without getting into different ESS session evaluation specifics. Please let me know if you can think of a better way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant