2

Org agenda is suddenly broken Symbol’s value as variable is void: org-tag-group-re. How to fix it?


Diagnosis:

The problematic code seems to be this:

;; org-mac-link

(push (expand-file-name "~/.emacs.d/lisp") load-path)
(require 'org-mac-link)
(add-hook 'org-mode-hook (lambda ()
  (define-key org-mode-map (kbd "C-c g") 'org-mac-grab-link)))

Variables in org-tempo and org-agenda stopped functioning after getting this code to work.

Anyone know why this happens?

  • I have this problem too, any luck? – Jeffrey Phillips Freeman Jan 8 at 11:58
  • I used time machine to revert back to the init.el that was working. Then I compared that with the broken one to identify the problematic code. Finally, I ran emacs -q and tested the code in question. I eventually managed to get agenda back to life with most of my customized functions intact. – Sati Jan 8 at 16:04
2

I have a solution that worked for me, after some trial and error. Please bear with me as this is my first time answering a question on StackExchange.

I also had Org agenda break with the error message Symbol's value as variable is void: org-tag-group-re. For me, this occurred while trying to install org-drill.

For context, I'm running Emacs 26.3 on MacOS Catalina, which was installed using homebrew.

Why it broke: The variable org-tag-group-re is a regular expression that usually returns the tags (for example, :work: or :home:) associated with TODO items in agenda files. After investigation I found out that Emacs is using my system's version of org (9.1.9), rather than the most recent version of org (9.3.6 at time of writing). org-tag-group-re is defined in the most recent version of org, but is not defined in the system version of org that Emacs is using, so it has the value nil.

A solution: After reading about lisp libraries and messing around with my init file a bit, I got what may be a working solution. At the beginning of my init file, I added the most recent version of org to my load path and made sure that Emacs would preferentially load newer versions of packages (at Muihlinn's suggestion). The code for that looks like this:

(add-to-list 'load-path "~/.emacs.d/elpa/org*")  
(setq load-prefer-newer t)

Notes: you may need to install the latest version of org if you don't have it already, and it may be located somewhere different. Also, I used the wildcard (*) to make sure that even if I upgrade to a future version of org, I won't have to change my init file. This is related to a similar problem on stackexchange that I saw while researching the problem, but I can't find it again. If you see it and comment the link, I'll add it and give due credit.

| improve this answer | |
  • is load-prefer-new set to t? btw, it should load the compiled (.elc) file – Muihlinn May 22 at 17:34
  • After changing load-prefer-new to t in my init and restarting, I get the same error. I'm afraid I don't know much about compiling or how emacs chooses files to use when starting up. – jmrasband May 22 at 18:06
  • After checking for .elc files, again, I have two of them. One is in my .emacs.d folder and has the definition for org-tag-group-re, while the other is in Emacs.app and doesn't have the definition. – jmrasband May 22 at 18:21
  • it's normal to have two, one comes with emacs distribution, the other is the update from melpa. Supposing that package is correctly installated it should load the updated libs first. – Muihlinn May 22 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.