In Emacs, the end position of a region is exclusive. So functions like
`delete-region` will delete the entire region specified excluding the end
position. Follow this convention with the cell code position.
This fixes issues when adding syntax properties to a cell's code. See
`jupyter-repl-initialize-fontification`.
Better support for completions in the Jupyter org-mode source blocks
A line context is often insufficient. For example, the Julia kernel will parse
up to the current point and return dictionary keys as completions or method
arguments. Similarly a Python kernel may use Jedi for completion which does
static analysis of the code block to resolve import paths for completion
results.
Change the behavior of `jupyter-org-sync-results` to return the org formatted
result string and modify the result parameters in `org-babel-execute:jupyter`
to add the "raw" result parameter so that the result string is directly
inserted into the buffer.
This is to work towards better support for in-lined code blocks.
This ensures that org-element objects are always returned by the functions like
`jupyter-org-file-link`. Previously functions that returned org objects would
return the object wrapped in a list.
Previously stream results would be placed directly inside the RESULTS drawer.
The issue with this is that sometimes the stream results can be represented as
org syntax.
Instead of inserting stream results directly into a RESULTS drawer, insert them
as either fixed-width or example-block org elements depending on
`org-babel-min-lines-for-block-output`. In addition, coalesce all stream
results so that multiple stream messages in succession produces only one
fixed-width or example-block element.
This may still not be the best place to put buffer modifications, but it
"spreads out the logic" a little more and simplifies
`jupyter-org--append-result`.
It seems `org-element-latex-fragment-parser` expects that a latex fragment can
really be parsed because there were false positives when it was called trying
to parse a latex environment such as `\begin{equation*}...\end{equation*}`. It
would consider `\begin{equation*}` as the fragment.