Re: [BUG] buffer displays incorrectly after capture

2022-04-27 Thread Ihor Radchenko
Skip Collins  writes:

> On Wed, Apr 27, 2022 at 4:48 AM Ihor Radchenko  wrote:
>> Fixed in 2d6f26c05 on main. And no, it was not that easy to fix.
>> Captured headlines may or may not need to be unfolded.
>
> Thanks. I confirm that behavior is correct for folded level 1
> headlines. But the problem still exists at level 2 and deeper:
> ...
> 9. Observe that the new level 2 headline still does not appear, but a
> misplaced folding ellipsis does appear at the end:
> * foo...
> ** bar
> more text
> ...

This is not a bug. You will routinely see constructs like this when you
jump to a deeply nested headline in real Org files. Only level 1
headlines are always kept visible by convention (and some people even
argue that this convention should be dropped e.g. in sparse trees).

To deal with such situations, see org-reveal (possibly with prefix
arguments).

Best,
Ihor



Re: [BUG] buffer displays incorrectly after capture

2022-04-27 Thread Skip Collins
On Wed, Apr 27, 2022 at 4:48 AM Ihor Radchenko  wrote:
> Fixed in 2d6f26c05 on main. And no, it was not that easy to fix.
> Captured headlines may or may not need to be unfolded.

Thanks. I confirm that behavior is correct for folded level 1
headlines. But the problem still exists at level 2 and deeper:
1. Open emacs with an empty file:
emacs test.org

2. From emacs, enable auto-revert-mode:
M-x auto-revert-mode

3. From a shell, add text to the file:
echo "* foo\nsome text\n** bar\nmore text\n" >>test.org

4. From emacs, cycle global visibility twice, so that the second level
headline is visible but folded:
S-TAB S-TAB

5. Observe the two folded headlines:
* foo...
** bar...

6. From the shell, add another level 2 headline at the end of the file:
echo "** baz\n" >>test.org

7. Observe that the new level 2 headline is not displayed as expected:
* foo...
** bar...

8. From emacs, move the cursor onto the "** bar" headline and cycle visibility:
TAB

9. Observe that the new level 2 headline still does not appear, but a
misplaced folding ellipsis does appear at the end:
* foo...
** bar
more text
...

10. Cycle global visibility twice:
S-TAB S-TAB

11. Observe the correct display of all headlines:
* foo...
** bar...
** baz



Re: [BUG] buffer displays incorrectly after capture

2022-04-27 Thread Ihor Radchenko
Skip Collins  writes:

> I think this is a real bug. Am I wrong? Seems like it should be easy to fix.

Fixed in 2d6f26c05 on main. And no, it was not that easy to fix.
Captured headlines may or may not need to be unfolded.

Best,
Ihor



[BUG] buffer displays incorrectly after capture

2022-04-07 Thread Skip Collins
I think this is a real bug. Am I wrong? Seems like it should be easy to fix.

On Mon, Apr 4, 2022 at 11:25 AM Skip wrote:
> On Fri, Apr 1, 2022 at 3:46 PM Skip wrote:
> > Another manifestation of the problem shows up when using
> > auto-revert-mode. Starting with the single headline in a folded state
> > as above, when I execute the following command in a shell,
> > echo "* TODO bar :action:" >>capture.org
> > then the capture.org buffer looks like this:
> > * TODO foo :action:...* TODO bar :action:
> >
> > TAB unfolding the first headline shows up like this:
> > * TODO foo :action:
> > some text...* TODO bar :action:
>
> I confirmed that the buffer display bug occurs with emacs -Q. Steps to
> reproduce:
> 1. From a shell, open emacs with an empty file:
> emacs -Q test.org
>
> 2. From emacs, enable auto-revert-mode:
> M-x auto-revert-mode
>
> 3. From another shell, add text to the file:
> echo "* foo\nsome text\n" >>test.org
>
> 4. From emacs, fold the headline:
> S-TAB
>
> 5. From the shell, add more text to the file:
> echo "* bar\n" >>test.org
>
> 6. Observe the incorrect display of the two headlines:
> * foo...* bar
>
> 7. From emacs, fix the buffer display:
> S-TAB
>
> 8. Observe the correct display of the two headlines:
> * foo...
> * bar
>
> This bug seems to trigger when text is added indirectly to an org-mode
> buffer, via both capture and auto-revert. I suspect it would show up
> via refile as well.