From 635710157476239314d7fe5231fbec2163cbe52d Mon Sep 17 00:00:00 2001 From: Max Nikulin Date: Wed, 5 Jul 2023 22:44:33 +0700 Subject: [PATCH v2 1/2] org-element.el: Fix Emacs-26 compatibility * org-element.el (org-element--current-element-re): Use `rx-to-string' instead of `rx' to expand variables. (org-element--cache-setup-change-functions): Avoid multiple variables in `setq-local'. Reported as: Justin to emacs-orgmode. [BUG] org-element loading fails with "regexp" argument not "stringp" Tue, 4 Jul 2023 19:51:44 -0400. https://list.orgmode.org/2ff109c7-b3ec-27ac-e75d-ae5ddac14746@vallon.homeip.net --- lisp/org-element.el | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index bfb1d206e..1c9707573 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -4278,20 +4278,20 @@ ;;; Parsing Element Starting At Point ;; point. (defconst org-element--current-element-re - (rx - (or - (group-n 1 (regexp org-element--latex-begin-environment-nogroup)) - (group-n 2 (regexp org-element-drawer-re-nogroup)) - (group-n 3 (regexp "[ \t]*:\\( \\|$\\)")) - (group-n 7 (regexp org-element-dynamic-block-open-re-nogroup)) - (seq (group-n 4 (regexp "[ \t]*#\\+")) - (or - (seq "BEGIN_" (group-n 5 (1+ (not space)))) - (group-n 6 "CALL:") - (group-n 8 (1+ (not space)) ":"))) - (group-n 9 (regexp org-footnote-definition-re)) - (group-n 10 (regexp "[ \t]*-----+[ \t]*$")) - (group-n 11 "%%("))) + (rx-to-string + `(or + (group-n 1 (regexp ,org-element--latex-begin-environment-nogroup)) + (group-n 2 (regexp ,org-element-drawer-re-nogroup)) + (group-n 3 (regexp "[ \t]*:\\( \\|$\\)")) + (group-n 7 (regexp ,org-element-dynamic-block-open-re-nogroup)) + (seq (group-n 4 (regexp "[ \t]*#\\+")) + (or + (seq "BEGIN_" (group-n 5 (1+ (not space)))) + (group-n 6 "CALL:") + (group-n 8 (1+ (not space)) ":"))) + (group-n 9 (regexp ,org-footnote-definition-re)) + (group-n 10 (regexp "[ \t]*-----+[ \t]*$")) + (group-n 11 "%%("))) "Bulk regexp matching multiple elements in a single regexp. This is a bit more efficient compared to invoking regexp search multiple times.") @@ -6916,8 +6916,8 @@ (defun org-element--cache-setup-change-functions () ;; Clear copied local cache to avoid extra memory usage. ;; We only use cache stored in the base buffer. (when (buffer-base-buffer) - (setq-local org-element--cache nil - org-element--headline-cache nil)) + (setq-local org-element--cache nil) + (setq-local org-element--headline-cache nil)) (add-hook 'before-change-functions #'org-element--cache-before-change nil t) ;; Run `org-element--cache-after-change' early to handle cases -- 2.25.1