I’m trying to add a test (which should fail at the moment, representing an org-mode bug), but it seems like each ‘should’ form is actually nondeterministic. The first form returns nil on the first eval and t on subsequent evals, its behavior resetting upon any command, and the second form does the inverse, returning t on the first eval and nil on subsequent evals. Is this behavior expected? (ert-deftest test-org/org-next-visible-heading () (should (org-test-with-temp-text "* A\n** B\n\n\n* C" (org-overview) (org-cycle) (org-cycle) (org-next-visible-heading 1) (and (bolp) (org-at-heading-p)))) (should (org-test-with-temp-text "* A\n** B\n\n\n* C" (org-overview) (org-cycle) (org-cycle) (org-cycle) (org-next-visible-heading 1) (and (bolp) (org-at-heading-p)))))
Hello,
Kevin Liu <kevin@nivekuil.com> writes:
> I’m trying to add a test (which should fail at the moment, representing
> an org-mode bug), but it seems like each ‘should’ form is actually
> nondeterministic. The first form returns nil on the first eval and t on
> subsequent evals, its behavior resetting upon any command, and the
> second form does the inverse, returning t on the first eval and nil on
> subsequent evals.
>
> Is this behavior expected?
>
> (ert-deftest test-org/org-next-visible-heading ()
> (should
> (org-test-with-temp-text "* A\n** B\n\n\n* C"
> (org-overview)
> (org-cycle)
> (org-cycle)
> (org-next-visible-heading 1)
> (and (bolp) (org-at-heading-p))))
You cannot call `org-cycle' consecutively without care, because it
checks `last-command' and `this-command'. You need to fake their values
before calling `org-cycle' again.
Regards,
--
Nicolas Goaziou
On 30 May 2020 09:09, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> You cannot call `org-cycle' consecutively without care, because it
> checks `last-command' and `this-command'. You need to fake their values
> before calling `org-cycle' again.
Good to know, thanks.
Relatedly, would you be willing to take a look at the bug at hand with
(org-next-visible-headline)? I think the recent rewrite has changed its
behavior in a way outlined by my test cases. Specifically, not always
landing on a headline will break speed keys.
Hello,
Kevin Liu <kevin@nivekuil.com> writes:
> Relatedly, would you be willing to take a look at the bug at hand with
> (org-next-visible-headline)?
I just fixed it, IIUC. Thank you.
Regards,
--
Nicolas Goaziou
On 31 May 2020 04:09, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> I just fixed it, IIUC. Thank you.
It works indeed. However, I believe I have found another bug :)
Try these commands with the following org file; it appears to fail to land on a heading:
(org-id-goto "105dfe8b-8507-400c-862f-a25882448051")
(org-id-goto "4a3206fc-b2f1-47d6-9876-ea30c24ecbeb")
(org-cycle)
(org-next-visible-heading)
(org-next-previous-heading)
* A
** A1
:PROPERTIES:
:ID: 4a3206fc-b2f1-47d6-9876-ea30c24ecbeb
:END:
blah
** A2
:PROPERTIES:
:ID: 60dbdfd7-04a6-4ef0-86ce-a267c16fb1e9
:END:
blah
** A3
:PROPERTIES:
:ID: 105dfe8b-8507-400c-862f-a25882448051
:END:
blah
* B
On 3 June 2020 09:27, Kevin Liu <kevin@nivekuil.com> wrote:
> (org-next-previous-heading)
Typo; this should be (org-previous-visible-heading)
Hello, Kevin Liu <kevin@nivekuil.com> writes: > Try these commands with the following org file; it appears to fail to land on a heading: > > (org-id-goto "105dfe8b-8507-400c-862f-a25882448051") > (org-id-goto "4a3206fc-b2f1-47d6-9876-ea30c24ecbeb") You only need the last `org-id-goto' call right? Is the call to this function meaningful, or can point be left at the beginning of "A1" headline instead? > (org-cycle) > (org-next-visible-heading) > (org-previous-visible-heading) > > * A > ** A1 > :PROPERTIES: > :ID: 4a3206fc-b2f1-47d6-9876-ea30c24ecbeb > :END: > blah > ** A2 > :PROPERTIES: > :ID: 60dbdfd7-04a6-4ef0-86ce-a267c16fb1e9 > :END: > blah > ** A3 > :PROPERTIES: > :ID: 105dfe8b-8507-400c-862f-a25882448051 > :END: > blah > * B FWIW, I cannot reproduce the issue. Regards, -- Nicolas Goaziou
On 3 June 2020 15:26, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> You only need the last `org-id-goto' call right? Is the call to this
> function meaningful, or can point be left at the beginning of "A1"
> headline instead?
Yes, I should have mentioned that you need to start in overview view.
The idea is to selectively reveal only two subtrees, leaving the middle A2 hidden.
Hello,
Kevin Liu <kevin@nivekuil.com> writes:
> Yes, I should have mentioned that you need to start in overview view.
> The idea is to selectively reveal only two subtrees, leaving the
> middle A2 hidden.
OK. I think I fixed it. Thank you.
Regards,
--
Nicolas Goaziou