dengste / org-caldav

Caldav sync for Emacs orgmode
GNU General Public License v3.0
724 stars 105 forks source link

Org-caldav-sync: Wrong number of arguments: (0 . 0), 1 #238

Open hapst3r opened 3 years ago

hapst3r commented 3 years ago

Hello fellows,

I am in the process of setting up calendar synchronisation using the capabilities of my mail provider (posteo) and org-caldav. Unfortunately, I have not been able to get the org-caldav-sync function to work as expected: I receive a "wrong number of arguments (0 . 0) 1" error.

This is my config (using straight package manager with use-package integration:

(use-package org-caldav
  :config
  (setq org-caldav-delete-calendar-entries nil)
  (setq org-icalendar-timezone "Europe/Berlin")
  (setq org-caldav-url "https://posteo.de:8443/calendars/username")
  (setq org-caldav-calendar-id "someid")
  (setq org-caldav-inbox "~/org/from_life.org")
  (setq org-caldav-files '("~/org/life-calendar.org"))
  (setq org-caldav-save-directory "~/org/")
  (setq org-caldav-backup-file "~/org/org-caldav-backup.org"))

Now, when I want to use the sync command, I am sometimes first asked my username/password for SabreDav. If I use a wrong user id, then I receive a 404 error. If I use the correct ID, I receive the error message already mentioned in the title: Wrong number of arguments: (0 . 0), 1 . I checked the Messages buffer, which says that the error is thrown by org-export-as. With correct url/id, the org-caldav-debug buffer mentions that it checks for connection and generates an ics file - but the mentioned ics file is empty, without content (I used an empty file for starters and have put some appointments in the Posteo calendar).

The error message output after enabling M-x toggle-debug-on-error.

Debugger entered--Lisp error: (wrong-number-of-arguments (0 . 0) 1)
  org-macro-initialize-templates(nil)
  org-export-as(icalendar nil nil t (:ascii-charset utf-8 :ascii-links-to-notes nil))
  #f(compiled-function (file) #<bytecode 0x19a922f92e5a1b14>)("~/org/life-calendar.org")
  mapconcat(#f(compiled-function (file) #<bytecode 0x19a922f92e5a1b14>) ("~/org/life-calendar.org" "~/org/from_life.org") "")
  org-icalendar--combine-files("~/org/life-calendar.org" "~/org/from_life.org")
  apply(org-icalendar--combine-files ("~/org/life-calendar.org" "~/org/from_life.org"))
  org-caldav-generate-ics()
  #f(compiled-function () #<bytecode 0x1379a6c555a6ee2a>)()
  funcall(#f(compiled-function () #<bytecode 0x1379a6c555a6ee2a>))
  (let nil (funcall '#f(compiled-function () #<bytecode 0x1379a6c555a6ee2a>)))
  eval((let nil (funcall '#f(compiled-function () #<bytecode 0x1379a6c555a6ee2a>))))
  org-caldav-sync-calendar()
  org-caldav-sync()
  funcall-interactively(org-caldav-sync)
  call-interactively(org-caldav-sync record nil)
  command-execute(org-caldav-sync record)
  execute-extended-command(nil "org-caldav-sync")

I believe to have found the source of the error. As assumed, the problem is the org-export-as function, which is defined in the ox-icalendar.el file. When I try to evaluate it on its own, it errors out. This is a bit confusing considering that it seems to have all the required arguments (as per docstring) and even fails (same error) if I call it only with the mandatory argument.

This is the function and expected inputs, followed by the function in the above named file, followed by the "reduced" function call.

(org-export-as BACKEND &optional SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)

(org-export-as
               'icalendar nil nil t
               '(:ascii-charset utf-8 :ascii-links-to-notes nil))

(org-export-as 'icalendar)

Any suggestions and tips on how to solve this issue are very welcome :)

Have a good day, folks!