I am having trouble using org-agenda with org-journal.
Essentially invoking org-agenda and trying to list all todos does not work as intended. I have included the debug trace and associated configuration below.
I think this happens because the org-agenda-get-day-entries returns no results, since the file exists AND has scheduled and deadlined TODOs in the week in question.
What is also wierd, is that I have another machine with the same configuration, but this issue only occurs on a new machine that I am trying to configure. I think this could be because the packages on the old machine are not up to date.
Any help/suggestions are most welcome and appreciated. Thanks a lot.
Debugger entered--Lisp error: (wrong-number-of-arguments (0 . 1) 2)
org-in-archived-heading-p(nil nil)
org-agenda-skip()
org-agenda-get-deadlines()
org-agenda-get-day-entries("/home/anant/journal/20220117.org" (1 17 2022) :deadline :scheduled :timestamp :sexp)
apply(org-agenda-get-day-entries "/home/anant/journal/20220117.org" (1 17 2022) (:deadline :scheduled :timestamp :sexp))
org-agenda-list(nil)
funcall-interactively(org-agenda-list nil)
call-interactively(org-agenda-list)
#f(compiled-function () #<bytecode 0x157424b3837d>)()
funcall(#f(compiled-function () #<bytecode 0x157424b3837d>))
(let nil (funcall '#f(compiled-function () #<bytecode 0x157424b3837d>)))
eval((let nil (funcall '#f(compiled-function () #<bytecode 0x157424b3837d>))))
org-agenda-run-series("Agenda and all TODOs" (((agenda "") (alltodo ""))))
org-agenda(nil)
funcall-interactively(org-agenda nil)
call-interactively(org-agenda record nil)
command-execute(org-agenda record)
execute-extended-command(nil "org-agenda" "org-agenda")
funcall-interactively(execute-extended-command nil "org-agenda" "org-agenda")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
Here is my org-mode related configuration:
(use-package org
:straight t
:config
(org-babel-do-load-languages
'org-babel-load-languages
'((python . t)
(shell . t)
;; (sagemath . t)
))
:init
(add-hook 'org-mode-hook
(lambda () (add-hook 'after-save-hook #'org-babel-tangle
:append :local)))
:custom
(org-enforce-todo-dependencies t)
(org-format-latex-options '(:foreground default :background default :scale 4.0))
(org-latex-packages-alist '(("" "soul" t)
("" "color" t)
("" "ulem" t)
("" "amssymb" t)
("" "amsmath" t)))
;; (org-babel-default-header-args (:session . "none")
;; (:results . "replace")
;; (:exports . "code")
;; (:cache . "no")
;; (:noweb . "no")
;; (:hlines . "yes")
;; (:tangle . "yes"))
(org-babel-default-header-args:sage '((:session . t)
(:results . "output"))))
(use-package org-projectile
:straight t
:demand
:ensure t
:bind (("C-c n p" . org-projectile-project-todo-completing-read)
("C-c c" . org-capture))
:config
(progn
(require 'org-projectile)
(org-projectile-per-project)
(message "Setting up org-projectile")
(setq org-projectile-per-project-filepath "project-todos.org")
(setq org-agenda-files (append org-agenda-files ;; (org-projectile-todo-files)
'("~/.emacs.d/agenda.org")))))
(use-package evil-org
:straight t
:ensure t
:after org
:hook (org-mode . (lambda () evil-org-mode))
:config
(require 'evil-org-agenda)
(evil-org-agenda-set-keys))
(defun lieut/org-start-presentation ()
(interactive)
(org-tree-slide-mode 1)
(org-tree-slide-play-with-timer)
(setq text-scale-mode-amount 3)
(text-scale-mode 1))
(defun lieut/org-end-presentation ()
(interactive)
(text-scale-mode 0)
(org-tree-slide-mode 0))
(use-package org-tree-slide
:ensure t
:straight t
:after org
:commands org-tree-slide-mode
:config
;; (evil-define-key 'normal org-tree-slide-mode-map
;; (kbd "q") 'lieut/org-end-presentation
;; (kbd "C-j") 'org-tree-slide-move-next-tree
;; (kbd "C-k") 'org-tree-slide-move-previous-tree)
(setq org-tree-slide-slide-in-effect nil
org-tree-slide-activate-message "Presentation started."
org-tree-slide-deactivate-message "Presentation ended."
org-tree-slide-header t)
:custom
(org-image-actual-width nil))
PS: I am aware that there is another post: Can't view anything in org-agenda: Wrong number of arguments: (0 . 0), 2 that has a similar issue, however the OP in the case submitted a one line answer that does not help me at all in debugging this any further, since I use vanilla GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4).
EDIT: I set org-element-use-cache
to nil following the suggestion of @NickD , which does get rid of the error, however org-agenda now does not list any TODOs at all.
Unfortunately I cannot post all of the content in the journal file in question, but I created a test TODO entry as follows:
* Saturday, 22 January 2022
:PROPERTIES:
:CREATED: 20220122
:END:
** TODO Test
SCHEDULED: <2022-01-22 Sat 12:00>
I tried to call org-agenda-get-date-entries manually to debug the issue, and this seems to reproduce the error: (Even though org-element-use-cache is set to nil)
Debugger entered--Lisp error: (wrong-number-of-arguments (0 . 1) 2)
org-in-archived-heading-p(nil nil)
org-agenda-skip()
org-agenda-get-deadlines()
org-agenda-get-day-entries("/home/anant/journal/20220117.org" (1 22 2022))
Edit2: Forgot to add org-journal config
(use-package org-journal
:straight t
:defer t
:init
(setq org-journal-prefix-key "C-c j")
:custom
(org-journal-dir "~/journal")
(org-journal-date-format "%A, %d %B %Y")
(org-journal-file-format "%Y%m%d.org")
(org-journal-enable-agenda-integration t)
(org-journal-file-type `weekly)
)
org-element
caching code. Can you add(setq org-element-use-cache nil)
to your init file, restart emacs and try again? If that resolves the issue, please consider submitting a bug report withM-x org-submit-bug-report
. If at all possible, consider including in your bug report, the agenda file that causes this:/home/anant/journal/20220117.org
. OTOH, if that does not resolve the issue, at least you'll have eliminated one large swath of code that could have caused it and we can concentrate on the other large swath of code that remains :-)emacs -q
: I cannot reproduce the problem with the above file andemacs -q
(I had to(require 'org-agenda)
to getorg-agenda-get-day-entries
defined). If that still fails, then post the Org mode version which you can get withM-x org-version
.