Hello, Spencer Russell <spencer.f.russ...@gmail.com> writes:
> I've been trying to troubleshoot an issue where running `comment-line` > within a SRC block moves point to the beginning of the block, rather > than after the commented line. > I've boiled it down to a reproduction that duplicates the root cause. > Open an org document, put point in a SRC block on some line besides the > first, and run the following: > ``` > (save-excursion > (org-babel-do-in-edit-buffer > (insert "FOO"))) > ``` > > This duplicates what happens in `org-comment-or-uncomment-region` > in `org.el`. > This will add "FOO" to point, as expected, but point jumps to the > beginning of the block (at least on my setup). According to the docs of > `org-edit-src-code`, which is used by `org-babel-do-in-edit-buffer`, it > removes the original code and replaces it with the edited code. That > seems like the source of the problem, because the marker saved by `save- > excursion` is lost. FWIW, I cannot reproduce it. Regards, -- Nicolas Goaziou