org-gcal.el icon indicating copy to clipboard operation
org-gcal.el copied to clipboard

(wrong-type-argument integer-or-marker-p nil)

Open RyanMcCarl opened this issue 7 years ago • 7 comments

(org-gcal-sync) and (org-gcal-fetch) seemed to work once for me, but then I started getting this error:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  org-gcal--archive-old-event()
  org-gcal-sync()
  funcall-interactively(org-gcal-sync)
  call-interactively(org-gcal-sync record nil)
  command-execute(org-gcal-sync record)
  execute-extended-command(nil "org-gcal-sync" "org-gcal-sy")
  funcall-interactively(execute-extended-command nil "org-gcal-sync" "org-gcal-sy")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

Here are my settings (with private credentials removed):

(require 'org-gcal)
(setq org-gcal-client-id "########.apps.googleusercontent.com"
      org-gcal-client-secret "###################"
      org-gcal-file-alist '(("############@gmail.com" .  "~/notes/todo.org")
                            ("##############@import.calendar.google.com" .  "~/notes/todo.org")))

Thank you!

UPDATE: According to the backtrace, this function seems to be causing the problem:

;; Internal
(defun org-gcal--archive-old-event ()
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward org-heading-regexp nil t)
      (goto-char (cdr (org-gcal--timestamp-successor)))
      (let ((elem (org-element-headline-parser (point-max) t))
            (tobj (cadr (org-element-timestamp-parser))))
        (when (>
               (time-to-seconds (time-subtract (current-time) (days-to-time org-gcal-up-days)))
               (time-to-seconds (encode-time 0  (if (plist-get tobj :minute-end)
                                                    (plist-get tobj :minute-end) 0)
                                             (if (plist-get tobj :hour-end)
                                                 (plist-get tobj :hour-end) 24)
                                             (plist-get tobj :day-end)
                                             (plist-get tobj :month-end)
                                             (plist-get tobj :year-end))))
          (org-gcal--notify "Archived event." (org-element-property :title elem))
          (org-archive-subtree))))
    (save-buffer)))

RyanMcCarl avatar Dec 03 '16 23:12 RyanMcCarl

I'm having the same issue

UPDATE: I fixed this problem by removing the file(s) referenced in the alist - and letting org-gcal create them

sunwukung avatar May 10 '17 12:05 sunwukung

@sunwukung can you please share your config where you don't provide the file for the alist. I tried it and it's not working for me :(

minostro avatar Oct 30 '17 18:10 minostro

@minostro: Had the same backtrace signature as you. In my case it turned out that my org/ folder permissions had changed so that the folder was no longer writeable. Quick chmod and I was able to successfully call org-gcal-fetch without failure.

Edit: Hmm... org-gcal-sync/org-gcal-fetch is writing the org files as 644 or rw-r--r--, so subsequent calls fail since they can't write to the files.

jackson15j avatar Feb 20 '18 15:02 jackson15j

@jackson15j I gave up using gcal :(

minostro avatar Feb 21 '18 03:02 minostro

I had this exact issue. I resolved it by following @sunwukung 's guidance to remove the already existing file(s) referenced in the alist and having org-gcal create them by itself.

Here's is my .emacs.d/init.el file (with private credentials removed) -

(require 'org-gcal)
(setq org-gcal-client-id "################################.apps.googleusercontent.com"
	org-gcal-client-secret "########################"
	org-gcal-file-alist '(("###########@gmail.com" .
	"~/schedule.org"))) ; file does not exist currently

nausher avatar Mar 26 '18 05:03 nausher

FWIW following steps worked for me

  1. Delete my org file mentioned in org-gcal-file-alist
  2. touch the file
  3. Run org-gcal-sync

manojm321 avatar Jun 04 '18 17:06 manojm321

Hi everyone! This repository is obsolete - the actively developed fork is now https://github.com/kidd/org-gcal.el, which is also the "org-gcal.el" on MELPA (see #115). I'm one of the maintainers of https://github.com/kidd/org-gcal.el. I can't directly close issues or PRs on this repo, but please download https://github.com/kidd/org-gcal.el and see if your issue or PR is still applicable. If so, open an issue or PR on https://github.com/kidd/org-gcal.el. In any case, you should close your issue or PR in this repo.

telotortium avatar Jun 11 '20 18:06 telotortium