jkitchin / org-ref

org-mode modules for citations, cross-references, bibliographies in org-mode and useful bibtex tools to go with it.
GNU General Public License v3.0
1.36k stars 243 forks source link

org-ref sets `org-agenda-files` somehow #1083

Closed xbc5 closed 1 year ago

xbc5 commented 1 year ago

org-ref (or a dependency) sets org-agenda-files to files under org-directory and in some cases to files in my private (doom) config. It's strange behaviour, but when I disable org-ref it goes away.

I don't see any mention of org-agenda-files in the source, so its possibly a dependency (perhaps some effect org-ref has on org after loading).

I don't know how to debug this (or any issue within Emacs for that matter).

My configs: org-ref; org; other vars.

jkitchin commented 1 year ago

That is pretty strange. I don't know who that would be happening. Maybe something here: https://www.gnu.org/software/emacs/manual/html_node/elisp/Watching-Variables.html could be useful to find out what is causing it.

xbc5 commented 1 year ago

That's quite helpful, although I think I am misusing it. I opened an issue here if you're interested.

Closing for now. Thanks.

xbc5 commented 1 year ago

I just noticed something weird: two lines before the offending line (here), there's a mention of org-ref, which is a builtin roam function. Perhaps some weirdness is going on? I only ask because this issue disappears when I disable org-ref (package), and it doesn't even use org-agenda-files.

What do you think?

jkitchin commented 1 year ago

something is weird for sure. Can you try this instead:

(add-variable-watcher 'org-agenda-files
              (lambda (symbol newval operation where)
            (message "%s set to %s by %s at %s"
                 symbol newval operation where)))

and see what shows in your messages?

xbc5 commented 1 year ago

It might not be useful but I noticed a few things.

There are three significant things of note:

Minor notes:

For brevity:

...
org-agenda-files set to nil by set at nil
org-agenda-files set to (\~/org) by set at nil
...
org-agenda-files set to (my/org-agenda-dir) by set at nil
...
org-agenda-files set to nil by let at nil
...
org-agenda-files set to (my/org-agenda-dir) by unlet at nil
org-agenda-files set to nil by let at nil
...
org-agenda-files set to (my/org-agenda-dir) by unlet at nil
org-agenda-files set to (~/projects/linux/emacs-notes/conf/org/org.el /home/user/org/political_manipulation_with_ai-20230531092425.org /home/user/org/bib/notes/137_emergent_abilities_of_large_language_models.org ...<about 500 more bib/notes/foo.org entries>...) by set at nil [2 times]
...
org-agenda-files set to (~/projects/linux/emacs-notes/conf/org/org.el /home/user/org/political_manipulation_with_ai-20230531092425.org /home/user/org/bib/notes/137_emergent_abilities_of_large_language_models.org ...<about 500 more bib/notes/foo.org entries>...) by unlet at nil

Full messages:

Loading /usr/share/emacs/site-lisp/site-start.d/autoconf-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/cmake-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/desktop-entry-mode-init.el (source)...done
org-agenda-files set to nil by set at nil
org-agenda-files set to (\~/org) by set at nil
Created RFC link.
Created CMC link.
Created caniuse link.
Created reddit link.
Created HN link.
Created SOQ link.
Created SOA link.
Created twitter link.
org-agenda-files set to (my/org-agenda-dir) by set at nil
Waiting for git... [2 times]
Initializing org-roam database...
org-agenda-files set to nil by let at nil
Clearing removed files...done
Processing modified files...done
org-agenda-files set to (my/org-agenda-dir) by unlet at nil
org-agenda-files set to nil by let at nil
Clearing removed files...done
Processing modified files...done
org-agenda-files set to (my/org-agenda-dir) by unlet at nil
org-agenda-files set to (~/projects/linux/emacs-notes/conf/org/org.el /home/user/org/political_manipulation_with_ai-20230531092425.org /home/user/org/bib/notes/137_emergent_abilities_of_large_language_models.org ...<about 500 more bib/notes/foo.org entries>...) by set at nil [2 times]
Parsing bibliography file /home/user/org/bib/refs.bib ...
Resolving cross-references ...
Done (re)loading bibliography.
org-agenda-files set to nil by let at nil
Clearing removed files...done
Processing modified files...done
org-agenda-files set to (~/projects/linux/emacs-notes/conf/org/org.el /home/user/org/political_manipulation_with_ai-20230531092425.org /home/user/org/bib/notes/137_emergent_abilities_of_large_language_models.org ...<about 500 more bib/notes/foo.org entries>...) by unlet at nil
Doom loaded 212 packages across 37 modules in 7.998s
[yas] Check your `yas-snippet-dirs': /home/user/.config/doom/snippets/ is not a directory
[yas] Prepared just-in-time loading of snippets with some errors.  Check *Messages*.
Done (re)loading bibliography. [2 times]
SPC n ESC is undefined
Position saved to mark ring, go back with ‘M-x org-mark-ring-goto’.
Loading /home/user/.config/emacs/.local/cacherecentf...done
Starting new Ispell process aspell with british dictionary...done
Quit
Updating buffer list...
Formats have changed, recompiling...done
Updating buffer list...done
Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help
Quit [2 times]
jkitchin commented 1 year ago

It seems like something happens here:

org-agenda-files set to (my/org-agenda-dir) by unlet at nil
org-agenda-files set to (~/projects/linux/emacs-notes/conf/org/org.el /home/user/org/political_manipulation_with_ai-20230531092425.org /home/user/org/bib/notes/137_emergent_abilities_of_large_language_models.org ...<about 500 more bib/notes/foo.org entries>...) by set at nil [2 times]
Parsing bibliography file /home/user/org/bib/refs.bib ...

especially notable is "by set at nil " It seems notable because it is not "by let", and it seems outside of a let statement. I don't see an obvious place it is set though in org-roam.

If something is cached, it might be in a custom.el file. Try C-h v custom-file to find out where that is, and then open it and see if you find the path in there.

xbc5 commented 1 year ago

Yep, that sorted it -- it was custom.el. Sorry to bother you. I still don't know why the problem went away after disabling org-ref though. I guess we will never know.

Thanks for taking the time to help.