When I do
C-u C-c C-v t
to tangle the code block at point, my point moves to the head of the code block. How can I prevent that point movement.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
One solution is to update to org 9.1.6. There they have moved the
save-excursion to the beginning of
By the way they use the wrong sequence
(save-restriction (save-excursion ...)). Looks like that has historical reasons. Don't know what funny consequences that may have with
org-babel-tangle. I think it would be worth a bug report.
If you want to keep an older version of
org-mode you could put a
That looks like:
(defun my-org-wrap-org-babel-tangle-in-save-excursion (oldfun &rest args) "Put `save-excursion` around (org-babel-tangle (ARGS))." (save-excursion (apply oldfun args))) (advice-add 'org-babel-tangle :around #'my-org-wrap-org-babel-tangle-in-save-excursion)