Subject: Re: bug#19102: 24.4; outline-move-subtree-up/down error at last and second-last subtree

From: Stephen Berman <[email-masked]>
Date: Wed, 19 Nov 2014 18:09:52 +0100

On Wed, 19 Nov 2014 17:54:41 +0200 Eli Zaretskii <[email-masked]> wrote:

>> From: Stephen Berman <[email-masked]>
>> Date: Wed, 19 Nov 2014 14:17:25 +0100
>> Cc: [email-masked]
>> 
>> The following patch (against master) seems to fix this, though it could
>> probably be done more elegantly.
>
> Thanks.  Can you explain why the problem happened in the first place?

The error occurs when the sexp `(= (char-after) ?\n)' in
outline-move-subtree-down is evaluated at eob.  This can happen either
when calling outline-move-subtree-down on either of the last two
subtrees, or when calling outline-move-subtree-up on the last subtree.
There are two triggers: (i) finding the end point of the subtree to be
moved up or down, and (ii) finding the insertion point to move the
selected subtree down to.  The patch avoids the error by making sure
there is a line after the final subtree, adding it if necessary and then
deleting the added line after the move.

>> +	;; Make sure we can move forward when needed (bug#19102).
>
> Please only mention the bug number in comments if the code or the rest
> of the comment text do not speak for themselves, and there are some
> subtle issues here that can only be understood by reading the bug
> discussion.  Otherwise, the bug number will appear in the commit log,
> so no need to put it in the code.

That occurred to me when I made the ChangeLog entry in my local tree; if
the patch is accepted, I'll remove the bug number from the comment.

Steve Berman