Browse Source

duration: Avoid recursive load error

* lisp/org-duration.el (org-duration-units): Guard against recursive
load error when org-duration-units is set via the Customize interface
before org-duration is loaded.

This follows the same approach used by erc-nickserv-identify-mode in
the Emacs repository.

Reported-by: Mario Bourgoin <m.bourgoin@gmail.com>
Ref: https://orgmode.org/list/CAM0Tqh+u+L+UgZizJrH+a+W7Lo1stPJgTsRABxD3HobOnOCrNA@mail.gmail.com
Kyle Meyer 4 years ago
parent
commit
273391c978
1 changed files with 5 additions and 1 deletions
  1. 5 1
      lisp/org-duration.el

+ 5 - 1
lisp/org-duration.el

@@ -97,7 +97,11 @@ sure to call the following command:
   :group 'org-agenda
   :version "26.1"
   :package-version '(Org . "9.1")
-  :set (lambda (var val) (set-default var val) (org-duration-set-regexps))
+  :set (lambda (var val)
+         (set-default var val)
+         ;; Avoid recursive load at startup.
+	 (when (featurep 'org-duration)
+           (org-duration-set-regexps)))
   :initialize 'custom-initialize-changed
   :type '(choice
 	  (const :tag "H:MM" h:mm)