From 14d6f95bec975d882d5d0a047e81c74a1cd89edc Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 25 Apr 2020 15:58:33 +0200 Subject: [PATCH] element: Tiny refactoring * lisp/org-element.el (org-element-object-restrictions): Use `minimal-set' to express the common denominator between restrictions. --- lisp/org-element.el | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 2c625e706..ac41b7650 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -329,7 +329,9 @@ match group 2. Don't modify it, set `org-element-affiliated-keywords' instead.") (defconst org-element-object-restrictions - (let* ((standard-set (remq 'table-cell org-element-all-objects)) + (let* ((minimal-set '(bold code entity italic latex-fragment strike-through + subscript superscript underline verbatim)) + (standard-set (remq 'table-cell org-element-all-objects)) (standard-set-no-line-break (remq 'line-break standard-set))) `((bold ,@standard-set) (footnote-reference ,@standard-set) @@ -340,23 +342,20 @@ Don't modify it, set `org-element-affiliated-keywords' instead.") (keyword ,@(remq 'footnote-reference standard-set)) ;; Ignore all links in a link description. Also ignore ;; radio-targets and line breaks. - (link bold code entity export-snippet inline-babel-call inline-src-block - italic latex-fragment macro statistics-cookie strike-through - subscript superscript underline verbatim) + (link export-snippet inline-babel-call inline-src-block macro + statistics-cookie ,@minimal-set) (paragraph ,@standard-set) ;; Remove any variable object from radio target as it would ;; prevent it from being properly recognized. - (radio-target bold code entity italic latex-fragment strike-through - subscript superscript underline superscript) + (radio-target ,@minimal-set) (strike-through ,@standard-set) (subscript ,@standard-set) (superscript ,@standard-set) ;; Ignore inline babel call and inline source block as formulas ;; are possible. Also ignore line breaks and statistics ;; cookies. - (table-cell bold code entity export-snippet footnote-reference italic - latex-fragment link macro radio-target strike-through - subscript superscript target timestamp underline verbatim) + (table-cell export-snippet footnote-reference link macro radio-target + target timestamp ,@minimal-set) (table-row table-cell) (underline ,@standard-set) (verse-block ,@standard-set))) @@ -366,10 +365,6 @@ key is an element or object type containing objects and value is a list of types that can be contained within an element or object of such type. -For example, in a `radio-target' object, one can only find -entities, latex-fragments, subscript, superscript and text -markup. - This alist also applies to secondary string. For example, an `headline' type element doesn't directly contain objects, but still has an entry since one of its properties (`:title') does.")