I have an org-file with a todo list organised by weeks, like the following:

* Sunday
** DONE Ask in StackExchange.
SCHEDULED: <2019-06-28 Fri 13:00-14:00>

* Monday
** TODO Get an answer
** TODO Get solved my problem
* Tuesday
* Wednesday
* Thursday
* Friday
* Saturday

However, suddely and automatically it rearrange eliminating my order by days in a week to the following format:

* Ask in StackExchange
:LINK:     Go to gcal web page
:ID: 07llhrrtc5s20ea89gqqrs90g5_20190725T210000Z

<2019-06-28 Fri 13:00-14:00>

* Get an answer
* Get solved my problem

Why is it changing automatically?, and how can I avoid this behavior and keep my order by weeks?


Here is my org-config.

(add-to-list 'load-path (expand-file-name "~/git/org-mode/lisp"))
(add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
(require 'org)

;; new line at 80th column
(add-hook 'org-mode-hook '(lambda () (setq fill-column 80)))
(add-hook 'org-mode-hook 'turn-on-auto-fill)
;; ORG alert
(setq alert-default-style 'libnotify)
;;; Standard key bindings
;;(global-set-key "\C-cl" 'org-store-link)
;;(global-set-key "\C-ca" 'org-agenda)
;;(global-set-key "\C-cb" 'org-iswitchb)

;;directory of agenda files

(setq org-agenda-files '("~/Documents/Agenda/"))

;; group all elements of agenda
(setq org-agenda-custom-commands
    '(("c" "Simple agenda view"
       ((agenda "")
       (alltodo "")))))

;;; Sync with google calendar
(require 'org-gcal)
(setq org-gcal-client-id "" ;; here Personal_info
  org-gcal-client-secret "" ;; here Secret_key
  org-gcal-file-alist '(("" .  "~/Documents/Agenda/todo.org") ;; email account

;;(add-hook 'org-agenda-mode-hook (lambda () (org-gcal-sync) ))
;;(add-hook 'org-capture-after-finalize-hook (lambda () (org-gcal-sync) ))

;;; Org calfw
;;(add-to-list 'load-path "~/.emacs.d/emacs-calfw")
;;(require 'calfw)
;;(require 'calfw-org)

;;; Org-ref
;;;; This is for make available org-ref in Melpa
(add-to-list 'package-archives
         '("melpa" . "http://melpa.org/packages/") t)
(when (< emacs-major-version 24)
;; For compatibility
(add-to-list 'package-archives '("gnu" .     "http://elpa.gnu.org/packages/")))

(require 'org-ref)

Additional info: The message when this behavior occurs is:

OAuth token expired. Now trying to refresh-token

  • 1
    Is this file the ~/Documents/Agenda/todo.org that you mention in org-gcal-file-alist? If so, I would turn off the org-gcal stuff and see if the problem goes away. [Disclaimer: I know nothing about org-gcal]
    – NickD
    Commented Jun 29, 2019 at 23:27
  • Yes, it is. I have followed the recommendation, and I am not having a problem. However, I would like to keep working the org.gcal because it is essential to sync my org-file with my google account.
    – Irbin B.
    Commented Jul 9, 2019 at 19:24
  • I would open an issue with org-gcal.
    – NickD
    Commented Jul 9, 2019 at 20:31


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.