Each time I launch Emacs, org-agenda-files
is reset to nil
. I can C-h v org-agenda-files
, which confirms that the value of the variable is nil
.
I have the following in .emacs.d/package-init.el
:
(use-package org
:ensure t
:config
(setq org-agenda-files (quote ("~/org/"))
org-startup-indented 1
org-default-notes-file (concat org-directory "/inbox.org")
org-refile-targets '(
(nil :maxlevel . 9)
(org-agenda-files :maxlevel . 9)
)
org-agenda-window-setup 'current-window
org-agenda-restore-windows-after-quit t
)
(define-key global-map "\C-cc" 'org-capture)
(global-set-key (kbd "C-c l") 'org-store-link)
(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c c") 'org-capture)
(add-hook 'org-mode-hook 'turn-on-flyspell)
)
Everything else under the :config
for org mode is getting set correctly.
What’s really strange is that if I open the package config file as a buffer and M-x eval-buffer
, org-agenda-files
gets set correctly, which I can confirm by using help on the variable.
How is this possible?
emacs -Q
(no init file), to narrow things further. (If you don't see the problem without using your init file, then bisect your init file to find the culprit.) – Drew Feb 19 '20 at 21:28package-init.el
? AFAIK, emacs only loads~/.emacs
or~/.emacs.d/init.el
- right? – NickD Feb 20 '20 at 1:49(debug-on-variable-change 'org-agenda-files)
before youruse-package
form and restart Emacs. The debugger should be triggered at least once at theuse-package
command. You can continue by pressingc
. If the debugger is triggered a second time the stack-trace should show you the culprit. Maybe the debugger is never triggered. That would indicate that the variable is never set. Could be because the init file is not loaded or becauseuse-package
does not what you expect. – Tobias Feb 20 '20 at 10:03