diadochos / org-babel-eval-in-repl

Send and eval org-mode babel code blocks in various REPLs (therefore it's async)
MIT License
58 stars 8 forks source link

Avoid sending line if it's either #+END_SRC or the header #6

Open diadochos opened 7 years ago

stardiviner commented 7 years ago

I have an idea, I will create an PR.

diadochos commented 7 years ago

Wow! Thank you! I'll wait for that.

stardiviner commented 7 years ago

https://github.com/diadochos/org-babel-eval-in-repl/pull/11

And I suggest don't bind [C-c C-c]. Use [C-c <return>] instead.

diadochos commented 7 years ago

@stardiviner Sorry that I didn't clarify, but the problem was not that we can use this function outside a source block. The problem is that (org-babel-get-src-block-info) still returns the information even if the cursor is on the header or the footer, therefore the header string (i.e. #+BEGIN_SRC foo) or the footer (i.e. #END_SRC) is sent to the REPL as is.

(Normally this will not likely cause a problem because # is often the symbol for starting a comment, but it would be more elegant if these lines wouldn't appear in the REPL buffer.)

(Example procedure to reproduce:

  1. Go to the header line
  2. Run (ober-eval-in-repl) )

Still, the validation in your PR makes sense, so please do include this commit.

Finally, as for your suggestion regarding the key binding, I agree. [C-c C-c] is used for multiple purposes in org-mode, so we should avoid binding this (Yet, I've never used C-c C-c for any other purpose for myself, so I personally will bind C-c C-c). Thank you for pointing out.

diadochos commented 7 years ago

By the way, because the problem has been changed, please let me know if you want to stop here and have the PR merged. However, I will very much appreciate it if you could try to solve the new problem too (since I have no idea yet).

diadochos commented 7 years ago

13