Configuration buggs out after installing org-roam

Hi there, I installed org-roam via use-package according to the description on the git-hub page. However, this triggers the following error:

Error running timer ‘org-indent-initialize-agent’: (void-function org-time-add)

…causing my custom agenda view not to work anymore. I deleted the .emacs.d folder and did a fresh install. Same issue. Did someone encountered a similar issue?

Thanks lot in advance.

It is a little hard to pin down what exactly is the cause of your problem from the descrption, but it looks like the sequence of loading packages causes your trouble.

To me the error message reads that org-indent-initalize-agent tries to call function org-time-add, which has not been loaded at the time of calling it. This function is part of the standard Org Mode, so my guess is that your custom code for agenda somehow triggers org-indent-initialize-agent before org-mode (including org-time-add) has been loaded.

I do not know exactly how and when your error is “triggered”, but I have to guess that attempting to load org-roam within after-init-hook is “too early” for your custom agenda view set up.

So… Again still guessing, I think perhaps delaying loading of org-roam like this below (at the time of loading org-mode) might do.

(use-package org-roam
  :hook
  (org-load . org-roam-mode) ;<< org-load-hook, instead of after-init-hook

This can have some other side effects – like you might not be able to use the key bindings you specify until Org Mode has been loaded (together with Org-roam). But that may not be an issue for you.

Reading back what I wrote, there are many holes in the logic. I am not entirely sure if having added Org-roam actually is part of the problem, though – did you not change anything else at all?

Thanks for the reply.

Deleting the “.emacs.d” folder and installing everything from scratch without specified agenda view causes the same issue. The error is constantly shown below the mode-line and appears only after org-roam is installed.

I have not changed a line on my config prior the issue occurred. Although, I have to admit that I am very new to Emacs and org-mode. I started a week ago and I do not have any professional IT background. So I can not exclude issues in my config.

There are some warnings, when first initializing emacs (on the very first start up): “Error (bytecomp): Bytecode overflow”. Not sure if they are related to the issue described above.

I am guessing the config you put in for Org-roam is this from this GitHub repository page:

(use-package org-roam
      :ensure t
      :hook
      (after-init . org-roam-mode)
      :custom
      (org-roam-directory "/path/to/org-files/")
      :bind (:map org-roam-mode-map
              (("C-c n l" . org-roam)
               ("C-c n f" . org-roam-find-file)
               ("C-c n g" . org-roam-graph))
              :map org-mode-map
              (("C-c n i" . org-roam-insert))
              (("C-c n I" . org-roam-insert-immediate))))

What I am suggesting that you try is this:

(use-package org-roam
      :ensure t
      :hook 
      (org-load . org-roam-mode) ; << only change. org-load-hook, instead of after-init-hook
      :custom
      (org-roam-directory "/path/to/org-files/")
      :bind (:map org-roam-mode-map
              (("C-c n l" . org-roam)
               ("C-c n f" . org-roam-find-file)
               ("C-c n g" . org-roam-graph))
              :map org-mode-map
              (("C-c n i" . org-roam-insert))
              (("C-c n I" . org-roam-insert-immediate))))

If this does not change anything, then there are other things I could suggest that you try, but perhaps we can start with it.

If you are really new to Emacs and Org Mode, I could also suggest my step-by-step guide for Org-roam to get you started. It is for Windows users, but even if you are using macOS or Linux, the configuration should be almost identical (save some Windows specific items). It does not use use-package, but more traditional configuration. I consider use-package to be an advanced approach for Emacs configuration (unless you have someone close to you who can sit next to you to guide you on how to use it) – you can switch to use-package rather easily from the transitional way.

one more thing. Since you mentioned the .emacs.d folder, it’s a good idea to make sure either you don’t have .emacs file (directly under your home directory) or it’s empty. Emacs can add it without making you fully aware of it.

Thanks for your help so far. I tried your solution, but it did not solve the issue.

I cleared .emacs everytime, although I do use it to load my config.org via

(org-babel-load-file “~/org/emacs_config.org”)

I finally found the culprit by commenting/uncommenting each section of my config file.

(setq org-startup-indented t)

causes

Error running timer ‘org-indent-initialize-agent’: (void-function org-time-add)

Furthermore, i get the the following error when calling org-agenda:

Symbol’s value as variable is void: org-tag-group-re

and

Wrong number of arguments: (0 . 0), 2

when loading agenda files via

(setq org-agenda-files (list “~/org/tasks.org”))

if these files contain a TODO with SCHEDULE or DEADLINE.

These errors only occurred after installing org-roam. I did not made any changes but commenting/uncommenting these preferences.

I don’t think I can be of much help.

Org-roam does not influence org-agenda nor org-tag-group-re. I believe you when you say that the errors started occurring after you set up Org-roam. But I do not think this sequence of events is the same as direction of causality – Yes, you installed Org-roam and then started getting the error, but this does not necessarily mean Org-roam causes the error.

There appear to be many things you are doing at the same time (e.g. org-babel-load-file is a new piece of information which may or may not be relevant, and use-package, etc.). Causes of the troubles can be anywhere in your configuration.

You don’t have to rely on me, or listen to me; it is your system so you have all the freedom to do whatever you like to do. If this is not helpful to you, please ignore what I say.

Having said this, I have one humble suggestion from experience of trying to get beginners started.

Please, go slow.

Do one thing at a time, and make sure it works before adding a new thing.

Please use Org Mode first, and add a small group of configuration. Does it work? Then add Org Agenda with a small group of configuration. Does it work? Then Org-roam. etc…

The reason why I suggest this is… if you add a lot of configuration in one go, when things do not work the way you like, you would never know what part of it causes the problem.

There is a simple way to start small. Start your Emacs with the -q. I don’t even know what OS you are using, and how you are launching Emacs, but you can do emacs -q to start Emacs without loading your configuration. Or take a backup of your configuration, and delete all of it. Start from zero. You can come back to it once you know how to get things working.

This section of the official manual has the instruction how you can install Org-roam when you start Emacs from zero configuration. My guide has a description of how you can install it, too.

Please go minimal, start small.

You will see there is only a few lines of actual code you need to put into your configuration file (save all the comments).

If you go minimal, then the question soon becomes from “How do I get rid of these errors?” to “How can I add this new thing properly without breaking this cool config I just did?”

Thank you for the tutorials.

I actually did it like you said. I’ve read quite a few tutorials/guides and supplemented my config file line by line, to see what each command does. But I got stuck at org-roam. I’ll repeat that process again, maybe I’ve missed something.

Some of the errors you experience seem to me to indicate that either your Emacs or Org Mode is not working — are they actually working? For instance, this error means the function org-time-add is not recognised by Emacs. I tried if I can reproduce this error by emacs -q; I could not. As soon as I launched Emacs, the function is already recognised.

I cannot even have this error (even if I tried, I would not know how).

How did you get Emacs? What’s the version? What’s your OS? I could help you if you follow the manual or guide.

This is not part of the manual or guide…

Is it possible for me to see you config file by any chance?

I had a 800-ish line config file set up before I’ve found out about org-roam. I use Emacs on MX-Linux, the repo version is 26.1. Probably should update to 27.x.

But please, do not put too much effort into this issue. It may be due to a messy setup on my side.

Find the file here:
https://upload.disroot.org/r/fJzF1DMR#2+nwjg3e2rYMNYXDzqD94ZmtZ57vb4WZkGDy6Nl+dcA=

hmmm…

Looks to be working on my Windows machine.
I am using 27.1. Not sure if 26.1 has an issue.

I only changed the font settings (I don’t have Deja Vu Mono on my machine), and the path to the bin folder for sqlite3.

Sorry, I am not sure what the problem now is.

Thank you for the file. I am honestly impressed with the config file that you shared with me. It is hard to believe that you have only been using Emacs for a week…

I probably should spend some time to learn how to use org-babel-load-file.

How do you get the errors you say you get? I really cannot reproduce any that you reported.

The procedure for me was:

  1. Launch Emacs with emacs -q
  2. Open the (modified) emacs_config.org
  3. Evaluate org-babel-load-file you have on top of the config org file (I also changed the location to where I put the file)

This triggers downloading of packages from MELPA automatically, and loads the generated config el file. I just create some test files in the org-roam-directory you specify. The rest is just normal Org-roam.

EDIT
I also opened Org-agenda, and tried one of your custom ones at the bottom (“I”, I think). I didn’t get any error. It only got an empty agenda as I have no file in the agenda directory.

As the errors you have appear to indicate something may be wrong with Org Mode, and so Emacs itself, you might like to either reinstall Emacs or upgrade it. Do you compile it from source? Or get it from your Linux package manager? In any case, the fact that I can get it working on my Windows machine indicates that the config file is Okay…

I pulled some serious all-nighter the past two weekends and read a lot of articles/tutorials/guides :slight_smile: Emacs looks like the tool I was looking for after I’ve ditched Evernote 3 years ago. Was quite a motivation.

I installed Emacs via the package manager distributed with MX-Linux. The current version is 26.1, 2019-09-23 (Debian-modified). The latest version might help, e.g., trying to install org-roam-bibtex according to your tutorial was not possible. Probably due to outdated version. I will try to install Emacs from source according to the official manual. Never did it before, I’ll report on the outcomes.

Sorry, one more thing. It would be remiss of me if I didn’t mention it to you.

Org version.

emacs -q gives me Org Mode version 9.3 (M-x org-version tells you this). I usually use version 9.4. Your errors seem to be centered around variables and functions of Org Mode missing…

Upgrading Org Mode (you can refer to its manual online) might work and be quicker than building the whole Emacs from source.

Edit:
Okay, you would need Emacs 27.1 for Org-roam-bibtex:

;; Package-Requires: ((emacs "27.1") (org-roam "1.2.2") (bibtex-completion "2.0.0"))

Source

So, I installed Emacs 27.1 from source (dependencies are a pain in the butt). The GUI looks like a 90s MS Windows theme :slight_smile: Anyway, I’ll try with that version.

1 Like

Just a quick update: All issues seem to be resolved. So it was probably due to the version of Emacs. Thanks for your help nobiot.

1 Like