org-element: Do not require 'org

This commit is contained in:
Nicolas Goaziou 2019-03-03 23:01:11 +01:00
parent 8ffe341989
commit d4827ea53f
1 changed files with 47 additions and 15 deletions

View File

@ -58,20 +58,52 @@
;;; Code: ;;; Code:
(require 'org)
(require 'avl-tree) (require 'avl-tree)
(require 'cl-lib) (require 'cl-lib)
(require 'org-macs)
(require 'ol)
(require 'org-entities)
(require 'org-footnote)
(require 'org-list)
(require 'org-macro)
(require 'org-table)
(declare-function org-link-expand-abbrev "ol" (link)) (declare-function org-at-heading-p "org" (&optional _))
(declare-function org-link-types "ol" ()) (declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
(declare-function org-link-unescape "ol" (str)) (declare-function org-escape-code-in-string "org-src" (s))
(declare-function org-find-visible "org" ())
(defvar org-link-translation-function) (declare-function org-reduced-level "org" (l))
(defvar org-link-types-re) (declare-function org-unescape-code-in-string "org-src" (s))
(defvar org-link-angle-re) (declare-function outline-next-heading "org" ())
(defvar org-link-plain-re) (declare-function outline-previous-heading "org" ())
(defvar org-link-bracket-re)
(defvar org-archive-tag)
(defvar org-clock-line-re)
(defvar org-closed-string)
(defvar org-comment-string)
(defvar org-complex-heading-regexp)
(defvar org-dblock-start-re)
(defvar org-deadline-string)
(defvar org-done-keywords)
(defvar org-drawer-regexp)
(defvar org-edit-src-content-indentation)
(defvar org-emph-re)
(defvar org-emphasis-regexp-components)
(defvar org-keyword-time-not-clock-regexp)
(defvar org-match-substring-regexp)
(defvar org-odd-levels-only)
(defvar org-outline-regexp-bol)
(defvar org-planning-line-re)
(defvar org-property-drawer-re)
(defvar org-property-format)
(defvar org-property-re)
(defvar org-scheduled-string)
(defvar org-src-preserve-indentation)
(defvar org-tags-column)
(defvar org-time-stamp-formats)
(defvar org-todo-regexp)
(defvar org-ts-regexp-both)
(defvar org-verbatim-re)
;;; Definitions And Rules ;;; Definitions And Rules
@ -101,7 +133,7 @@ specially in `org-element--object-lex'.")
(setq org-element-paragraph-separate (setq org-element-paragraph-separate
(concat "^\\(?:" (concat "^\\(?:"
;; Headlines, inlinetasks. ;; Headlines, inlinetasks.
org-outline-regexp "\\|" "\\*+ " "\\|"
;; Footnote definitions. ;; Footnote definitions.
"\\[fn:[-_[:word:]]+\\]" "\\|" "\\[fn:[-_[:word:]]+\\]" "\\|"
;; Diary sexps. ;; Diary sexps.
@ -127,7 +159,7 @@ specially in `org-element--object-lex'.")
;; LaTeX environments. ;; LaTeX environments.
"\\\\begin{\\([A-Za-z0-9*]+\\)}" "\\|" "\\\\begin{\\([A-Za-z0-9*]+\\)}" "\\|"
;; Clock lines. ;; Clock lines.
(regexp-quote org-clock-string) "\\|" "CLOCK:" "\\|"
;; Lists. ;; Lists.
(let ((term (pcase org-plain-list-ordered-item-terminator (let ((term (pcase org-plain-list-ordered-item-terminator
(?\) ")") (?. "\\.") (_ "[.)]"))) (?\) ")") (?. "\\.") (_ "[.)]")))
@ -1733,7 +1765,7 @@ Return a list whose CAR is `clock' and CDR is a plist containing
(save-excursion (save-excursion
(let* ((case-fold-search nil) (let* ((case-fold-search nil)
(begin (point)) (begin (point))
(value (progn (search-forward org-clock-string (line-end-position) t) (value (progn (search-forward "CLOCK:" (line-end-position) t)
(skip-chars-forward " \t") (skip-chars-forward " \t")
(org-element-timestamp-parser))) (org-element-timestamp-parser)))
(duration (and (search-forward " => " (line-end-position) t) (duration (and (search-forward " => " (line-end-position) t)
@ -1758,7 +1790,7 @@ Return a list whose CAR is `clock' and CDR is a plist containing
(defun org-element-clock-interpreter (clock _) (defun org-element-clock-interpreter (clock _)
"Interpret CLOCK element as Org syntax." "Interpret CLOCK element as Org syntax."
(concat org-clock-string " " (concat "CLOCK: "
(org-element-timestamp-interpreter (org-element-timestamp-interpreter
(org-element-property :value clock) nil) (org-element-property :value clock) nil)
(let ((duration (org-element-property :duration clock))) (let ((duration (org-element-property :duration clock)))
@ -5526,7 +5558,7 @@ the process stopped before finding the expected result."
(defconst org-element--cache-sensitive-re (defconst org-element--cache-sensitive-re
(concat (concat
org-outline-regexp-bol "\\|" "^\\*+ " "\\|"
"\\\\end{[A-Za-z0-9*]+}[ \t]*$" "\\|" "\\\\end{[A-Za-z0-9*]+}[ \t]*$" "\\|"
"^[ \t]*\\(?:" "^[ \t]*\\(?:"
"#\\+\\(?:BEGIN[:_]\\|END\\(?:_\\|:?[ \t]*$\\)\\)" "\\|" "#\\+\\(?:BEGIN[:_]\\|END\\(?:_\\|:?[ \t]*$\\)\\)" "\\|"