|
From: | Sébastien Miquel |
Subject: | Re: [Patch] Bug: org-indent-region doesn't restore cursor position when org-src-tab-acts-natively is t [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.3/lisp/org/)] |
Date: | Fri, 23 Oct 2020 23:06:15 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 |
Quick recap of the issue for anyone who might be interested:When ~org-src-tab-acts-natively~ is t (which is now the default) functions such as ~indent-region~ and ~comment-region~ acting on a src block will call ~org-edit-src~ and indent/comment from there.
The ~org-edit-src~ machinery replaces the original buffer with the src-edit buffer contents, and in doing so screws up the ~save-excursion~ calls from ~indent-region~ and ~comment-region~.
Because of this, calling ~indent-region~ or ~comment-region~ inside a src-block sends the cursor to the beginning of the block.
The attached patch uses the ~replace-buffer-contents~ function when available in emacs >= 26.1 to fix this issue.
There's also a remaining issue with the ~undo-boundary~ call in ~org-edit-src-exit~. Calling ~undo~ after ~indent-region~ or ~comment-region~ will send the cursor to the beginning of the src block
Hi, The attached patch fixes this issue for emacs >= 26.1.It also fixes a similar issue where comment-line moves the cursor to the beginning of the block aswell.Can this patch be applied ?
Sébastien
0001-org-edit-src-Use-replace-buffer-contents.patch
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |