* bug#50139: 27.2; An issue with outline-move-subtree-down
@ 2021-08-20 20:15 Alex
2021-08-21 12:59 ` Lars Ingebrigtsen
0 siblings, 1 reply; 4+ messages in thread
From: Alex @ 2021-08-20 20:15 UTC (permalink / raw)
To: 50139
[-- Attachment #1: Type: text/plain, Size: 1747 bytes --]
Consider a buffer in |outline-mode| having the following text (it is
important that the buffer ends in a newline):
* first heading
the body of the first heading
* second heading
the body of the second heading
Now position point on the second heading and invoke |M-x
outline-hide-subtree|, after which go to the first heading and invoke
|M-x outline-move-subtree-down|. On my computer, this resulted in the
first heading appearing to be on the same visual line as the second.
I've figured out why this happens. It is because
|outline-end-of-subtree| works a bit differently depending on whether
the subtree is the last one in the buffer. In this case, point will be
positioned at the end of the buffer, but when the subtree is not the
last one, it will be positioned on the last position of the last line of
the subtree, before the newline which separates it from the next
heading. I think this implementation is more consistent, as it works the
same in both cases:
|(defun outline-end-of-subtree ()
"Move to the end of the current subtree.
More precisely, move to the last position of the last line of the
subtree: the
position before the newline character of that line."
(outline-back-to-heading)
(let ((level (funcall outline-level)))
;; this loop stops at the end of the buffer or on the first heading
whose
;; level is not less than that of the current subtree
(while (and (not (eobp))
(> (progn (outline-next-heading)
(funcall outline-level))
level)))
(if (eobp)
(if (= (char-before) ?\n) (backward-char))
(backward-char)))) |
[-- Attachment #2: Type: text/html, Size: 2224 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#50139: 27.2; An issue with outline-move-subtree-down
2021-08-20 20:15 bug#50139: 27.2; An issue with outline-move-subtree-down Alex
@ 2021-08-21 12:59 ` Lars Ingebrigtsen
2021-08-21 13:19 ` Stephen Berman
0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-21 12:59 UTC (permalink / raw)
To: Alex; +Cc: 50139
[-- Attachment #1: Type: text/plain, Size: 639 bytes --]
Alex <alex.giorev@gmail.com> writes:
> Consider a buffer in outline-mode having the following text (it is important
> that the buffer ends in a newline):
> * first heading
> the body of the first heading
> * second heading
> the body of the second heading
>
> Now position point on the second heading and invoke M-x
> outline-hide-subtree, after which go to the first heading and invoke M-x
> outline-move-subtree-down. On my computer, this resulted in the first heading
> appearing to be on the same visual line as the second.
I'm unable to reproduce this in Emacs 27.2. After following this
recipe, I get a buffer that looks like:
[-- Attachment #2: Type: image/png, Size: 13491 bytes --]
[-- Attachment #3: Type: text/plain, Size: 210 bytes --]
Which seems correct to me.
Is this a complete recipe for reproducing the bug, starting from "emacs -Q"?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#50139: 27.2; An issue with outline-move-subtree-down
2021-08-21 12:59 ` Lars Ingebrigtsen
@ 2021-08-21 13:19 ` Stephen Berman
2021-08-21 13:29 ` Lars Ingebrigtsen
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Berman @ 2021-08-21 13:19 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: Alex, 50139
On Sat, 21 Aug 2021 14:59:59 +0200 Lars Ingebrigtsen <larsi@gnus.org> wrote:
> Alex <alex.giorev@gmail.com> writes:
>
>> Consider a buffer in outline-mode having the following text (it is important
>> that the buffer ends in a newline):
>> * first heading
>> the body of the first heading
>> * second heading
>> the body of the second heading
>>
>> Now position point on the second heading and invoke M-x
>> outline-hide-subtree, after which go to the first heading and invoke M-x
>> outline-move-subtree-down. On my computer, this resulted in the first heading
>> appearing to be on the same visual line as the second.
>
> I'm unable to reproduce this in Emacs 27.2. After following this
> recipe, I get a buffer that looks like:
[...]
> Which seems correct to me.
>
> Is this a complete recipe for reproducing the bug, starting from "emacs -Q"?
Your image looks like you hid the subtree of the first heading, not the
second as in the recipe. Following the recipe exactly, I can reproduce
the problem in Emacs 27 and 28.
Steve Berman
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#50139: 27.2; An issue with outline-move-subtree-down
2021-08-21 13:19 ` Stephen Berman
@ 2021-08-21 13:29 ` Lars Ingebrigtsen
0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-21 13:29 UTC (permalink / raw)
To: Stephen Berman; +Cc: Alex, 50139
Stephen Berman <stephen.berman@gmx.net> writes:
> Your image looks like you hid the subtree of the first heading, not the
> second as in the recipe. Following the recipe exactly, I can reproduce
> the problem in Emacs 27 and 28.
Oh, right; misread that. Yes, when I follow the recipe correctly, I can
reproduce the problem here, too.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-08-21 13:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-20 20:15 bug#50139: 27.2; An issue with outline-move-subtree-down Alex
2021-08-21 12:59 ` Lars Ingebrigtsen
2021-08-21 13:19 ` Stephen Berman
2021-08-21 13:29 ` Lars Ingebrigtsen
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.