agenda file restrictions no longer work with org-ql-block
- Langage dominant
- Emacs Lisp
- Étoiles
- 1.6k
- Forks
- 120
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
### OS/platform
Linux (Ubuntu 24.04)
### Emacs version and provenance
Emacs 30
### Emacs command
emacs
### Org version and provenance
9.7.39
### org-ql package version and provenance
commit 4b8330a
### Actions taken
1) Define a custom agenda view, for example the same one as in the README
```
(setq org-agenda-custom-commands
'(("ces" "Custom: Agenda and Emacs SOMEDAY [#A] items"
((org-ql-block '(and (todo "SOMEDAY")
(tags "Emacs")
(priority "A"))
((org-ql-block-header "SOMEDAY :Emacs: High-priority")))
(agenda)))))
```
2) Switch buffer to any org buffer
3) Run that agenda view with the agenda restricted to that file
### Observed results
There is an error
### Expected results
Not to be an error
### Backtrace
```elisp
Debugger entered--Lisp error: (wrong-type-argument stringp t)
org-ql-block((and (todo "SOMEDAY") (tags "Emacs") (priority "A")))
#f(compiled-function () #)()
funcall(#f(compiled-function () #))
(let ((org-ql-block-header '#("SOMEDAY :Emacs: High-priority" 0 29 (face org-agenda-structure)))) (funcall '#f(compiled-function () #)))
eval((let ((org-ql-block-header '#("SOMEDAY :Emacs: High-priority" 0 29 (face org-agenda-structure)))) (funcall '#f(compiled-function () #))))
org-agenda-run-series("Custom: Agenda and Emacs SOMEDAY [#A] items" (((org-ql-block '(and (todo "SOMEDAY") (tags "Emacs") (priority "A")) ((org-ql-block-header #("SOMEDAY :Emacs: High-priority" 0 29 (face org-agenda-structure))))) (agenda))))
#(nil)
apply(# nil)
org-agenda(nil)
funcall-interactively(org-agenda nil)
command-execute(org-agenda)
```
### Etc.
I debugged the issue and I know what happens, that's why I didn't bother to fill in properly the detailed versions information. This is the timeline of the bug:
Originally I assume that agenda file restrictions worked, but subtree restrictions didn't, so https://github.com/alphapapa/org-ql/issues/84 was reported an it was fixed with https://github.com/alphapapa/org-ql/commit/0f5cf5eff320cd718d60359d4562430955719040. I assume that at the time, file restrictions kept working.
That fix relies on `org-agenda-restrict` value being a buffer, since as we can see the code does `(with-current-buffer org-agenda-restrict ...)`
But if we see the `org-agenda-restrict` documentation, it says:
```
Non-nil means agenda restriction is active.
This is an internal flag indicating either temporary or extended
agenda restriction. Specifically, it is set to t if the agenda
is restricted to an entire file, and is set to the corresponding
buffer if the agenda is restricted to a part of a file, e.g. a
region or a subtree. In the latter case,
‘org-agenda-restrict-begin’ and ‘org-agenda-restrict-end’ are set
to the beginning and the end of the part.
```
So I guess at some point the possible values of that variable changed and the value t started being allowed, probably in commit https://cgit.git.savannah.gnu.org/cgit/org-mode.git/commit/?id=c57b03032380de519bafcf903ca9236668038d4e
I guess that since then file restrictions are broken in org-ql
I reverted that commit and then file restriction works (but then subtree restriction doesn't work again)
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.