Subject: bug#51530: 28.0.50; allout cannot advance to next visible heading

From: Stephen Berman <[email-masked]>
Date: Sun, 31 Oct 2021 23:48:12 +0100

On Sun, 31 Oct 2021 16:10:06 -0400 Edmund Kademan <[email-masked]> wrote:

> Eli Zaretskii <[email-masked]> writes:
>
>>> From: Edmund Kademan <[email-masked]>
>>> Date: Sun, 31 Oct 2021 12:26:57 -0400
>>>
>>> When you:
>>>   - are in allout mode and
>>>   - are not truncating lines and
>>>   - have your cursor on the heading of an entry that contains a line so
>>>     long that it wraps around to the left margin and
>>>   - try to run the command allout-next-visible-heading (C-c C-o C-a C-n)
>>> the command never completes.
>>
>> Thanks.
>>
>> I don't use this mode, so could you please send the minimal file
>> needed to reproduce this issue?
>
> Thank you for responding so promptly.  The attached file demonstrates
> the problem.  I have a personal work-around so there's no urgency as
> far as I'm concerned.
>
> -*- mode: allout -*-
>
> * topic 1
> Configure emacs so that
> lines in this topic fit
> the screen without hitting the right
> margin.  To go to topic 2 put
> your cursor on the asterisk
> above and hit "n" to run
> `allout-next-visible-heading'.
>
> * topic 2
> Now with your cursor on topic 2's
> asterisk, hit "n" again to go to
> topic 3.  This time emacs just
> spins its wheels.
> Here is a very long line that wraps around on your display when you are not truncating lines.  Make your emacs window narrow enough so that this displays as at least two "visual" lines.
>
> * topic 3
> You can get here by hitting "n"
> as above if you
> `toggle-truncate-lines' or
> get rid of topic 2's long line.

I can reproduce the problem and the following patch seems to fix it, but
I don't know if it causes undesirable behavior in other cases.

Steve Berman

diff --git a/lisp/allout.el b/lisp/allout.el
index 5102ee7341..c1698c1eb4 100644
--- a/lisp/allout.el
+++ b/lisp/allout.el
@@ -3079,7 +3079,7 @@ allout-next-visible-heading
          (backward (if (< arg 0) (setq arg (* -1 arg))))
 	 (step (if backward -1 1))
          (progress (allout-current-bullet-pos))
-	 prev got)
+	 prev got line-move-visual)

     (while (> arg 0)
       (while (and