Browse Source

org-element-cache-map: Do not byte-compile FUNC in older Emacs

* lisp/org-element.el (org-element-cache-map): Fix reported bug [1]
when some agenda items are missing when `org-element-cache-map' is
called from `org-agenda-get-scheduled'.  Byte compilation of FUNC
matcher somehow fails to produce equivalent function in Emacs <28.

[1] https://list.orgmode.org/87tuha62rq.fsf@localhost/T/#t
Ihor Radchenko 4 years ago
parent
commit
717a847d64
1 changed files with 9 additions and 1 deletions
  1. 9 1
      lisp/org-element.el

+ 9 - 1
lisp/org-element.el

@@ -7102,7 +7102,15 @@ of FUNC.  Changes to elements made in FUNC will also alter the cache."
                  continue-flag
                  ;; Byte-compile FUNC making sure that it is as performant
                  ;; as it could be.
-                 (func (if (or (byte-code-function-p func))
+                 (func (if (or (byte-code-function-p func)
+                               ;; FIXME: Working around bug
+                               ;; https://list.orgmode.org/87tuha62rq.fsf@localhost/T/#t
+                               ;; Byte-compilation in
+                               ;; `org-agenda-get-scheduled' call
+                               ;; somehow alters the FUNC result in
+                               ;; Emacs 26 and 27, but not in Emacs
+                               ;; >=28.
+                               (version< emacs-version "28"))
                            func
                          (let ((warning-minimum-log-level :error)
                                (inhibit-message t))