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

org-super-agenda-keep-order breaks for auto groups #207

Open
chasecaleb opened this issue Sep 29, 2021 · 12 comments · May be fixed by #242
Open

org-super-agenda-keep-order breaks for auto groups #207

chasecaleb opened this issue Sep 29, 2021 · 12 comments · May be fixed by #242
Assignees
Labels
Milestone

Comments

@chasecaleb
Copy link

Using (setq org-super-agenda-keep-order t), introduced recently by !167, causes a backtrace with :auto-category or :auto-parent. I didn't test other :auto-* groups, but I'm guessing it's likely to be the case for all of them.

Example agenda view:

(setq org-agenda-custom-commands
      '(("nc" "Next: category" todo ""
         ((org-super-agenda-groups
           `((:auto-category t)))))))

Resulting backtrace when attempting to view it via C-c a n c (some sensitive data replaced with <redacted>):

Debugger entered--Lisp error: (wrong-type-argument buffer-or-string-p (:name "Category: work" :items ...))
  org-entries-lessp((:name "Category: work" :items ...) (:name "Category: prof..." :items ...))
  org-super-agenda--group-items((... ... ... ... ... ... ... ... ... ... ... ... ... ... ...))
  org-super-agenda--filter-finalize-entries(#(<redacted>))
  org-agenda-finalize-entries((... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) todo)
  org-todo-list("")
  #f(compiled-function () #<bytecode 0xf90fd689e6a624d>)()
  funcall(#f(compiled-function () #<bytecode 0xf90fd689e6a624d>))
  (let ((org-super-agenda-groups '((:auto-category t)))) (funcall '#f(compiled-function () #<bytecode 0xf90fd689e6a624d>)))
  eval((let ((org-super-agenda-groups '((:auto-category t)))) (funcall '#f(compiled-function () #<bytecode 0xf90fd689e6a624d>))))
  org-agenda(nil)
  funcall-interactively(org-agenda nil)
  command-execute(org-agenda)

I don't think that this has anything to do with my org files or other config, but let me know if you need more info and I can provide it.


Context:

@alphapapa alphapapa self-assigned this Sep 29, 2021
@alphapapa alphapapa added the bug label Sep 29, 2021
@alphapapa
Copy link
Owner

Thanks for reporting.

@Alexander-Miller Would you be able to take a look at this?

@alphapapa alphapapa added this to the 1.3 milestone Sep 29, 2021
@Alexander-Miller
Copy link
Contributor

Will do.

@Alexander-Miller
Copy link
Contributor

Sorry for the late response, I had the grand idea to first work through whatever came up for my own packages before coming back to this bug ...

Anyway, I have a diagnosis, so now it is time to discuss the treatment. The problem is that due to the :auto-something selector you don't have a list of agenda entries that you can simply re-sort, but a list of lists - entries grouped by their parents, category etc.

There's 2 fixes I see:

  1. Check the super-agenda-groups for the presence of an :auto-* selector and if you find one re-sort every sublist individually. That's the technically correct, but more complex option. I also assume that the nesting won't go deeper than 1 level, otherwise it gets even more complex.
  2. Just don't do it. Only sort if you have a list of strings and document that keeping order won't work for :auto-* selectors. That's the path of least resistance and complexity, though someone might ask for option 1 later on (not me, I'm ok with this option)

I'm fine building either fix - what do you think @alphapapa ?

@chasecaleb
Copy link
Author

chasecaleb commented Feb 15, 2022

  1. Check the super-agenda-groups for the presence of an :auto-* selector and if you find one re-sort every sublist individually. That's the technically correct, but more complex option. I also assume that the nesting won't go deeper than 1 level, otherwise it gets even more complex.

What about doing this recursively? That way it wouldn't be limited to just one level. I think that would be ideal if so.

@chasecaleb
Copy link
Author

Hi @Alexander-Miller, are you still interested in fixing this or should someone else work on it?

@Alexander-Miller
Copy link
Contributor

It's still on the agenda somewhere. I've just haven't been able to dedicate enough time to it since I'm struggling to fight off all the other issues that keep piling on day by day. But I do plan to have a go at this eventually.

@chasecaleb
Copy link
Author

Understandable, thanks for the reply! If I get some spare time to prioritize it I'll try to work on this, but I'm in the same boat as you.

@AndreaOrru
Copy link

AndreaOrru commented Jan 26, 2023

Is there any plan to fix this? Right now I'm just defining explicity groups instead of auto.

@alphapapa
Copy link
Owner

Yes, it is intended to be fixed when time permits.

@Alexander-Miller I'm guessing that recursively sorting the auto-grouped lists should work well enough, if you're still interested in implementing that.

@Alexander-Miller
Copy link
Contributor

@alphapapa
I am. I'll give it another go in the coming days.

Alexander-Miller added a commit to Alexander-Miller/org-super-agenda that referenced this issue Mar 1, 2023
@Alexander-Miller
Copy link
Contributor

PR is up, recursive sorting seems to do the trick. Let me know if anything's amiss.

@alphapapa
Copy link
Owner

It's past time to tag a stable release of v1.3, which has several changes already, so I'm targeting this for v1.4.

@alphapapa alphapapa modified the milestones: 1.3, 1.4 Sep 23, 2023
alphapapa added a commit that referenced this issue Jun 27, 2024
See also <#207>,
but the problem with this test appears to be something else.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants