-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
Fix priorities (#784) #785
Conversation
@kristijanhusak The failing tests are unrelated to the changes and also fail locally on master. |
@seflue I don't remember Emacs orgmode supporting this. Can you confirm? |
I am confused and do not understand what you mean with "Emacs not supporting this"? Edit: I just saw in the Git history, that you didn't implement the priority feature yourself. It was implemented by @levouh back in 2021. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I misunderstood what are you fixing here.
Lets just do these minor changes and it's good to go.
Since we added 2 new hl groups we need to make them work by adding them to highlights. This patch should fix it: diff --git a/queries/org/highlights.scm b/queries/org/highlights.scm
index f85a90a..2e737a5 100644
--- a/queries/org/highlights.scm
+++ b/queries/org/highlights.scm
@@ -12,7 +12,9 @@
(item . (expr) @org.keyword.todo @nospell (#org-is-todo-keyword? @org.keyword.todo "TODO"))
(item . (expr) @org.keyword.done @nospell (#org-is-todo-keyword? @org.keyword.done "DONE"))
(item (expr "[" "#" "str" @_priority "]") @org.priority.highest (#org-is-valid-priority? @_priority "highest"))
+(item (expr "[" "#" "str" @_priority "]") @org.priority.high (#org-is-valid-priority? @_priority "high"))
(item (expr "[" "#" "str" @_priority "]") @org.priority.default (#org-is-valid-priority? @_priority "default"))
+(item (expr "[" "#" "str" @_priority "]") @org.priority.low (#org-is-valid-priority? @_priority "low"))
(item (expr "[" "#" "str" @_priority "]") @org.priority.lowest (#org-is-valid-priority? @_priority "lowest"))
(list (listitem (paragraph) @spell))
(body (paragraph) @spell)
|
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.
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.
Add new highlight groups to "Colors" chapter.
994fa58
to
50102c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add highlights since I plan to push some minor changes anyway. Thanks!
* 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>
This PR fixes #784.