Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

org-timer module load error in emacs

I want to use the pomodoro technique in org-mode as explained in http://orgmode.org/worg/org-gtd-etc.html

I have added the following lines in .emacs file

(add-to-list 'org-modules 'org-timer)

(setq org-timer-default-timer 25)

(add-hook 'org-clock-in-hook '(lambda () 
     (if (not org-timer-current-timer) 
      (org-timer-set-timer '(16))))) 

When starting the emacs the following warning is displayed in the Warnings buffer.

Symbol's value as variable is void: org-modules

I am using org-mode version - 7.7.291.g37db which is cloned from git://orgmode.org/org-mode.git

How to get rid of the error.

like image 359
Talespin_Kit Avatar asked Sep 21 '11 22:09

Talespin_Kit


1 Answers

org-modules is defined in org.el. If you want to add an element to the list, you need to wait until the variable is defined (with a default list). One way to do that is delay the addition until immediately after org.el is loaded:

(defun my-after-load-org ()
  (add-to-list 'org-modules 'org-timer))
(eval-after-load "org" '(my-after-load-org))

Note that add-hook can cope with a variable that isn't defined yet, but add-to-list can't. You could write (setq org-modules '(org-timer)), but that would overwrite the default module list instead of adding to it.

like image 160
Gilles 'SO- stop being evil' Avatar answered Oct 12 '22 08:10

Gilles 'SO- stop being evil'