From: Eli Zaretskii <eliz@gnu.org>
To: Sebastian Miele <iota@whxvd.name>
Cc: 65734@debbugs.gnu.org
Subject: bug#65734: 29.1.50; kill-whole-line and visibility of Org subtrees
Date: Mon, 04 Sep 2023 18:20:46 +0300 [thread overview]
Message-ID: <8334zu55ip.fsf@gnu.org> (raw)
In-Reply-To: <877cp6atag.fsf@whxvd.name> (message from Sebastian Miele on Mon, 04 Sep 2023 16:44:19 +0200)
> From: Sebastian Miele <iota@whxvd.name>
> Date: Mon, 04 Sep 2023 16:44:19 +0200
>
> In an emacs -Q, create an Org buffer with the following contents:
>
> <-----cut-here----->
> * AB
> ** C
> <-----cut-here----->
>
> Fold the subtree under the heading AB, so that only a single line is
> diplayed (ending in "..."). With point between A and B, hit
> C-S-<backspace> (kill-whole-line).
>
> Expected: The whole _visible_ line, i.e., the entire contents of the
> buffer is erased. Actual behavior: The line with heading C remains.
>
> Contrast this with the same experiment, except that the point is at the
> beginning of the line containing AB when hitting C-S-<backspace>. Then
> the expected behavior happens. And according to the source of
> kill-whole-line, the intended effect indeed is to kill a whole _visible_
> line.
>
> The following patch fixes the issue:
>
> diff --git a/lisp/simple.el b/lisp/simple.el
> index abd587245fe..44221f3fc24 100644
> --- a/lisp/simple.el
> +++ b/lisp/simple.el
> @@ -6649,9 +6649,7 @@ kill-whole-line
> (unless (bobp) (backward-char))
> (point))))
> (t
> - (save-excursion
> - (kill-region (point) (progn (forward-visible-line 0) (point))))
> - (kill-region (point)
> + (kill-region (save-excursion (forward-visible-line 0) (point))
> (progn (forward-visible-line arg) (point))))))
>
> (defun forward-visible-line (arg)
>
> The reason for the issue probably is: Without the patch, the killing
> happens in two stages. The first kill-region kills from the beginning
> of the line until after the A. That kills the leading *. That probably
> somehow triggers Org visibility changes. With the patch applied the
> whole killing happens in one stage, probably without causing an
> intermediate change of visibility.
I'm not sure I understand why this is deemed a problem in Emacs.
Shouldn't Org redefine C-S-<backspace> if the default binding doesn't
suit what happens in Org buffers? Did you discuss this with Org
developers?
Thanks.
next prev parent reply other threads:[~2023-09-04 15:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-04 14:44 bug#65734: 29.1.50; kill-whole-line and visibility of Org subtrees Sebastian Miele
2023-09-04 15:20 ` Eli Zaretskii [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-09-04 16:30 [BUG] kill-whole-line on folded subtrees [9.6.8 (release_9.6.8-3-g21171d @ /home/w/usr/emacs/0/29/0/lisp/org/)] Sebastian Miele
2023-09-05 10:29 ` Ihor Radchenko
2023-09-05 11:54 ` bug#65734: " Eli Zaretskii
2023-09-05 15:25 ` Sebastian Miele
2023-09-05 15:50 ` Eli Zaretskii
2023-09-06 8:23 ` Ihor Radchenko
2023-09-06 12:16 ` Eli Zaretskii
2023-09-06 13:30 ` Sebastian Miele
2023-09-10 16:31 ` Sebastian Miele
2023-09-10 16:57 ` Eli Zaretskii
2023-12-25 18:53 ` Sebastian Miele
2024-01-06 8:58 ` Eli Zaretskii
2024-06-19 14:01 ` Ihor Radchenko
2024-06-22 9:00 ` Eli Zaretskii
2024-06-22 9:51 ` Eli Zaretskii
2024-06-23 19:26 ` bug#65734: 29.1.50; kill-whole-line and visibility of Org subtrees Andrea Corallo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8334zu55ip.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=65734@debbugs.gnu.org \
--cc=iota@whxvd.name \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.