0

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)
    )
6
  • This may be a bug in the 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 with M-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 :-)
    – NickD
    Commented Jan 21, 2022 at 14:23
  • Yes, you are right! setting that variable does get rid of the error. However the side effect is that org-agenda does not display any TODOs at all!
    – l13u7anant
    Commented Jan 22, 2022 at 7:53
  • However, I was able to reproduce the same error again manually. I edited the post with this new info
    – l13u7anant
    Commented Jan 22, 2022 at 8:32
  • Try with emacs -q: I cannot reproduce the problem with the above file and emacs -q (I had to (require 'org-agenda) to get org-agenda-get-day-entries defined). If that still fails, then post the Org mode version which you can get with M-x org-version.
    – NickD
    Commented Jan 23, 2022 at 15:52
  • Yes, emacs -q does get rid of the error.
    – l13u7anant
    Commented Feb 2, 2022 at 8:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.