Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing existing priority breaks with more than three priorities #784

Closed
seflue opened this issue Jul 27, 2024 · 0 comments · Fixed by #785
Closed

Changing existing priority breaks with more than three priorities #784

seflue opened this issue Jul 27, 2024 · 0 comments · Fixed by #785
Labels
bug Something isn't working

Comments

@seflue
Copy link
Contributor

seflue commented Jul 27, 2024

Describe the bug

When I define more priorities then just "highest", "lowest" and "default", then the "intermediate" priority is not recognized as priority when changing an existing priority and a new one is added to the headline.

Steps to reproduce

  1. Define more sophisticated priorities in config, like:
    -- ...
    org_priority_highest = 'A',
    org_priority_default = 'C',
    org_priority_lowest = 'E',
    -- ...
  2. Create a headline with no priority.
  3. Cycle with "Increase priority of headline" through the priorities

Expected behavior

The headline priority should change from [#E] over [#D], [#C], [#B] to [#A] and then nothing again.

Emacs functionality

Bug doesn't exist in Emacs org mode. Priorities are explained here.

Minimal init.lua

...

Screenshots and recordings

No response

OS / Distro

Linux, as always

Neovim version/commit

0.10

Additional context

I already fixed the bug, PR is in the making.

@seflue seflue added the bug Something isn't working label Jul 27, 2024
kristijanhusak pushed a commit that referenced this issue Jul 29, 2024
* test: implement test to expose the bug

* test: add more cases in priority_state_spec

* refactor: make priority_state independent of config

To prepare the fix, we need to avoid a dependency cycle between config
and priority_state, because we will need priority_state in config to
implement the fix.

We inject the needed values, whereever an instance of PriorityState is
created.

* fix: generate missing intermediate priorities

A headline priority gets only detected correctly, if it is part of the
table returned by Config:get_priorities(). While it previously only
returned the priorities explicitly defined by the user, it now uses
PriorityState to generate also intermediate ones. This happens, if the
highest and the lowest priority define a range of more than three
priorities.

* docs: mention new highlight groups

Add new highlight groups to "Colors" chapter.

---------

Co-authored-by: Sebastian Flügge <seflue@users.noreply.github.com>
SlayerOfTheBad pushed a commit to SlayerOfTheBad/orgmode that referenced this issue Aug 16, 2024
* test: implement test to expose the bug

* test: add more cases in priority_state_spec

* refactor: make priority_state independent of config

To prepare the fix, we need to avoid a dependency cycle between config
and priority_state, because we will need priority_state in config to
implement the fix.

We inject the needed values, whereever an instance of PriorityState is
created.

* fix: generate missing intermediate priorities

A headline priority gets only detected correctly, if it is part of the
table returned by Config:get_priorities(). While it previously only
returned the priorities explicitly defined by the user, it now uses
PriorityState to generate also intermediate ones. This happens, if the
highest and the lowest priority define a range of more than three
priorities.

* docs: mention new highlight groups

Add new highlight groups to "Colors" chapter.

---------

Co-authored-by: Sebastian Flügge <seflue@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant