[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org bc29f5de41 038/101: org-element: New `org-element-*
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org bc29f5de41 038/101: org-element: New `org-element-*property*' functions |
Date: |
Sat, 1 Jul 2023 09:59:03 -0400 (EDT) |
branch: externals/org
commit bc29f5de4199e09b923f366dd6ef09ba44d36bb4
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
org-element: New `org-element-*property*' functions
* lisp/org-element.el (org-element-begin):
(org-element-end):
(org-element-contents-begin):
(org-element-contents-end):
(org-element-post-affiliated):
(org-element-post-blank): New functions for fast access to frequently
used element properties. The functions are `setf'-able.
Update all the relevant code in Org to use the new functions instead
of genetic property queries.
---
lisp/ob-core.el | 77 +++++-----
lisp/ob-exp.el | 6 +-
lisp/ob-ref.el | 3 +-
lisp/ob-tangle.el | 9 +-
lisp/oc.el | 78 +++++-----
lisp/ol.el | 9 +-
lisp/org-agenda.el | 18 +--
lisp/org-attach.el | 14 +-
lisp/org-capture.el | 8 +-
lisp/org-clock.el | 6 +-
lisp/org-compat.el | 19 ++-
lisp/org-cycle.el | 5 +-
lisp/org-element.el | 336 ++++++++++++++++++++++++-------------------
lisp/org-fold.el | 8 +-
lisp/org-lint.el | 120 ++++++++--------
lisp/org-list.el | 34 +++--
lisp/org-macro.el | 6 +-
lisp/org-pcomplete.el | 3 +-
lisp/org-src.el | 55 +++----
lisp/org-table.el | 10 +-
lisp/org.el | 346 +++++++++++++++++++++++----------------------
lisp/ox-ascii.el | 2 +-
lisp/ox-texinfo.el | 10 +-
lisp/ox.el | 48 +++----
testing/examples/babel.org | 1 -
25 files changed, 663 insertions(+), 568 deletions(-)
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index e510798ce3..ba647b3bc3 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -65,6 +65,11 @@
(declare-function org-element-context "org-element" (&optional element))
(declare-function org-element-normalize-string "org-element" (s))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-begin "org-element" (node))
+(declare-function org-element-end "org-element" (node))
+(declare-function org-element-post-affiliated "org-element" (node))
+(declare-function org-element-contents-begin "org-element" (node))
+(declare-function org-element-contents-end "org-element" (node))
(declare-function org-element-parent "org-element-ast" (node))
(declare-function org-element-type "org-element-ast" (node &optional
anonymous))
(declare-function org-element-type-p "org-element-ast" (node &optional types))
@@ -717,7 +722,7 @@ a list with the following pattern:
;; If DATUM is provided, make sure we get node
;; properties applicable to its location within
;; the document.
- (org-with-point-at (org-element-property :begin datum)
+ (org-with-point-at (org-element-begin datum)
(org-babel-params-from-properties lang no-eval))
(mapcar (lambda (h)
(org-babel-parse-header-arguments h no-eval))
@@ -1135,7 +1140,7 @@ Return t if a code block was found at point, nil
otherwise."
;; we want to restore this location after executing BODY.
(outside-position
(and (<= (line-beginning-position)
- (org-element-property :post-affiliated element))
+ (org-element-post-affiliated element))
(point-marker)))
(org-src-window-setup 'switch-invisibly))
(when (and (org-babel-where-is-src-block-head element)
@@ -1278,7 +1283,7 @@ buffer."
(let ((,datum (save-match-data (org-element-context))))
(when (org-element-type-p ,datum 'inline-src-block)
(goto-char (match-beginning 0))
- (let ((,end (copy-marker (org-element-property :end ,datum))))
+ (let ((,end (copy-marker (org-element-end ,datum))))
,@body
(goto-char ,end)
(set-marker ,end nil))))))
@@ -1306,7 +1311,7 @@ buffer."
(let ((,datum (save-match-data (org-element-context))))
(when (org-element-type-p ,datum '(babel-call inline-babel-call))
(goto-char (match-beginning 0))
- (let ((,end (copy-marker (org-element-property :end ,datum))))
+ (let ((,end (copy-marker (org-element-end ,datum))))
,@body
(goto-char ,end)
(set-marker ,end nil))))))
@@ -1337,7 +1342,7 @@ buffer."
,datum
'(babel-call inline-babel-call inline-src-block src-block))
(goto-char (match-beginning 0))
- (let ((,end (copy-marker (org-element-property :end ,datum))))
+ (let ((,end (copy-marker (org-element-end ,datum))))
,@body
(goto-char ,end)
(set-marker ,end nil))))))
@@ -1864,13 +1869,13 @@ If the point is not on a source block or within blank
lines after an
src block, then return nil."
(let ((element (or src-block (org-element-at-point))))
(when (org-element-type-p element 'src-block)
- (let ((end (org-element-property :end element)))
+ (let ((end (org-element-end element)))
(org-with-wide-buffer
;; Ensure point is not on a blank line after the block.
(beginning-of-line)
(skip-chars-forward " \r\t\n" end)
(when (< (point) end)
- (prog1 (goto-char (org-element-property :post-affiliated element))
+ (prog1 (goto-char (org-element-post-affiliated element))
(looking-at org-babel-src-block-regexp))))))))
;;;###autoload
@@ -1968,7 +1973,7 @@ buffer or nil if no such result exists."
(let ((element (org-element-at-point)))
(when (or (org-element-type-p element 'keyword)
(< (point)
- (org-element-property :post-affiliated element)))
+ (org-element-post-affiliated element)))
(throw :found (line-beginning-position)))))))))
(defun org-babel-result-names (&optional file)
@@ -2115,11 +2120,11 @@ leave point where new results should be inserted."
(let ((case-fold-search t)) (looking-at org-babel-result-regexp))
(unless (string= (match-string 1) hash)
(let* ((e (org-element-at-point))
- (post (copy-marker (org-element-property :post-affiliated e))))
+ (post (copy-marker (org-element-post-affiliated e))))
;; Delete contents.
(delete-region post
(save-excursion
- (goto-char (org-element-property :end e))
+ (goto-char (org-element-end e))
(skip-chars-backward " \t\n")
(line-beginning-position 2)))
;; Delete RESULT keyword. However, if RESULTS keyword is
@@ -2155,11 +2160,11 @@ to HASH."
;; Results for inline objects are located right after them.
;; There is no RESULTS line to insert either.
(let ((limit (pcase (org-element-type (org-element-parent context))
- (`section (org-element-property
- :end (org-element-parent context)))
- (_ (org-element-property
- :contents-end (org-element-parent context))))))
- (goto-char (org-element-property :end context))
+ (`section (org-element-end
+ (org-element-parent context)))
+ (_ (org-element-contents-end
+ (org-element-parent context))))))
+ (goto-char (org-element-end context))
(skip-chars-forward " \t\n" limit)
(throw :found
(and
@@ -2172,14 +2177,14 @@ to HASH."
(delete-region
(point)
(progn
- (goto-char (org-element-property :end result))
+ (goto-char (org-element-end result))
(skip-chars-backward " \t")
(point)))
(point))))))))
((or `babel-call `src-block)
(let* ((name (org-element-property :name context))
(named-results (and name (org-babel-find-named-result name))))
- (goto-char (or named-results (org-element-property :end context)))
+ (goto-char (or named-results (org-element-end context)))
(cond
;; Existing results named after the current source.
(named-results
@@ -2192,17 +2197,17 @@ to HASH."
;; buffer or outside CONTEXT parent.
((eq (point)
(or (pcase (org-element-type (org-element-parent context))
- ((or `section `org-data) (org-element-property
- :end (org-element-parent
context)))
- (_ (org-element-property
- :contents-end (org-element-parent context))))
+ ((or `section `org-data)
+ (org-element-end (org-element-parent context)))
+ (_ (org-element-contents-end
+ (org-element-parent context))))
(point-max))))
;; Check if next element is an anonymous result below
;; the current block.
((let* ((next (org-element-at-point))
(end (save-excursion
(goto-char
- (org-element-property :post-affiliated next))
+ (org-element-post-affiliated next))
(line-end-position)))
(empty-result-re (concat org-babel-result-regexp "$"))
(case-fold-search t))
@@ -2218,7 +2223,7 @@ to HASH."
;; after the previous element.
(when insert
(save-excursion
- (goto-char (min (org-element-property :end context) (point-max)))
+ (goto-char (min (org-element-end context) (point-max)))
(skip-chars-backward " \t\n")
(forward-line)
(unless (bolp) (insert "\n"))
@@ -2231,7 +2236,7 @@ to HASH."
"Read ELEMENT into emacs-lisp.
Return nil if ELEMENT cannot be read."
(org-with-wide-buffer
- (goto-char (org-element-property :post-affiliated element))
+ (goto-char (org-element-post-affiliated element))
(pcase (org-element-type element)
(`fixed-width
(let ((v (org-trim (org-element-property :value element))))
@@ -2253,17 +2258,17 @@ Return nil if ELEMENT cannot be read."
(save-excursion
(goto-char (match-end 0))
(skip-chars-forward " \r\t\n")
- (<= (org-element-property :end element)
+ (<= (org-element-end element)
(point))))
(org-babel-read-link)
(buffer-substring-no-properties
- (org-element-property :contents-begin element)
- (org-element-property :contents-end element))))
+ (org-element-contents-begin element)
+ (org-element-contents-end element))))
((or `center-block `quote-block `verse-block `special-block)
(org-remove-indentation
(buffer-substring-no-properties
- (org-element-property :contents-begin element)
- (org-element-property :contents-end element))))
+ (org-element-contents-begin element)
+ (org-element-contents-end element))))
(_ nil))))
(defun org-babel-read-result ()
@@ -2450,7 +2455,7 @@ INFO may provide the values of these header arguments (in
the
(progn
(when outside-scope (widen))
(if existing-result (goto-char existing-result)
- (goto-char (org-element-property :end inline))
+ (goto-char (org-element-end inline))
(skip-chars-backward " \t"))
(unless inline
(setq indent (current-indentation))
@@ -2684,19 +2689,19 @@ Leading white space is trimmed."
(let* ((el (or datum (org-element-context))))
(when (org-element-type-p el '(inline-src-block inline-babel-call))
(org-with-wide-buffer
- (goto-char (org-element-property :end el))
+ (goto-char (org-element-end el))
(skip-chars-backward " \t")
(let ((result (save-excursion
(skip-chars-forward
" \t\n"
- (org-element-property
- :contents-end (org-element-parent el)))
+ (org-element-contents-end
+ (org-element-parent el)))
(org-element-context))))
(when (and (org-element-type-p result 'macro)
(string= (org-element-property :key result) "results"))
(delete-region ; And leading whitespace.
(point)
- (progn (goto-char (org-element-property :end result))
+ (progn (goto-char (org-element-end result))
(skip-chars-backward " \t\n")
(point)))))))))
@@ -2724,7 +2729,7 @@ in the buffer."
latex-environment))
(save-excursion
(goto-char (min (point-max) ;for narrowed buffers
- (org-element-property :end element)))
+ (org-element-end element)))
(skip-chars-backward " \r\t\n")
(line-beginning-position 2))
(point))))))
@@ -2827,7 +2832,7 @@ specified as an an \"attachment:\" style link."
(buffer-string))))))
(delete-region body-start
(org-with-wide-buffer
- (goto-char (org-element-property :end element))
+ (goto-char (org-element-end element))
(skip-chars-backward " \t\n")
(line-beginning-position)))
(goto-char body-start)
diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
index ac5f873c8f..40c0dd8e6f 100644
--- a/lisp/ob-exp.el
+++ b/lisp/ob-exp.el
@@ -33,6 +33,8 @@
(declare-function org-element-at-point "org-element" (&optional pom
cached-only))
(declare-function org-element-context "org-element" (&optional element))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-begin "org-element" (node))
+(declare-function org-element-end "org-element" (node))
(declare-function org-element-type "org-element-ast" (node &optional
anonymous))
(declare-function org-escape-code-in-string "org-src" (s))
(declare-function org-export-copy-buffer "ox"
@@ -195,11 +197,11 @@ this template."
nil)
(type type)))
(begin
- (copy-marker (org-element-property :begin element)))
+ (copy-marker (org-element-begin element)))
(end
(copy-marker
(save-excursion
- (goto-char (org-element-property :end element))
+ (goto-char (org-element-end element))
(skip-chars-backward " \r\t\n")
(point)))))
(pcase type
diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el
index 00ff090a90..fd6927ccfe 100644
--- a/lisp/ob-ref.el
+++ b/lisp/ob-ref.el
@@ -60,6 +60,7 @@
(declare-function org-babel-lob-get-info "ob-lob" (&optional datum no-eval))
(declare-function org-element-at-point "org-element" (&optional pom
cached-only))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-post-affiliated "org-element" (node))
(declare-function org-element-type "org-element-ast" (node &optional
anonymous))
(declare-function org-end-of-meta-data "org" (&optional full))
(declare-function org-find-property "org" (property &optional value))
@@ -171,7 +172,7 @@ Emacs Lisp representation of the value of the variable."
(let ((e (org-element-at-point)))
(when (equal (org-element-property :name e) ref)
(goto-char
- (org-element-property :post-affiliated e))
+ (org-element-post-affiliated e))
(pcase (org-element-type e)
(`babel-call
(throw :found
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 67b48931a6..b2b9e44702 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -43,6 +43,7 @@
(declare-function org-element--cache-active-p "org-element" ())
(declare-function org-element-lineage "org-element-ast" (datum &optional types
with-self))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-begin "org-element" (node))
(declare-function org-element-at-point "org-element" (&optional pom
cached-only))
(declare-function org-element-type-p "org-element-ast" (node types))
(declare-function org-heading-components "org" ())
@@ -458,10 +459,10 @@ code blocks by target file."
(org-babel-map-src-blocks (buffer-file-name)
(let ((current-heading-pos
(if (org-element--cache-active-p)
- (or (org-element-property
- :begin (org-element-lineage
- (org-element-at-point)
- 'headline t))
+ (or (org-element-begin
+ (org-element-lineage
+ (org-element-at-point)
+ 'headline t))
1)
(org-with-wide-buffer
(org-with-limited-levels (outline-previous-heading))))))
diff --git a/lisp/oc.el b/lisp/oc.el
index 2d5ecd1000..0a1e629de9 100644
--- a/lisp/oc.el
+++ b/lisp/oc.el
@@ -86,6 +86,12 @@
(declare-function org-element-parse-secondary-string "org-element" (string
restriction &optional parent))
(declare-function org-element-context "org-element" (&optional element))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-begin "org-element" (node))
+(declare-function org-element-end "org-element" (node))
+(declare-function org-element-post-affiliated "org-element" (node))
+(declare-function org-element-post-blank "org-element" (node))
+(declare-function org-element-contents-begin "org-element" (node))
+(declare-function org-element-contents-end "org-element" (node))
(declare-function org-element-parent "org-element-ast" (node))
(declare-function org-element-put-property "org-element-ast" (node property
value))
(declare-function org-element-restriction "org-element" (element))
@@ -494,7 +500,7 @@ S is split at beginning of match group N upon matching
REGEXP against it.
This function assumes S precedes CITATION."
;; When extracting the citation, remove white spaces before it, but
;; preserve those after it.
- (let ((post-blank (org-element-property :post-blank citation)))
+ (let ((post-blank (org-element-post-blank citation)))
(when (and post-blank (> post-blank 0))
(org-element-insert-before (make-string post-blank ?\s) citation)))
(org-element-insert-before
@@ -526,7 +532,7 @@ The function assumes S follows CITATION. Parse tree is
modified by side-effect.
(org-element-insert-before
;; Blanks between citation and punct are now before punct and
;; citation.
- (concat (make-string (or (org-element-property :post-blank citation) 0) ?\s)
+ (concat (make-string (or (org-element-post-blank citation) 0) ?\s)
punct)
citation))
@@ -632,12 +638,12 @@ or from the current buffer."
(let ((contents (org-element-contents citation)))
(cond
((null contents)
- (org-with-point-at (org-element-property :contents-begin citation)
- (narrow-to-region (point) (org-element-property :contents-end
citation))
+ (org-with-point-at (org-element-contents-begin citation)
+ (narrow-to-region (point) (org-element-contents-end citation))
(let ((references nil))
(while (not (eobp))
(let ((reference (org-element-citation-reference-parser)))
- (goto-char (org-element-property :end reference))
+ (goto-char (org-element-end reference))
(push (if keys-only
(org-element-property :key reference)
reference)
@@ -649,8 +655,8 @@ or from the current buffer."
(defun org-cite-boundaries (citation)
"Return the beginning and end strict position of CITATION.
Returns a (BEG . END) pair."
- (let ((beg (org-element-property :begin citation))
- (end (org-with-point-at (org-element-property :end citation)
+ (let ((beg (org-element-begin citation))
+ (end (org-with-point-at (org-element-end citation)
(skip-chars-backward " \t")
(point))))
(cons beg end)))
@@ -659,8 +665,8 @@ Returns a (BEG . END) pair."
"Return citation REFERENCE's key boundaries as buffer positions.
The function returns a pair (START . END) where START and END denote positions
in the current buffer. Positions include leading \"@\" character."
- (org-with-point-at (org-element-property :begin reference)
- (let ((end (org-element-property :end reference)))
+ (org-with-point-at (org-element-begin reference)
+ (let ((end (org-element-end reference)))
(re-search-forward org-element-citation-key-re end t)
(cons (match-beginning 0) (match-end 0)))))
@@ -743,7 +749,7 @@ When removing the last reference, also remove the whole
citation."
(org-with-point-at begin
(skip-chars-backward " \t")
(point)))
- (pos-after-blank (org-element-property :end datum))
+ (pos-after-blank (org-element-end datum))
(first-on-line?
(= pos-before-blank (line-beginning-position)))
(last-on-line?
@@ -768,20 +774,20 @@ When removing the last reference, also remove the whole
citation."
('citation-reference
(let* ((citation (org-element-parent datum))
(references (org-cite-get-references citation))
- (begin (org-element-property :begin datum))
- (end (org-element-property :end datum)))
+ (begin (org-element-begin datum))
+ (end (org-element-end datum)))
(cond
;; Single reference.
((= 1 (length references))
(org-cite-delete-citation citation))
;; First reference, no prefix.
- ((and (= begin (org-element-property :contents-begin citation))
+ ((and (= begin (org-element-contents-begin citation))
(not (org-element-property :prefix citation)))
- (org-with-point-at (org-element-property :begin datum)
+ (org-with-point-at (org-element-begin datum)
(skip-chars-backward " \t")
(delete-region (point) end)))
;; Last reference, no suffix.
- ((and (= end (org-element-property :contents-end citation))
+ ((and (= end (org-element-contents-end citation))
(not (org-element-property :suffix citation)))
(delete-region (1- begin) (1- (cdr (org-cite-boundaries citation)))))
;; Somewhere in-between.
@@ -978,9 +984,9 @@ Return newly created footnote object."
(list 'footnote-reference
(list :label nil
:type 'inline
- :contents-begin (org-element-property :begin citation)
- :contents-end (org-element-property :end citation)
- :post-blank (org-element-property :post-blank
citation)))))
+ :contents-begin (org-element-begin citation)
+ :contents-end (org-element-end citation)
+ :post-blank (org-element-post-blank citation)))))
;; Remove any white space before citation.
(org-cite--set-previous-post-blank citation 0 info)
;; Footnote swallows citation.
@@ -1226,8 +1232,8 @@ and must return either a string, an object, or a
secondary string."
"Fontify CITE with `org-cite' and `org-cite-key' faces.
CITE is a citation object. The function applies `org-cite' face
on the whole citation, and `org-cite-key' face on each key."
- (let ((beg (org-element-property :begin cite))
- (end (org-with-point-at (org-element-property :end cite)
+ (let ((beg (org-element-begin cite))
+ (end (org-with-point-at (org-element-end cite)
(skip-chars-backward " \t")
(point))))
(add-text-properties beg end '(font-lock-multiline t))
@@ -1256,7 +1262,7 @@ from the processor set in `org-cite-activate-processor'."
(save-match-data (funcall activate cite))
;; Move after cite object and make sure to return
;; a non-nil value.
- (goto-char (org-element-property :end cite)))))))
+ (goto-char (org-element-end cite)))))))
;;; Internal interface with Org Export library (export capability)
@@ -1374,7 +1380,7 @@ INFO is the communication channel, as a plist. Parse
tree is modified
by side-effect."
(dolist (cite (org-cite-list-citations info))
(let ((replacement (org-cite-export-citation cite nil info))
- (blanks (or (org-element-property :post-blank cite) 0)))
+ (blanks (or (org-element-post-blank cite) 0)))
(if (null replacement)
;; Before removing the citation, transfer its `:post-blank'
;; property to the object before, if any.
@@ -1419,7 +1425,7 @@ by side effect."
(lambda (keyword)
(when (equal "PRINT_BIBLIOGRAPHY" (org-element-property :key keyword))
(let ((replacement (org-cite-export-bibliography keyword nil info))
- (blanks (or (org-element-property :post-blank keyword) 0)))
+ (blanks (or (org-element-post-blank keyword) 0)))
(pcase replacement
;; Before removing the citation, transfer its
;; `:post-blank' property to the element before, if any.
@@ -1500,7 +1506,7 @@ CONTEXT is the element or object at point, as returned by
`org-element-context'.
;;
;; XXX: Inserting citation in a secondary value is not allowed
;; yet. Is it useful?
- ((let ((post (org-element-property :post-affiliated context)))
+ ((let ((post (org-element-post-affiliated context)))
(and post (< (point) post)))
(let ((case-fold-search t))
(looking-back
@@ -1516,8 +1522,8 @@ CONTEXT is the element or object at point, as returned by
`org-element-context'.
((memq type '(nil paragraph)))
;; So are contents of verse blocks.
((eq type 'verse-block)
- (and (>= (point) (org-element-property :contents-begin context))
- (< (point) (org-element-property :contents-end context))))
+ (and (>= (point) (org-element-contents-begin context))
+ (< (point) (org-element-contents-end context))))
;; In an headline or inlinetask, point must be either on the
;; heading itself or on the blank lines below.
((memq type '(headline inlinetask))
@@ -1542,7 +1548,7 @@ CONTEXT is the element or object at point, as returned by
`org-element-context'.
;; White spaces after an object or blank lines after an element
;; are OK.
((>= (point)
- (save-excursion (goto-char (org-element-property :end context))
+ (save-excursion (goto-char (org-element-end context))
(skip-chars-backward " \r\t\n")
(if (eq (org-element-class context) 'object) (point)
(line-beginning-position 2)))))
@@ -1552,33 +1558,33 @@ CONTEXT is the element or object at point, as returned
by `org-element-context'.
;; At the start of a list item is fine, as long as the bullet is
;; unaffected.
((eq type 'item)
- (> (point) (+ (org-element-property :begin context)
+ (> (point) (+ (org-element-begin context)
(org-current-text-indentation)
(if (org-element-property :checkbox context)
5 1))))
;; Other elements are invalid.
((eq (org-element-class context) 'element) nil)
;; Just before object is fine.
- ((= (point) (org-element-property :begin context)))
+ ((= (point) (org-element-begin context)))
;; Within recursive object too, but not in a link.
((eq type 'link) nil)
((eq type 'table-cell)
;; :contents-begin is not reliable on empty cells, so special
;; case it.
(<= (save-excursion (skip-chars-backward " \t") (point))
- (org-element-property :contents-end context)))
- ((let ((cbeg (org-element-property :contents-begin context))
- (cend (org-element-property :contents-end context)))
+ (org-element-contents-end context)))
+ ((let ((cbeg (org-element-contents-begin context))
+ (cend (org-element-contents-end context)))
(and cbeg (>= (point) cbeg) (<= (point) cend)))))))
(defun org-cite--insert-string-before (string reference)
"Insert STRING before citation REFERENCE object."
- (org-with-point-at (org-element-property :begin reference)
+ (org-with-point-at (org-element-begin reference)
(insert string ";")))
(defun org-cite--insert-string-after (string reference)
"Insert STRING after citation REFERENCE object."
- (org-with-point-at (org-element-property :end reference)
+ (org-with-point-at (org-element-end reference)
;; Make sure to move forward when we're inserting at point, so the
;; insertion can happen multiple times.
(if (char-equal ?\; (char-before))
@@ -1649,7 +1655,7 @@ More specifically,
;; action depends on the point.
(if arg
(org-cite-delete-citation context)
- (let* ((begin (org-element-property :begin context))
+ (let* ((begin (org-element-begin context))
(style-end (1- (org-with-point-at begin (search-forward
":")))))
(if (>= style-end (point))
;; On style part, edit the style.
@@ -1663,7 +1669,7 @@ More specifically,
;; point.
(let* ((references (org-cite-get-references context))
(key (concat "@" (funcall select-key nil))))
- (if (< (point) (org-element-property :contents-begin context))
+ (if (< (point) (org-element-contents-begin context))
(org-cite--insert-string-before key (car references))
(org-cite--insert-string-after key (org-last
references))))))))
;; On a citation reference. If ARG is not nil, remove the
diff --git a/lisp/ol.el b/lisp/ol.el
index a8afcac557..44296dff12 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -56,6 +56,7 @@
(declare-function org-element-lineage "org-element-ast" (datum &optional types
with-self))
(declare-function org-element-link-parser "org-element" ())
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-begin "org-element" (node))
(declare-function org-element-type-p "org-element-ast" (node types))
(declare-function org-element-update-syntax "org-element" ())
(declare-function org-entry-get "org" (pom property &optional inherit
literal-nil))
@@ -755,7 +756,7 @@ White spaces are not significant."
(forward-char -1)
(let ((object (org-element-context)))
(when (org-element-type-p object 'radio-target)
- (goto-char (org-element-property :begin object))
+ (goto-char (org-element-begin object))
(org-fold-show-context 'link-search)
(throw :radio-match nil))))
(goto-char origin)
@@ -1118,7 +1119,7 @@ for internal and \"file\" links, or stored as a parameter
in
(_ path))
;; Prevent fuzzy links from matching themselves.
(and (equal type "fuzzy")
- (+ 2 (org-element-property :begin link)))))
+ (+ 2 (org-element-begin link)))))
(point))))
(unless (and (<= (point-min) destination)
(>= (point-max) destination))
@@ -1224,7 +1225,7 @@ of matched result, which is either `dedicated' or
`fuzzy'."
(let ((context (org-element-context)))
(when (org-element-type-p context 'target)
(setq type 'dedicated)
- (goto-char (org-element-property :begin context))
+ (goto-char (org-element-begin context))
(throw :target-match t))))
nil))))
;; Look for elements named after S, only if not in a headline
@@ -1475,7 +1476,7 @@ is non-nil, move backward."
(pcase (org-element-lineage context 'link t)
(`nil nil)
(link
- (goto-char (org-element-property :begin link))
+ (goto-char (org-element-begin link))
(when (org-invisible-p) (org-fold-show-context 'link-search))
(throw :found t)))))
(goto-char pos)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 485f412e86..eb02335b48 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6340,7 +6340,7 @@ specification like [h]h:mm."
(org-element-property
:hour-end
(org-element-property :deadline el))))
- (goto-char (org-element-property :contents-begin el))
+ (goto-char (org-element-contents-begin el))
(catch :skip
(org-agenda-skip el)
(let* ((s (substring (org-element-property
@@ -6348,7 +6348,7 @@ specification like [h]h:mm."
(org-element-property :deadline el))
1 -1))
(pos (save-excursion
- (goto-char (org-element-property :contents-begin
el))
+ (goto-char (org-element-contents-begin el))
;; We intentionally leave NOERROR
;; argument in `re-search-forward' nil. If
;; the search fails here, something went
@@ -6427,7 +6427,7 @@ specification like [h]h:mm."
(/= deadline current)))
(throw :skip nil))
(save-excursion
- (goto-char (org-element-property :begin el))
+ (goto-char (org-element-begin el))
(let* ((category (org-get-category))
(effort (save-match-data (or (get-text-property
(point) 'effort)
(org-element-property
(intern (concat ":" (upcase org-effort-property))) el))))
@@ -6435,7 +6435,7 @@ specification like [h]h:mm."
(level (make-string (org-element-property :level el)
?\s))
(head (save-excursion
- (goto-char (org-element-property :begin el))
+ (goto-char (org-element-begin el))
(re-search-forward org-outline-regexp-bol)
(buffer-substring-no-properties (point)
(line-end-position))))
(inherited-tags
@@ -6683,7 +6683,7 @@ scheduled items with an hour specification like [h]h:mm."
(org-element-property
:hour-end
(org-element-property :scheduled el))))
- (goto-char (org-element-property :contents-begin el))
+ (goto-char (org-element-contents-begin el))
(catch :skip
(org-agenda-skip el)
(let* ((s (substring (org-element-property
@@ -6691,7 +6691,7 @@ scheduled items with an hour specification like [h]h:mm."
(org-element-property :scheduled el))
1 -1))
(pos (save-excursion
- (goto-char (org-element-property :contents-begin
el))
+ (goto-char (org-element-contents-begin el))
;; We intentionally leave NOERROR
;; argument in `re-search-forward' nil. If
;; the search fails here, something went
@@ -6814,7 +6814,7 @@ scheduled items with an hour specification like [h]h:mm."
org-habit-show-habits-only-for-today))))
(throw :skip nil))
(save-excursion
- (goto-char (org-element-property :begin el))
+ (goto-char (org-element-begin el))
(let* ((category (org-get-category))
(effort (save-match-data
(or (get-text-property (point) 'effort)
@@ -6832,7 +6832,7 @@ scheduled items with an hour specification like [h]h:mm."
(level (make-string (org-element-property :level el)
?\s))
(head (save-excursion
- (goto-char (org-element-property :begin el))
+ (goto-char (org-element-begin el))
(re-search-forward org-outline-regexp-bol)
(buffer-substring (point)
(line-end-position))))
(time
@@ -6868,7 +6868,7 @@ scheduled items with an hour specification like [h]h:mm."
'org-agenda-done)
(todayp 'org-scheduled-today)
(t 'org-scheduled)))
- (habitp (and habitp (org-habit-parse-todo
(org-element-property :begin el)))))
+ (habitp (and habitp (org-habit-parse-todo
(org-element-begin el)))))
(org-add-props item props
'undone-face face
'face (if donep 'org-agenda-done face)
diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index 0f1b0a8c4e..23c581035a 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -45,6 +45,10 @@
(declare-function dired-dwim-target-directory "dired-aux")
(declare-function dired-get-marked-files "dired" (&optional localp arg filter
distinguish-one-marked error))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-begin "org-element" (node))
+(declare-function org-element-end "org-element" (node))
+(declare-function org-element-contents-begin "org-element" (node))
+(declare-function org-element-contents-end "org-element" (node))
(declare-function org-element-type-p "org-element-ast" (node types))
(declare-function org-inlinetask-goto-beginning "org-inlinetask" ())
(declare-function org-inlinetask-in-task-p "org-inlinetask" ())
@@ -744,17 +748,17 @@ It is meant to be added to
`org-export-before-parsing-hook'."
(when (and (org-element-type-p link 'link)
(string-equal "attachment"
(org-element-property :type link)))
- (let* ((description (and (org-element-property :contents-begin link)
+ (let* ((description (and (org-element-contents-begin link)
(buffer-substring-no-properties
- (org-element-property :contents-begin link)
- (org-element-property :contents-end link))))
+ (org-element-contents-begin link)
+ (org-element-contents-end link))))
(file (org-element-property :path link))
(new-link (org-link-make-string
(concat "file:" (org-attach-expand file))
description)))
- (goto-char (org-element-property :end link))
+ (goto-char (org-element-end link))
(skip-chars-backward " \t")
- (delete-region (org-element-property :begin link) (point))
+ (delete-region (org-element-begin link) (point))
(insert new-link)))))))
(defun org-attach-follow (file arg)
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index c8c4dde123..785ef15d67 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -63,6 +63,8 @@
(declare-function org-element-at-point "org-element" (&optional pom
cached-only))
(declare-function org-element-lineage "org-element-ast" (datum &optional types
with-self))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-contents-end "org-element" (node))
+(declare-function org-element-post-affiliated "org-element" (node))
(declare-function org-encrypt-entry "org-crypt" ())
(declare-function org-insert-link "ol" (&optional complete-file link-location
default-description))
(declare-function org-link-make-string "ol" (link &optional description))
@@ -1314,7 +1316,7 @@ may have been stored before."
(point-marker))))
(when item
(let ((i (save-excursion
- (goto-char (org-element-property :post-affiliated item))
+ (goto-char (org-element-post-affiliated item))
(org-current-text-indentation))))
(save-excursion
(goto-char beg)
@@ -1382,8 +1384,8 @@ may have been stored before."
((pred (lambda (e) (eq 'table.el (org-element-property :type e))))
nil)
(table
- (goto-char (org-element-property :contents-end table))
- (narrow-to-region (org-element-property :post-affiliated table)
+ (goto-char (org-element-contents-end table))
+ (narrow-to-region (org-element-post-affiliated table)
(point))
(throw :found t))))
;; No table found. Create it with an empty header.
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index e449e883b4..f8b108bfb4 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -37,6 +37,8 @@
(declare-function calendar-iso-to-absolute "cal-iso" (date))
(declare-function notifications-notify "notifications" (&rest params))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-contents-end "org-element" (node))
+(declare-function org-element-end "org-element" (node))
(declare-function org-element-type "org-element-ast" (node &optional
anonymous))
(declare-function org-element-type-p "org-element-ast" (node types))
(declare-function org-element--cache-active-p "org-element" ())
@@ -1043,7 +1045,7 @@ CLOCK is a cons cell of the form (MARKER START-TIME)."
(while (re-search-backward drawer-re beg t)
(let ((element (org-element-at-point)))
(when (org-element-type-p element 'drawer)
- (when (> (org-element-property :end element) (car clock))
+ (when (> (org-element-end element) (car clock))
(org-fold-hide-drawer-toggle 'off nil element))
(throw 'exit nil)))))))))))
@@ -1607,7 +1609,7 @@ line and position cursor in that line."
(while (re-search-forward drawer-re end t)
(let ((element (org-element-at-point)))
(when (org-element-type-p element 'drawer)
- (let ((cend (org-element-property :contents-end element)))
+ (let ((cend (org-element-contents-end element)))
(if (and (not org-log-states-order-reversed) cend)
(goto-char cend)
(forward-line))
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 30469fe742..a12400ed28 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -56,6 +56,11 @@
(declare-function org-element-type "org-element-ast" (node &optional
anonymous))
(declare-function org-element-type-p "org-element-ast" (node types))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-begin "org-element" (node))
+(declare-function org-element-end "org-element" (node))
+(declare-function org-element-contents-begin "org-element" (node))
+(declare-function org-element-contents-end "org-element" (node))
+(declare-function org-element-post-affiliated "org-element" (node))
(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
(declare-function org-get-heading "org" (&optional no-tags no-todo no-priority
no-comment))
(declare-function org-get-tags "org" (&optional pos local))
@@ -896,10 +901,10 @@ region as a drawer without further ado."
(looking-at-p "^[ \t]*:\\(\\(?:\\w\\|[-_]\\)+\\):[
\t]*$"))
(org-element-at-point)))))
(when (org-element-type-p drawer '(drawer property-drawer))
- (let ((post (org-element-property :post-affiliated drawer)))
+ (let ((post (org-element-post-affiliated drawer)))
(org-fold-region
(save-excursion (goto-char post) (line-end-position))
- (save-excursion (goto-char (org-element-property :end drawer))
+ (save-excursion (goto-char (org-element-end drawer))
(skip-chars-backward " \t\n")
(line-end-position))
flag (if (eq org-fold-core-style 'text-properties) 'drawer 'outline))
@@ -1389,7 +1394,7 @@ ELEMENT is the element at point."
;; Only in inline footnotes, within the definition.
(and (eq (org-element-property :type object) 'inline)
(< (save-excursion
- (goto-char (org-element-property :begin object))
+ (goto-char (org-element-begin object))
(search-forward ":" nil t 2))
(point))))
(otherwise t))))
@@ -1410,7 +1415,7 @@ ELEMENT is the element at point."
;; Ignore checks in code, verbatim and others.
(org--flyspell-object-check-p (org-element-at-point-no-context)))
(let* ((element (org-element-at-point-no-context))
- (post-affiliated (org-element-property :post-affiliated element)))
+ (post-affiliated (org-element-post-affiliated element)))
(cond
;; Ignore checks in all affiliated keywords but captions.
((< (point) post-affiliated)
@@ -1436,7 +1441,7 @@ ELEMENT is the element at point."
(save-excursion
(end-of-line)
(skip-chars-forward " \r\t\n")
- (< (point) (org-element-property :end element)))))
+ (< (point) (org-element-end element)))))
;; Arbitrary list of keywords where checks are meaningful.
;; Make sure point is on the value part of the element.
(keyword
@@ -1448,8 +1453,8 @@ ELEMENT is the element at point."
;; table rows (after affiliated keywords) but some objects
;; must not be affected.
((paragraph table-row verse-block)
- (let ((cbeg (org-element-property :contents-begin element))
- (cend (org-element-property :contents-end element)))
+ (let ((cbeg (org-element-contents-begin element))
+ (cend (org-element-contents-end element)))
(and cbeg (>= (point) cbeg) (< (point) cend)
(org--flyspell-object-check-p element))))))))))
(put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify)
diff --git a/lisp/org-cycle.el b/lisp/org-cycle.el
index d508baa119..703a585c32 100644
--- a/lisp/org-cycle.el
+++ b/lisp/org-cycle.el
@@ -37,6 +37,7 @@
(declare-function org-element-type-p "org-element-ast" (node types))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-post-affiliated "org-element" (node))
(declare-function org-element-lineage "org-element-ast" (datum &optional types
with-self))
(declare-function org-element-at-point "org-element" (&optional pom
cached-only))
(declare-function org-display-inline-images "org" (&optional include-linked
refresh beg end))
@@ -404,8 +405,8 @@ Use `\\[org-edit-special]' to edit table.el tables"))
t)))
(and item
(= (line-beginning-position)
- (org-element-property :post-affiliated
- item)))))
+ (org-element-post-affiliated
+ item)))))
(org-match-line org-outline-regexp))
(or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol))))
(org-cycle-internal-local))
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 8b91bf2c39..6109f677d9 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -549,6 +549,48 @@ value of DATUM `:parent' property."
OBJECT is the object to consider."
(org-element-lineage object org-element-all-elements))
+(defsubst org-element-begin (node)
+ "Get `:begin' property of NODE."
+ (org-element-property :begin node))
+
+(gv-define-setter org-element-begin (value node)
+ `(org-element-put-property ,node :begin ,value))
+
+(defsubst org-element-end (node)
+ "Get `:end' property of NODE."
+ (org-element-property :end node))
+
+(gv-define-setter org-element-end (value node)
+ `(org-element-put-property ,node :end ,value))
+
+(defsubst org-element-contents-begin (node)
+ "Get `:contents-begin' property of NODE."
+ (org-element-property :contents-begin node))
+
+(gv-define-setter org-element-contents-begin (value node)
+ `(org-element-put-property ,node :contents-begin ,value))
+
+(defsubst org-element-contents-end (node)
+ "Get `:contents-end' property of NODE."
+ (org-element-property :contents-end node))
+
+(gv-define-setter org-element-contents-end (value node)
+ `(org-element-put-property ,node :contents-end ,value))
+
+(defsubst org-element-post-affiliated (node)
+ "Get `:post-affiliated' property of NODE."
+ (org-element-property :post-affiliated node))
+
+(gv-define-setter org-element-post-affiliated (value node)
+ `(org-element-put-property ,node :post-affiliated ,value))
+
+(defsubst org-element-post-blank (node)
+ "Get `:post-blank' property of NODE."
+ (org-element-property :post-blank node))
+
+(gv-define-setter org-element-post-blank (value node)
+ `(org-element-put-property ,node :post-blank ,value))
+
(defconst org-element--cache-element-properties
'(:cached
:org-element--cache-sync-key
@@ -569,7 +611,7 @@ Return nil if STRING is nil."
(defun org-element--substring (element beg-offset end-offset)
"Get substring inside ELEMENT according to BEG-OFFSET and END-OFFSET."
(with-current-buffer (org-element-property :buffer element)
- (let ((beg (org-element-property :begin element)))
+ (let ((beg (org-element-begin element)))
(buffer-substring-no-properties
(+ beg beg-offset) (+ beg end-offset)))))
@@ -955,8 +997,8 @@ Return value is a plist."
;; properties.
(org-element-put-property
element :robust-begin
- (let ((contents-begin (org-element-property :contents-begin element))
- (contents-end (org-element-property :contents-end element)))
+ (let ((contents-begin (org-element-contents-begin element))
+ (contents-end (org-element-contents-end element)))
(when contents-begin
(progn (goto-char contents-begin)
(when (looking-at-p org-element-planning-line-re)
@@ -972,19 +1014,19 @@ Return value is a plist."
(point))))))
(org-element-put-property
element :robust-end
- (let ((contents-end (org-element-property :contents-end element))
+ (let ((contents-end (org-element-contents-end element))
(robust-begin (org-element-property :robust-begin element)))
(when contents-end
(when (> (- contents-end 2) robust-begin)
(- contents-end 2)))))
(unless (org-element-property :robust-end element)
(org-element-put-property element :robust-begin nil))
- (goto-char (org-element-property :begin element))
+ (goto-char (org-element-begin element))
(setcar (cdr element)
(nconc
(nth 1 element)
(org-element--get-time-properties)))
- (goto-char (org-element-property :begin element))
+ (goto-char (org-element-begin element))
(setcar (cdr element)
(nconc
(nth 1 element)
@@ -1015,7 +1057,7 @@ parsed as a secondary string, but as a plain string
instead.
Throw `:org-element-deferred-retry' signal at the end."
(with-current-buffer (org-element-property :buffer headline)
- (org-with-point-at (org-element-property :begin headline)
+ (org-with-point-at (org-element-begin headline)
(let* ((begin (point))
(true-level (prog1 (skip-chars-forward "*")
(skip-chars-forward " \t")))
@@ -4632,7 +4674,7 @@ of 1 and a \"phone\" tag, and will return its beginning
position:
(lambda (hl)
(and (= (org-element-property :level hl) 1)
(member \"phone\" (org-element-property :tags hl))
- (org-element-property :begin hl)))
+ (org-element-begin hl)))
nil t)
The next example will return a flat list of all `plain-list' type
@@ -4754,8 +4796,8 @@ Elements are accumulated into ACC."
;; its category.
(let* ((element (org-element--current-element end granularity mode
structure))
(type (org-element-type element))
- (cbeg (org-element-property :contents-begin element)))
- (goto-char (org-element-property :end element))
+ (cbeg (org-element-contents-begin element)))
+ (goto-char (org-element-end element))
;; Fill ELEMENT contents by side-effect.
(cond
;; If element has no contents, don't modify it.
@@ -4770,7 +4812,7 @@ Elements are accumulated into ACC."
(eq type 'section))
(eq type 'headline)))
(org-element--parse-elements
- cbeg (org-element-property :contents-end element)
+ cbeg (org-element-contents-end element)
;; Possibly switch to a special mode.
(org-element--next-mode mode type t)
(and (memq type '(item plain-list))
@@ -4780,7 +4822,7 @@ Elements are accumulated into ACC."
;; GRANULARITY allows it.
((memq granularity '(object nil))
(org-element--parse-objects
- cbeg (org-element-property :contents-end element) element
+ cbeg (org-element-contents-end element) element
(org-element-restriction type))))
(push (org-element-put-property element :parent acc) elements)
;; Update mode.
@@ -4929,20 +4971,20 @@ the list of objects itself."
(while (and (not (eobp))
(setq next-object (org-element--object-lex restriction)))
;; Text before any object.
- (let ((obj-beg (org-element-property :begin next-object)))
+ (let ((obj-beg (org-element-begin next-object)))
(unless (= (point) obj-beg)
(let ((text (buffer-substring-no-properties (point) obj-beg)))
(push (if acc (org-element-put-property text :parent acc) text)
contents))))
;; Object...
- (let ((obj-end (org-element-property :end next-object))
- (cont-beg (org-element-property :contents-begin next-object)))
+ (let ((obj-end (org-element-end next-object))
+ (cont-beg (org-element-contents-begin next-object)))
(when acc (org-element-put-property next-object :parent acc))
(push (if cont-beg
;; Fill contents of NEXT-OBJECT if possible.
(org-element--parse-objects
cont-beg
- (org-element-property :contents-end next-object)
+ (org-element-contents-end next-object)
next-object
(org-element-restriction next-object))
next-object)
@@ -5035,7 +5077,7 @@ to interpret. Return Org syntax as a string."
(if (memq type '(org-data anonymous)) results
;; Build white spaces. If no `:post-blank' property
;; is specified, assume its value is 0.
- (let ((blank (or (org-element-property :post-blank data) 0)))
+ (let ((blank (or (org-element-post-blank data) 0)))
(if (eq (org-element-class data parent) 'object)
(concat results (make-string blank ?\s))
(concat (org-element--interpret-affiliated-keywords data)
@@ -5524,7 +5566,7 @@ current `org-element--cache-sync-keys-value' and the
element key."
(or (when-let ((key-cons (org-element-property :org-element--cache-sync-key
element)))
(when (eq org-element--cache-sync-keys-value (car key-cons))
(cdr key-cons)))
- (let* ((begin (org-element-property :begin element))
+ (let* ((begin (org-element-begin element))
(type (org-element-type element))
;; Increase beginning position of items (respectively
;; table rows) by one, so the first item can get
@@ -5730,7 +5772,7 @@ the cache."
;; exact. Extra elements starting before/after could
;; have been added to cache and HASHED may no longer be
;; valid.
- (= pos (org-element-property :begin hashed))
+ (= pos (org-element-begin hashed))
;; We cannot rely on element :begin for elements with
;; children starting at the same pos.
(not (org-element-type-p hashed '(section org-data table))))
@@ -5738,11 +5780,11 @@ the cache."
;; No appriate HASHED. Search the cache.
(while node
(let* ((element (avl-tree--node-data node))
- (begin (org-element-property :begin element)))
+ (begin (org-element-begin element)))
(cond
((and limit
(not (org-element--cache-key-less-p
- (org-element--cache-key element) limit)))
+ (org-element--cache-key element) limit)))
(setq node (avl-tree--node-left node)))
((> begin pos)
(setq upper element
@@ -5767,8 +5809,8 @@ the cache."
(setq node (avl-tree--node-right node)))
((and (org-element-type-p element '(item table-row))
(let ((parent (org-element-parent element)))
- (and (= (org-element-property :begin element)
- (org-element-property :contents-begin parent))
+ (and (= (org-element-begin element)
+ (org-element-contents-begin parent))
(setq node nil
lower parent
upper parent)))))
@@ -5792,7 +5834,7 @@ the cache."
;; the new element so `avl-tree-enter' can insert it at the
;; right spot in the cache.
(let* ((keys (org-element--cache-find
- (org-element-property :begin element) 'both))
+ (org-element-begin element) 'both))
(new-key (org-element--cache-generate-key
(and (car keys) (org-element--cache-key (car keys)))
(cond ((cdr keys) (org-element--cache-key (cdr keys)))
@@ -5836,7 +5878,7 @@ Assume ELEMENT belongs to cache and that a cache is
active."
If this warning appears regularly, please report the warning text to Org mode
mailing list (M-x org-submit-bug-report)."
(org-element-type element)
(current-buffer)
- (org-element-property :begin element)
+ (org-element-begin element)
(org-element-property :org-element--cache-sync-key element))
(org-element-cache-reset)
(throw 'quit nil))
@@ -5849,7 +5891,7 @@ If this warning appears regularly, please report the
warning text to Org mode ma
If this warning appears regularly, please report the warning text to Org mode
mailing list (M-x org-submit-bug-report)."
(org-element-type element)
(current-buffer)
- (org-element-property :begin element)
+ (org-element-begin element)
(org-element-property :org-element--cache-sync-key element))
(org-element-cache-reset)
(throw 'quit nil)))))
@@ -5897,17 +5939,17 @@ Properties are modified by side-effect."
(cl-incf (nth 6 item) offset))))
;; Do not use loop for inline expansion to work during compile time.
(when (or (not props) (memq :begin props))
- (cl-incf (org-element-property :begin element) offset))
+ (cl-incf (org-element-begin element) offset))
(when (or (not props) (memq :end props))
- (cl-incf (org-element-property :end element) offset))
+ (cl-incf (org-element-end element) offset))
(when (or (not props) (memq :post-affiliated props))
- (cl-incf (org-element-property :post-affiliated element) offset))
+ (cl-incf (org-element-post-affiliated element) offset))
(when (and (or (not props) (memq :contents-begin props))
- (org-element-property :contents-begin element))
- (cl-incf (org-element-property :contents-begin element) offset))
+ (org-element-contents-begin element))
+ (cl-incf (org-element-contents-begin element) offset))
(when (and (or (not props) (memq :contents-end props))
- (org-element-property :contents-end element))
- (cl-incf (org-element-property :contents-end element) offset))
+ (org-element-contents-end element))
+ (cl-incf (org-element-contents-end element) offset))
(when (and (or (not props) (memq :robust-begin props))
(org-element-property :robust-begin element))
(cl-incf (org-element-property :robust-begin element) offset))
@@ -6088,7 +6130,7 @@ completing the request."
(if data
;; We found first element in cache starting at or
;; after REQUEST-KEY.
- (let ((pos (org-element-property :begin data)))
+ (let ((pos (org-element-begin data)))
;; FIXME: Maybe simply (< pos end)?
(if (<= pos end)
(progn
@@ -6216,9 +6258,9 @@ completing the request."
(let ((up parent))
(while (and up
(or (not cached-before)
- (> (org-element-property :begin up)
- (org-element-property :begin
cached-before))))
- (when (> (org-element-property :end up) future-change)
+ (> (org-element-begin up)
+ (org-element-begin cached-before))))
+ (when (> (org-element-end up) future-change)
;; Offset future cache request.
(org-element--cache-shift-positions
up (- offset)
@@ -6277,10 +6319,10 @@ completing the request."
(org-element--cache-log-message "Reached next request.")
(let ((next-request (nth 1
org-element--cache-sync-requests)))
(unless (and (org-element-property :cached
(org-element--request-parent next-request))
- (org-element-property :begin
(org-element--request-parent next-request))
+ (org-element-begin
(org-element--request-parent next-request))
parent
- (> (org-element-property :begin
(org-element--request-parent next-request))
- (org-element-property :begin parent)))
+ (> (org-element-begin
(org-element--request-parent next-request))
+ (org-element-begin parent)))
(setf (org-element--request-parent next-request)
parent)))
(throw 'org-element--cache-quit t))
;; Handle interruption request. Update current request.
@@ -6297,11 +6339,11 @@ completing the request."
(org-element-property
:org-element--cache-sync-key data)
(org-element--format-element data)))
(org-element--cache-shift-positions data offset))
- (let ((begin (org-element-property :begin data)))
+ (let ((begin (org-element-begin data)))
;; Update PARENT and re-parent DATA, only when
;; necessary. Propagate new structures for lists.
(while (and parent
- (<= (org-element-property :end parent) begin))
+ (<= (org-element-end parent) begin))
(setq parent (org-element-parent parent)))
(cond ((and (not parent) (zerop offset)) (throw
'org-element--cache-quit nil))
;; Consider scenario when DATA lays within
@@ -6320,13 +6362,13 @@ completing the request."
;; cache must be deleted instead.
((and parent
(or (not (org-element-type-p parent
org-element-greater-elements))
- (and (org-element-property :contents-begin
parent)
- (< (org-element-property :begin data)
(org-element-property :contents-begin parent)))
- (and (org-element-property :contents-end
parent)
- (>= (org-element-property :begin data)
(org-element-property :contents-end parent)))
- (> (org-element-property :end data)
(org-element-property :end parent))
- (and (org-element-property :contents-end
data)
- (> (org-element-property :contents-end
data) (org-element-property :contents-end parent)))))
+ (and (org-element-contents-begin parent)
+ (< (org-element-begin data)
(org-element-contents-begin parent)))
+ (and (org-element-contents-end parent)
+ (>= (org-element-begin data)
(org-element-contents-end parent)))
+ (> (org-element-end data) (org-element-end
parent))
+ (and (org-element-contents-end data)
+ (> (org-element-contents-end data)
(org-element-contents-end parent)))))
(org-element--cache-log-message "org-element-cache:
Removing obsolete element with key %S::%S"
(org-element-property
:org-element--cache-sync-key data)
(org-element--format-element data))
@@ -6345,8 +6387,8 @@ completing the request."
(not (eq parent data))
(let ((p (org-element-parent data)))
(or (not p)
- (< (org-element-property :begin p)
- (org-element-property :begin parent))
+ (< (org-element-begin p)
+ (org-element-begin parent))
(unless (eq p parent)
(not (org-element-property :cached p))
;; (not (avl-tree-member-p
org-element--cache p))
@@ -6397,10 +6439,10 @@ it and does not have closing term.
Examples of such elements are: section, headline, org-data,
and footnote-definition."
- (and (org-element-property :contents-end element)
- (= (org-element-property :contents-end element)
+ (and (org-element-contents-end element)
+ (= (org-element-contents-end element)
(save-excursion
- (goto-char (org-element-property :end element))
+ (goto-char (org-element-end element))
(skip-chars-backward " \r\n\t")
(line-beginning-position 2)))))
@@ -6437,13 +6479,13 @@ the expected result."
;; file.
((and (not cached) (org-element--cache-active-p))
(setq element (org-element-org-data-parser))
- (unless (org-element-property :begin element)
+ (unless (org-element-begin element)
(org-element--cache-warn "Error parsing org-data. Got
%S\nPlease report to Org mode mailing list (M-x org-submit-bug-report)."
element))
(org-element--cache-log-message
"Nothing in cache. Adding org-data: %S"
(org-element--format-element element))
(org-element--cache-put element)
- (goto-char (org-element-property :contents-begin element))
+ (goto-char (org-element-contents-begin element))
(setq mode 'org-data))
;; Nothing in cache before point because cache is not active.
;; Parse from previous heading to avoid re-parsing the whole
@@ -6482,15 +6524,15 @@ the expected result."
(t
(let ((up cached)
(pos (if (= (point-max) pos) (1- pos) pos)))
- (while (and up (<= (org-element-property :end up) pos))
- (setq next (org-element-property :end up)
+ (while (and up (<= (org-element-end up) pos))
+ (setq next (org-element-end up)
element up
mode (org-element--next-mode (org-element-property
:mode element) (org-element-type element) nil)
up (org-element-parent up)))
(when next (goto-char next))
(when up (setq element up)))))
;; Parse successively each element until we reach POS.
- (let ((end (or (org-element-property :end element) (point-max)))
+ (let ((end (or (org-element-end element) (point-max)))
(parent (org-element-parent element)))
(while t
(when (org-element--cache-interrupt-p time-limit)
@@ -6533,7 +6575,7 @@ If you observe Emacs hangs frequently, please report this
to Org mode mailing li
(org-element-cache-reset)
(error "org-element--cache: Emergency exit"))))
(org-element-put-property element :parent parent))
- (let ((elem-end (org-element-property :end element))
+ (let ((elem-end (org-element-end element))
(type (org-element-type element)))
(cond
;; Skip any element ending before point. Also skip
@@ -6580,8 +6622,8 @@ If you observe Emacs hangs frequently, please report this
to Org mode mailing li
;; can start after it, but more than one may end there.
;; Arbitrarily, we choose to return the innermost of
;; such elements.
- ((let ((cbeg (org-element-property :contents-begin element))
- (cend (org-element-property :contents-end element)))
+ ((let ((cbeg (org-element-contents-begin element))
+ (cend (org-element-contents-end element)))
(when (and cbeg cend
(or (< cbeg pos)
(and (= cbeg pos)
@@ -6604,16 +6646,16 @@ If you observe Emacs hangs frequently, please report
this to Org mode mailing li
;; return the outermost element inside
;; the headline section.
(and (org-element--open-end-p element)
- (or (= (org-element-property :end
element) (point-max))
- (and (>= pos
(org-element-property :contents-end element))
+ (or (= (org-element-end element)
(point-max))
+ (and (>= pos
(org-element-contents-end element))
(org-element-type-p element
'(org-data section headline)))))))
(goto-char (or next cbeg))
(setq mode (if next mode (org-element--next-mode mode
type t))
next nil
parent element
end (if (org-element--open-end-p element)
- (org-element-property :end element)
- (org-element-property :contents-end
element))))))
+ (org-element-end element)
+ (org-element-contents-end element))))))
;; Otherwise, return ELEMENT as it is the smallest
;; element containing POS.
(t (throw 'exit (if syncp parent element)))))
@@ -6796,8 +6838,8 @@ known element in cache (it may start after END)."
(let ((prev before))
(while (org-element-type-p prev 'keyword)
(setq before prev
- beg (org-element-property :begin prev))
- (setq prev (org-element--cache-find (1- (org-element-property
:begin before)))))))
+ beg (org-element-begin prev))
+ (setq prev (org-element--cache-find (1- (org-element-begin
before)))))))
(let ((up before)
(robust-flag t))
(while up
@@ -6810,8 +6852,8 @@ known element in cache (it may start after END)."
;; Sensitive change. This is
;; unconditionally non-robust change.
(not org-element--cache-change-warning)
- (let ((cbeg (org-element-property :contents-begin up))
- (cend (org-element-property :contents-end up)))
+ (let ((cbeg (org-element-contents-begin up))
+ (cend (org-element-contents-end up)))
(and cbeg
(<= cbeg beg)
(or (> cend end)
@@ -6841,7 +6883,7 @@ known element in cache (it may start after END)."
(or (not (numberp
org-element--cache-change-warning))
(> org-element--cache-change-warning
(org-element-property :level up)))
- (org-with-point-at (org-element-property
:contents-begin up)
+ (org-with-point-at (org-element-contents-begin up)
(unless
(save-match-data
(when (looking-at-p
org-element-planning-line-re)
@@ -6888,9 +6930,9 @@ known element in cache (it may start after END)."
(not
org-element--cache-avoid-synchronous-headline-re-parsing)
;; The change is not inside headline. Not
;; updating here.
- (not (<= beg (org-element-property :begin up)))
- (not (> end (org-element-property :end up)))
- (let ((current (org-with-point-at
(org-element-property :begin up)
+ (not (<= beg (org-element-begin up)))
+ (not (> end (org-element-end up)))
+ (let ((current (org-with-point-at (org-element-begin
up)
(org-element-with-disabled-cache
(and (looking-at-p
org-element-headline-re)
(org-element-headline-parser))))))
@@ -6906,7 +6948,7 @@ known element in cache (it may start after END)."
;; within blank lines at BOB (that could
;; potentially alter first-section).
(when (and (org-element-type-p up 'org-data)
- (>= beg (org-element-property :contents-begin
up)))
+ (>= beg (org-element-contents-begin up)))
(org-element-set up (org-with-point-at 1
(org-element-org-data-parser)) org-element--cache-element-properties)
(org-element--cache-log-message
"Found non-robust change invalidating org-data.
Re-parsing: %S"
@@ -6930,7 +6972,7 @@ known element in cache (it may start after END)."
;;
;; As a special case, do not remove BEFORE if it is a robust
;; container for current changes.
- (if (or (< (org-element-property :end before) beg) robust-flag) after
+ (if (or (< (org-element-end before) beg) robust-flag) after
before)))))
(defun org-element--cache-submit-request (beg end offset)
@@ -6988,9 +7030,9 @@ change, as an integer."
(setf (org-element--request-key next)
(org-element--cache-key first))
(setf (org-element--request-beg next)
- (org-element-property :begin first))
+ (org-element-begin first))
(setf (org-element--request-end next)
- (max (org-element-property :end first)
+ (max (org-element-end first)
(org-element--request-end next)))
(setf (org-element--request-parent next)
(org-element-parent first))))
@@ -7011,9 +7053,9 @@ change, as an integer."
"Current request intersects with next. Updating. New
parent: %S"
(org-element--format-element first))
(setf (org-element--request-key next)
(org-element--cache-key first))
- (setf (org-element--request-beg next) (org-element-property
:begin first))
+ (setf (org-element--request-beg next) (org-element-begin
first))
(setf (org-element--request-end next)
- (max (org-element-property :end first)
+ (max (org-element-end first)
(org-element--request-end next)))
(setf (org-element--request-parent next) (org-element-parent
first))))))
;; Ensure cache is correct up to END. Also make sure that NEXT,
@@ -7026,7 +7068,7 @@ change, as an integer."
(when next (org-element--cache-sync (current-buffer) end beg offset
'force))
(let ((first (org-element--cache-for-removal beg end offset)))
(if first
- (push (let ((first-beg (org-element-property :begin first))
+ (push (let ((first-beg (org-element-begin first))
(key (org-element--cache-key first)))
(cond
;; When changes happen before the first known
@@ -7042,7 +7084,7 @@ change, as an integer."
;; The current modification is completely inside
;; FIRST. Clear and update cached elements in
;; region containing FIRST.
- ((let ((first-end (org-element-property :end first)))
+ ((let ((first-end (org-element-end first)))
(when (> first-end end)
(org-element--cache-log-message "Extending to
non-robust element %S" (org-element--format-element first))
(vector key first-beg first-end offset
(org-element-parent first) 0))))
@@ -7056,16 +7098,16 @@ change, as an integer."
;; parent of FIRST and everything inside
;; BEG..END.
(let* ((element (org-element--cache-find end))
- (element-end (org-element-property :end element))
+ (element-end (org-element-end element))
(up element))
(while (and (not (eq up first))
(setq up (org-element-parent up))
- (>= (org-element-property :begin up)
first-beg))
+ (>= (org-element-begin up) first-beg))
;; Note that UP might have been already
;; shifted if it is a robust element. After
;; deletion, it can put it's end before yet
;; unprocessed ELEMENT.
- (setq element-end (max (org-element-property :end
up) element-end)
+ (setq element-end (max (org-element-end up)
element-end)
element up))
;; Extend region to remove elements between
;; beginning of first and the end of outermost
@@ -7116,9 +7158,9 @@ Return non-nil when verification failed."
(org-element-type-p element 'headline)
;; Avoid too much slowdown
(< (random 1000) (* 1000
org-element--cache-self-verify-frequency)))
- (org-with-point-at (org-element-property :begin element)
+ (org-with-point-at (org-element-begin element)
(org-element-with-disabled-cache (org-up-heading-or-point-min))
- (unless (or (= (point) (org-element-property :begin
(org-element-parent element)))
+ (unless (or (= (point) (org-element-begin (org-element-parent
element)))
(eq (point) (point-min)))
(org-element--cache-warn
"Cached element has wrong parent in %s. Resetting.
@@ -7127,7 +7169,7 @@ The element is: %S\n The parent is: %S\n The real parent
is: %S"
(buffer-name (current-buffer))
(org-element--format-element element)
(org-element--format-element (org-element-parent element))
- (org-element--format-element (org-element--current-element
(org-element-property :end (org-element-parent element)))))
+ (org-element--format-element (org-element--current-element
(org-element-end (org-element-parent element)))))
(org-element-cache-reset))
(org-element--cache-verify-element (org-element-parent element))))
;; Verify the element itself.
@@ -7140,13 +7182,13 @@ The element is: %S\n The parent is: %S\n The real
parent is: %S"
(let ((real-element (org-element-with-disabled-cache
(org-element--parse-to
(if (org-element-type-p element '(table-row item))
- (1+ (org-element-property :begin element))
- (org-element-property :begin element))))))
+ (1+ (org-element-begin element))
+ (org-element-begin element))))))
(unless (and (eq (org-element-type real-element) (org-element-type
element))
- (eq (org-element-property :begin real-element)
(org-element-property :begin element))
- (eq (org-element-property :end real-element)
(org-element-property :end element))
- (eq (org-element-property :contents-begin real-element)
(org-element-property :contents-begin element))
- (eq (org-element-property :contents-end real-element)
(org-element-property :contents-end element))
+ (eq (org-element-begin real-element) (org-element-begin
element))
+ (eq (org-element-end real-element) (org-element-end
element))
+ (eq (org-element-contents-begin real-element)
(org-element-contents-begin element))
+ (eq (org-element-contents-end real-element)
(org-element-contents-end element))
(or (not (org-element-property :ID real-element))
(string= (org-element-property :ID real-element)
(org-element-property :ID element))))
(org-element--cache-warn "(%S) Cached element is incorrect in %s.
(Cache tic up to date: %S) Resetting.
@@ -7159,9 +7201,9 @@ The element is: %S\n The real element is: %S\n Cache
around :begin:\n%S\n%S\n%S"
"no" "yes")
(org-element--format-element element)
(org-element--format-element real-element)
- (org-element--format-element
(org-element--cache-find (1- (org-element-property :begin real-element))))
- (org-element--format-element (car
(org-element--cache-find (org-element-property :begin real-element) 'both)))
- (org-element--format-element (cdr
(org-element--cache-find (org-element-property :begin real-element) 'both))))
+ (org-element--format-element
(org-element--cache-find (1- (org-element-begin real-element))))
+ (org-element--format-element (car
(org-element--cache-find (org-element-begin real-element) 'both)))
+ (org-element--format-element (cdr
(org-element--cache-find (org-element-begin real-element) 'both))))
(org-element-cache-reset))))))
;;; Cache persistence
@@ -7454,15 +7496,15 @@ the cache."
(re-search-forward (or (car-safe
,re) ,re) nil 'move)))
(unless (or (< (point) (or start -1))
(and data
- (< (point)
(org-element-property :begin data))))
+ (< (point)
(org-element-begin data))))
(if (cdr-safe ,re)
;; Avoid parsing when we are 100%
;; sure that regexp is good enough
;; to find new START.
(setq start (match-beginning 0))
(setq start (max (or start -1)
- (or
(org-element-property :begin data) -1)
- (or
(org-element-property :begin (element-match-at-point)) -1))))
+ (or
(org-element-begin data) -1)
+ (or
(org-element-begin (element-match-at-point)) -1))))
(when (>= start to-pos)
(cache-walk-abort))
(when (eq start -1) (setq start nil)))
(cache-walk-abort))))
@@ -7473,21 +7515,21 @@ the cache."
(setq tmpnext-start nil)
(if (memq granularity '(headline
headline+inlinetask))
(setq tmpnext-start (or (when
(org-element-type-p data '(headline org-data))
-
(org-element-property :contents-begin data))
-
(org-element-property :end data)))
+
(org-element-contents-begin data))
+ (org-element-end
data)))
(setq tmpnext-start (or (when
(org-element-type-p data org-element-greater-elements)
-
(org-element-property :contents-begin data))
- (org-element-property
:end data))))
+
(org-element-contents-begin data))
+ (org-element-end
data))))
;; DATA end may be the last element inside
;; i.e. source block. Skip up to the end
;; of parent in such case.
(setq tmpparent data)
(catch :exit
- (when (eq tmpnext-start (org-element-property
:contents-end tmpparent))
- (setq tmpnext-start (org-element-property
:end tmpparent)))
+ (when (eq tmpnext-start
(org-element-contents-end tmpparent))
+ (setq tmpnext-start (org-element-end
tmpparent)))
(while (setq tmpparent (org-element-parent
tmpparent))
- (if (eq tmpnext-start (org-element-property
:contents-end tmpparent))
- (setq tmpnext-start (org-element-property
:end tmpparent))
+ (if (eq tmpnext-start
(org-element-contents-end tmpparent))
+ (setq tmpnext-start (org-element-end
tmpparent))
(throw :exit t))))
tmpnext-start))
;; Check if cache does not have gaps.
@@ -7516,7 +7558,7 @@ the cache."
(start (and from-pos
(progn
(goto-char from-pos)
- (org-element-property :begin
(element-match-at-point)))))
+ (org-element-begin (element-match-at-point)))))
;; Some elements may start at the same position, so we
;; also keep track of the last processed element and make
;; sure that we do not try to search it again.
@@ -7597,7 +7639,7 @@ the cache."
(org-element--cache-key prev))))
;; ... or when we are before START.
(or (not start)
- (not (> start (org-element-property :begin
data)))))
+ (not (> start (org-element-begin data)))))
(progn (push node stack)
(setq node (avl-tree--node-left node)))
;; The whole tree left to DATA is before START and
@@ -7612,12 +7654,12 @@ the cache."
;; NEXT-ELEMENT-RE.
;; If DATA is after start, we have found a cache gap
;; and need to fill it.
- (unless (or (and start (< (org-element-property :begin data)
start))
+ (unless (or (and start (< (org-element-begin data) start))
(and prev (not (org-element--cache-key-less-p
(org-element--cache-key prev)
(org-element--cache-key data)))))
;; DATA is at of after START and PREV.
- (if (or (not start) (= (org-element-property :begin data)
start))
+ (if (or (not start) (= (org-element-begin data) start))
;; DATA is at START. Match it.
;; In the process, we may alter the buffer,
;; so also keep track of the cache state.
@@ -7630,11 +7672,11 @@ the cache."
;; next regexp match after :begin of the current
;; element.
(when (if last-match next-re fail-re)
- (goto-char (org-element-property :begin data))
+ (goto-char (org-element-begin data))
(move-start-to-next-match
(if last-match next-re fail-re)))
- (when (and (or (not start) (eq (org-element-property
:begin data) start))
- (< (org-element-property :begin data)
to-pos))
+ (when (and (or (not start) (eq (org-element-begin
data) start))
+ (< (org-element-begin data) to-pos))
;; Calculate where next possible element
;; starts and update START if needed.
(setq start (next-element-start))
@@ -7721,7 +7763,7 @@ the cache."
;; element past already processed
;; place.
(when (and start
- (<= start (org-element-property :begin
data))
+ (<= start (org-element-begin data))
(not
org-element-cache-map-continue-from))
(goto-char start)
(setq data (element-match-at-point))
@@ -7753,7 +7795,7 @@ the cache."
(setq continue-flag nil)
(setq node (if (and (car stack)
;; If START advanced beyond stack
parent, skip the right branch.
- (or (and start (<
(org-element-property :begin (avl-tree--node-data (car stack))) start))
+ (or (and start (< (org-element-begin
(avl-tree--node-data (car stack))) start))
(and prev
(org-element--cache-key-less-p
(org-element--cache-key
(avl-tree--node-data (car stack)))
(org-element--cache-key
prev)))))
@@ -7861,16 +7903,16 @@ element ending there."
(unless (org-element-type-p element 'org-data)
(unless (and cached-only
(not (and element
- (or (= pom (org-element-property :begin element))
+ (or (= pom (org-element-begin element))
(and (not (org-element-type-p element
org-element-greater-elements))
- (>= pom (org-element-property :begin
element))
- (< pom (org-element-property :end
element)))
- (and (org-element-property :contents-begin
element)
- (>= pom (org-element-property :begin
element))
- (< pom (org-element-property
:contents-begin element)))
- (and (not (org-element-property :contents-end
element))
- (>= pom (org-element-property :begin
element))
- (< pom (org-element-property :end
element)))))))
+ (>= pom (org-element-begin element))
+ (< pom (org-element-end element)))
+ (and (org-element-contents-begin element)
+ (>= pom (org-element-begin element))
+ (< pom (org-element-contents-begin
element)))
+ (and (not (org-element-contents-end element))
+ (>= pom (org-element-begin element))
+ (< pom (org-element-end element)))))))
(if (not (org-element-type-p element 'section))
element
(org-element-at-point (1+ pom) cached-only))))))
@@ -7910,7 +7952,7 @@ Providing it allows for quicker computation."
(let* ((pos (point))
(element (or element (org-element-at-point)))
(type (org-element-type element))
- (post (org-element-property :post-affiliated element)))
+ (post (org-element-post-affiliated element)))
;; If point is inside an element containing objects or
;; a secondary string, narrow buffer to the container and
;; proceed with parsing. Otherwise, return ELEMENT.
@@ -7947,7 +7989,7 @@ Providing it allows for quicker computation."
;; At an headline or inlinetask, objects are in title.
((memq type '(headline inlinetask))
(let ((case-fold-search nil))
- (goto-char (org-element-property :begin element))
+ (goto-char (org-element-begin element))
(looking-at org-complex-heading-regexp)
(let ((end (match-end 4)))
(if (not end) (throw 'objects-forbidden element)
@@ -7959,8 +8001,8 @@ Providing it allows for quicker computation."
;; At a paragraph, a table-row or a verse block, objects are
;; located within their contents.
((memq type '(paragraph table-row verse-block))
- (let ((cbeg (org-element-property :contents-begin element))
- (cend (org-element-property :contents-end element)))
+ (let ((cbeg (org-element-contents-begin element))
+ (cend (org-element-contents-end element)))
;; CBEG is nil for table rules.
(if (and cbeg cend (>= pos cbeg)
(or (< pos cend) (and (= pos cend) (eobp))))
@@ -7977,11 +8019,11 @@ Providing it allows for quicker computation."
(when next (org-element-put-property next :parent parent))
;; Process NEXT, if any, in order to know if we need to
;; skip it, return it or move into it.
- (if (or (not next) (> (org-element-property :begin next) pos))
+ (if (or (not next) (> (org-element-begin next) pos))
(throw 'exit (or last parent))
- (let ((end (org-element-property :end next))
- (cbeg (org-element-property :contents-begin next))
- (cend (org-element-property :contents-end next)))
+ (let ((end (org-element-end next))
+ (cbeg (org-element-contents-begin next))
+ (cend (org-element-contents-end next)))
(cond
;; Skip objects ending before point. Also skip
;; objects ending at point unless it is also the
@@ -8017,10 +8059,10 @@ Providing it allows for quicker computation."
(defun org-element-nested-p (elem-A elem-B)
"Non-nil when elements ELEM-A and ELEM-B are nested."
- (let ((beg-A (org-element-property :begin elem-A))
- (beg-B (org-element-property :begin elem-B))
- (end-A (org-element-property :end elem-A))
- (end-B (org-element-property :end elem-B)))
+ (let ((beg-A (org-element-begin elem-A))
+ (beg-B (org-element-begin elem-B))
+ (end-A (org-element-end elem-A))
+ (end-B (org-element-end elem-B)))
(or (and (>= beg-A beg-B) (<= end-A end-B))
(and (>= beg-B beg-A) (<= end-B end-A)))))
@@ -8028,7 +8070,7 @@ Providing it allows for quicker computation."
"Swap elements ELEM-A and ELEM-B.
Assume ELEM-B is after ELEM-A in the buffer. Leave point at the
end of ELEM-A."
- (goto-char (org-element-property :begin elem-A))
+ (goto-char (org-element-begin elem-A))
;; There are two special cases when an element doesn't start at bol:
;; the first paragraph in an item or in a footnote definition.
(let ((specialp (not (bolp))))
@@ -8038,8 +8080,8 @@ end of ELEM-A."
;; paragraphs in a row because it cannot contain a blank line.
(when (and specialp
(or (not (org-element-type-p elem-B 'paragraph))
- (/= (org-element-property :begin elem-B)
- (org-element-property :contents-begin elem-B))))
+ (/= (org-element-begin elem-B)
+ (org-element-contents-begin elem-B))))
(error "Cannot swap elements"))
;; Preserve folding state when `org-fold-core-style' is set to
;; `text-properties'.
@@ -8047,16 +8089,16 @@ end of ELEM-A."
;; In a special situation, ELEM-A will have no indentation. We'll
;; give it ELEM-B's (which will in, in turn, have no indentation).
(let* ((ind-B (when specialp
- (goto-char (org-element-property :begin elem-B))
+ (goto-char (org-element-begin elem-B))
(current-indentation)))
- (beg-A (org-element-property :begin elem-A))
+ (beg-A (org-element-begin elem-A))
(end-A (save-excursion
- (goto-char (org-element-property :end elem-A))
+ (goto-char (org-element-end elem-A))
(skip-chars-backward " \r\t\n")
(line-end-position)))
- (beg-B (org-element-property :begin elem-B))
+ (beg-B (org-element-begin elem-B))
(end-B (save-excursion
- (goto-char (org-element-property :end elem-B))
+ (goto-char (org-element-end elem-B))
(skip-chars-backward " \r\t\n")
(line-end-position)))
;; Store inner folds responsible for visibility status.
@@ -8083,7 +8125,7 @@ end of ELEM-A."
(insert body-B)
;; Restore ex ELEM-A folds.
(org-fold-core-regions (cdr folds) :relative beg-A)
- (goto-char (org-element-property :end elem-B))))))
+ (goto-char (org-element-end elem-B))))))
(provide 'org-element)
diff --git a/lisp/org-fold.el b/lisp/org-fold.el
index 219400482b..c73a7c1939 100644
--- a/lisp/org-fold.el
+++ b/lisp/org-fold.el
@@ -64,6 +64,8 @@
(declare-function org-element-type "org-element-ast" (node &optional
anonymous))
(declare-function org-element-at-point "org-element" (&optional pom
cached-only))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-end "org-element" (node))
+(declare-function org-element-post-affiliated "org-element" (node))
(declare-function org-element--current-element "org-element" (limit &optional
granularity mode structure))
(declare-function org-element--cache-active-p "org-element" ())
(declare-function org-toggle-custom-properties-visibility "org" ())
@@ -528,12 +530,12 @@ Return a non-nil value when toggling is successful."
comment-block dynamic-block example-block export-block
quote-block special-block src-block verse-block))
(_ (error "Unknown category: %S" category))))
- (let* ((post (org-element-property :post-affiliated element))
+ (let* ((post (org-element-post-affiliated element))
(start (save-excursion
(goto-char post)
(line-end-position)))
(end (save-excursion
- (goto-char (org-element-property :end element))
+ (goto-char (org-element-end element))
(skip-chars-backward " \t\n")
(line-end-position))))
;; Do nothing when not before or at the block opening line or
@@ -614,7 +616,7 @@ Return a non-nil value when toggling is successful."
;; Make sure to skip drawer entirely or we might flag it
;; another time when matching its ending line with
;; `org-drawer-regexp'.
- (goto-char (org-element-property :end drawer))))))))
+ (goto-char (org-element-end drawer))))))))
(defun org-fold-hide-archived-subtrees (beg end)
"Re-hide all archived subtrees after a visibility state change."
diff --git a/lisp/org-lint.el b/lisp/org-lint.el
index 5c6b78c522..d8f79f7e7e 100644
--- a/lisp/org-lint.el
+++ b/lisp/org-lint.el
@@ -387,7 +387,7 @@ called with one argument, the key used for comparison."
(and (org-string-equal-ignore-case
"CUSTOM_ID" (org-element-property :key property))
(org-element-property :value property)))
- (lambda (property _) (org-element-property :begin property))
+ (lambda (property _) (org-element-begin property))
(lambda (key) (format "Duplicate CUSTOM_ID property \"%s\"" key))))
(defun org-lint-duplicate-name (ast)
@@ -396,7 +396,7 @@ called with one argument, the key used for comparison."
org-element-all-elements
(lambda (datum) (org-element-property :name datum))
(lambda (datum name)
- (goto-char (org-element-property :begin datum))
+ (goto-char (org-element-begin datum))
(re-search-forward
(format "^[ \t]*#\\+[A-Za-z]+:[ \t]*%s[ \t]*$" (regexp-quote name)))
(match-beginning 0))
@@ -407,7 +407,7 @@ called with one argument, the key used for comparison."
ast
'target
(lambda (target) (split-string (org-element-property :value target)))
- (lambda (target _) (org-element-property :begin target))
+ (lambda (target _) (org-element-begin target))
(lambda (key)
(format "Duplicate target <<%s>>" (mapconcat #'identity key " ")))))
@@ -416,7 +416,7 @@ called with one argument, the key used for comparison."
ast
'footnote-definition
(lambda (definition) (org-element-property :label definition))
- (lambda (definition _) (org-element-property :post-affiliated definition))
+ (lambda (definition _) (org-element-post-affiliated definition))
(lambda (key) (format "Duplicate footnote definition \"%s\"" key))))
(defun org-lint-orphaned-affiliated-keywords (ast)
@@ -431,7 +431,7 @@ called with one argument, the key used for comparison."
(and (or (let ((case-fold-search t))
(string-match-p "\\`ATTR_[-_A-Za-z0-9]+\\'" key))
(member key keywords))
- (list (org-element-property :post-affiliated k)
+ (list (org-element-post-affiliated k)
(format "Orphaned affiliated keyword: \"%s\"" key))))))))
(defun org-lint-obsolete-affiliated-keywords (_)
@@ -443,7 +443,7 @@ called with one argument, the key used for comparison."
(while (re-search-forward regexp nil t)
(let ((key (upcase (match-string-no-properties 1))))
(when (< (point)
- (org-element-property :post-affiliated (org-element-at-point)))
+ (org-element-post-affiliated (org-element-at-point)))
(push
(list (line-beginning-position)
(format
@@ -464,7 +464,7 @@ called with one argument, the key used for comparison."
(let ((type (org-element-property :type b)))
(when (member-ignore-case type deprecated)
(list
- (org-element-property :post-affiliated b)
+ (org-element-post-affiliated b)
(format
"Deprecated syntax for export block. Use \"BEGIN_EXPORT %s\" \
instead"
@@ -486,14 +486,14 @@ instead"
(let ((value (org-element-property :value datum)))
(and (string= key "PROPERTY")
(string-match deprecated-re value)
- (list (org-element-property :begin datum)
+ (list (org-element-begin datum)
(format "Deprecated syntax for \"%s\". \
Use header-args instead"
(match-string-no-properties 1 value))))))
(`node-property
(and (member-ignore-case key deprecated-babel-properties)
(list
- (org-element-property :begin datum)
+ (org-element-begin datum)
(format "Deprecated syntax for \"%s\". \
Use :header-args: instead"
key))))))))))
@@ -502,7 +502,7 @@ Use :header-args: instead"
(org-element-map ast 'src-block
(lambda (b)
(unless (org-element-property :language b)
- (list (org-element-property :post-affiliated b)
+ (list (org-element-post-affiliated b)
"Missing language in source block")))))
(defun org-lint-suspicious-language-in-src-block (ast)
@@ -517,7 +517,7 @@ Use :header-args: instead"
(org-element-map ast 'export-block
(lambda (b)
(unless (org-element-property :type b)
- (list (org-element-property :post-affiliated b)
+ (list (org-element-post-affiliated b)
"Missing backend in export block")))))
(defun org-lint-invalid-babel-call-block (ast)
@@ -525,12 +525,12 @@ Use :header-args: instead"
(lambda (b)
(cond
((not (org-element-property :call b))
- (list (org-element-property :post-affiliated b)
+ (list (org-element-post-affiliated b)
"Invalid syntax in babel call block"))
((let ((h (org-element-property :end-header b)))
(and h (string-match-p "\\`\\[.*\\]\\'" h)))
(list
- (org-element-property :post-affiliated b)
+ (org-element-post-affiliated b)
"Babel call's end header must not be wrapped within brackets"))))))
(defun org-lint-deprecated-category-setup (ast)
@@ -540,7 +540,7 @@ Use :header-args: instead"
(cond
((not (string= (org-element-property :key k) "CATEGORY")) nil)
(category-flag
- (list (org-element-property :post-affiliated k)
+ (list (org-element-post-affiliated k)
"Spurious CATEGORY keyword. Set :CATEGORY: property instead"))
(t (setf category-flag t) nil))))))
@@ -551,7 +551,7 @@ Use :header-args: instead"
(let ((ref (org-element-property :path link)))
(and (equal (org-element-property :type link) "coderef")
(not (ignore-errors (org-export-resolve-coderef ref info)))
- (list (org-element-property :begin link)
+ (list (org-element-begin link)
(format "Unknown coderef \"%s\"" ref))))))))
(defun org-lint-invalid-custom-id-link (ast)
@@ -560,7 +560,7 @@ Use :header-args: instead"
(lambda (link)
(and (equal (org-element-property :type link) "custom-id")
(not (ignore-errors (org-export-resolve-id-link link info)))
- (list (org-element-property :begin link)
+ (list (org-element-begin link)
(format "Unknown custom ID \"%s\""
(org-element-property :path link))))))))
@@ -570,7 +570,7 @@ Use :header-args: instead"
(lambda (link)
(and (equal (org-element-property :type link) "fuzzy")
(not (ignore-errors (org-export-resolve-fuzzy-link link info)))
- (list (org-element-property :begin link)
+ (list (org-element-begin link)
(format "Unknown fuzzy location \"%s\""
(let ((path (org-element-property :path link)))
(if (string-prefix-p "*" path)
@@ -583,7 +583,7 @@ Use :header-args: instead"
(let ((id (org-element-property :path link)))
(and (equal (org-element-property :type link) "id")
(not (org-id-find id))
- (list (org-element-property :begin link)
+ (list (org-element-begin link)
(format "Unknown ID \"%s\"" id)))))))
(defun org-lint-special-property-in-properties-drawer (ast)
@@ -591,7 +591,7 @@ Use :header-args: instead"
(lambda (p)
(let ((key (org-element-property :key p)))
(and (member-ignore-case key org-special-properties)
- (list (org-element-property :begin p)
+ (list (org-element-begin p)
(format
"Special property \"%s\" found in a properties drawer"
key)))))))
@@ -605,7 +605,7 @@ Use :header-args: instead"
(mapcar #'org-element-type
(assq d (reverse (org-element-contents
(org-element-parent d)))))))
- (list (org-element-property :post-affiliated d)
+ (list (org-element-post-affiliated d)
(if (or (and headline? (member before '(nil (planning))))
(and (null headline?) (member before '(nil (comment)))))
"Incorrect contents for PROPERTIES drawer"
@@ -618,7 +618,7 @@ Use :header-args: instead"
(let ((value (org-element-property :value p)))
(and (org-string-nw-p value)
(not (org-duration-p value))
- (list (org-element-property :begin p)
+ (list (org-element-begin p)
(format "Invalid effort duration format: %S" value))))))))
(defun org-lint-link-to-local-file (ast)
@@ -630,11 +630,11 @@ Use :header-args: instead"
(let* ((path (org-element-property :path l))
(file (if (string= type "file")
path
- (org-with-point-at (org-element-property :begin l)
+ (org-with-point-at (org-element-begin l)
(org-attach-expand path)))))
(and (not (file-remote-p file))
(not (file-exists-p file))
- (list (org-element-property :begin l)
+ (list (org-element-begin l)
(format (if (org-element-lineage l 'link)
"Link to non-existent image file %S \
in description"
@@ -652,7 +652,7 @@ in description"
(and (not (org-url-p file))
(not (file-remote-p file))
(not (file-exists-p file))
- (list (org-element-property :begin k)
+ (list (org-element-begin k)
(format "Non-existent setup file %S" file))))))))
(defun org-lint-wrong-include-link-parameter (ast)
@@ -665,7 +665,7 @@ in description"
(save-match-data
(org-strip-quotes (match-string 1 value))))))
(if (not path)
- (list (org-element-property :post-affiliated k)
+ (list (org-element-post-affiliated k)
"Missing location argument in INCLUDE keyword")
(let* ((file (org-string-nw-p
(if (string-match "::\\(.*\\)\\'" path)
@@ -677,7 +677,7 @@ in description"
(if (and file
(not (file-remote-p file))
(not (file-exists-p file)))
- (list (org-element-property :post-affiliated k)
+ (list (org-element-post-affiliated k)
"Non-existent file argument in INCLUDE keyword")
(let* ((visiting (if file (find-buffer-visiting file)
(current-buffer)))
@@ -688,7 +688,7 @@ in description"
(when (and search
(not (ignore-errors
(org-link-search search nil t))))
- (list (org-element-property :post-affiliated k)
+ (list (org-element-post-affiliated k)
(format
"Invalid search part \"%s\" in INCLUDE
keyword"
search))))
@@ -707,7 +707,7 @@ in description"
(value (org-element-property :value k)))
(when (string-match regexp value)
(let ((markup (match-string-no-properties 1 value)))
- (list (org-element-property :post-affiliated k)
+ (list (org-element-post-affiliated k)
(format "Obsolete markup \"%s\" in INCLUDE keyword. \
Use \"export %s\" instead"
markup
@@ -734,11 +734,11 @@ Use \"export %s\" instead"
(setf start (match-end 0))
(let ((item (match-string 1 value)))
(unless (member item allowed)
- (push (list (org-element-property :post-affiliated k)
+ (push (list (org-element-post-affiliated k)
(format "Unknown OPTIONS item \"%s\"" item))
reports))
(unless (match-string 2 value)
- (push (list (org-element-property :post-affiliated k)
+ (push (list (org-element-post-affiliated k)
(format "Missing value for option item %S" item))
reports))))))))
reports))
@@ -779,7 +779,7 @@ Use \"export %s\" instead"
(check-arity
(lambda (arity macro)
(let* ((name (org-element-property :key macro))
- (pos (org-element-property :begin macro))
+ (pos (org-element-begin macro))
(args (org-element-property :args macro))
(l (length args)))
(cond
@@ -814,17 +814,17 @@ Use \"export %s\" instead"
(org-trim (substring value (match-end 0))))))
(cond
((not name)
- (push (list (org-element-property :post-affiliated k)
+ (push (list (org-element-post-affiliated k)
"Missing name in MACRO keyword")
reports))
((not (org-string-nw-p template))
- (push (list (org-element-property :post-affiliated k)
+ (push (list (org-element-post-affiliated k)
"Missing template in macro \"%s\"" name)
reports))
(t
(unless (let ((args (funcall extract-placeholders template)))
(equal (number-sequence 1 (or (org-last args) 0)) args))
- (push (list (org-element-property :post-affiliated k)
+ (push (list (org-element-post-affiliated k)
(format "Unused placeholders in macro \"%s\""
name))
reports))))))))
@@ -840,7 +840,7 @@ Use \"export %s\" instead"
(template (cdr (assoc-string name templates t))))
(pcase template
(`nil
- (push (list (org-element-property :begin macro)
+ (push (list (org-element-begin macro)
(format "Undefined macro %S" name))
reports))
((guard (string= name "keyword"))
@@ -875,7 +875,7 @@ Use \"export %s\" instead"
(let ((label (org-element-property :label f)))
(and (eq 'standard (org-element-property :type f))
(not (member label definitions))
- (list (org-element-property :begin f)
+ (list (org-element-begin f)
(format "Missing definition for footnote [%s]"
label))))))))
@@ -887,7 +887,7 @@ Use \"export %s\" instead"
(let ((label (org-element-property :label f)))
(and label
(not (member label references))
- (list (org-element-property :post-affiliated f)
+ (list (org-element-post-affiliated f)
(format "No reference for footnote definition [%s]"
label))))))))
@@ -898,7 +898,7 @@ Use \"export %s\" instead"
(and name
(string-match-p ":" name)
(list (progn
- (goto-char (org-element-property :begin e))
+ (goto-char (org-element-begin e))
(re-search-forward
(format "^[ \t]*#\\+\\w+: +%s *$" (regexp-quote name)))
(match-beginning 0))
@@ -954,16 +954,16 @@ Use \"export %s\" instead"
(pcase (org-element-type element)
(`drawer
;; Find drawer opening lines within non-empty drawers.
- (let ((end (org-element-property :contents-end element)))
+ (let ((end (org-element-contents-end element)))
(when end
(while (re-search-forward org-drawer-regexp end t)
(let ((n (org-trim (match-string-no-properties 0))))
(push (list (line-beginning-position)
(format "Possible misleading drawer entry %S" n))
reports))))
- (goto-char (org-element-property :end element))))
+ (goto-char (org-element-end element))))
(`property-drawer
- (goto-char (org-element-property :end element)))
+ (goto-char (org-element-end element)))
((or `comment-block `example-block `export-block `src-block
`verse-block)
nil)
@@ -1041,7 +1041,7 @@ Use \"export %s\" instead"
(not (and (org-element-type-p e 'headline)
(org-element-property :commentedp e))))
nil t '(footnote-definition property-drawer))
- (list (org-element-property :begin h)
+ (list (org-element-begin h)
"Extraneous elements in footnote section are not exported")))))
(defun org-lint-quote-section (ast)
@@ -1050,7 +1050,7 @@ Use \"export %s\" instead"
(let ((title (org-element-property :raw-value h)))
(and (or (string-prefix-p "QUOTE " title)
(string-prefix-p (concat org-comment-string " QUOTE ") title))
- (list (org-element-property :begin h)
+ (list (org-element-begin h)
"Deprecated QUOTE section"))))))
(defun org-lint-file-application (ast)
@@ -1058,7 +1058,7 @@ Use \"export %s\" instead"
(lambda (l)
(let ((app (org-element-property :application l)))
(and app
- (list (org-element-property :begin l)
+ (list (org-element-begin l)
(format "Deprecated \"file+%s\" link type" app)))))))
(defun org-lint-percent-encoding-link-escape (ast)
@@ -1075,7 +1075,7 @@ Use \"export %s\" instead"
(throw :obsolete nil)))
(string-match-p "%" uri))))
(when obsolete-flag
- (list (org-element-property :begin l)
+ (list (org-element-begin l)
"Link escaped with obsolete percent-encoding syntax")))))))
(defun org-lint-wrong-header-argument (ast)
@@ -1097,8 +1097,8 @@ Use \"export %s\" instead"
(mapcar #'car org-babel-load-languages))))))
(dolist (header headers)
(let ((h (symbol-name (car header)))
- (p (or (org-element-property :post-affiliated datum)
- (org-element-property :begin datum))))
+ (p (or (org-element-post-affiliated datum)
+ (org-element-begin datum))))
(cond
((not (string-prefix-p ":" h))
(push
@@ -1184,8 +1184,8 @@ Use \"export %s\" instead"
(when (not (cdr header))
(push
(list
- (or (org-element-property :post-affiliated datum)
- (org-element-property :begin datum))
+ (or (org-element-post-affiliated datum)
+ (org-element-begin datum))
(format "Empty value in header argument \"%s\"" (symbol-name
(car header))))
reports))))))
reports))
@@ -1242,8 +1242,8 @@ Use \"export %s\" instead"
((assq group groups-alist)
(push
(list
- (or (org-element-property :post-affiliated datum)
- (org-element-property :begin datum))
+ (or (org-element-post-affiliated datum)
+ (org-element-begin datum))
(format
"Forbidden combination in header \"%s\": %s, %s"
(car header)
@@ -1256,8 +1256,8 @@ Use \"export %s\" instead"
(unless valid-value
(push
(list
- (or (org-element-property :post-affiliated datum)
- (org-element-property :begin datum))
+ (or (org-element-post-affiliated datum)
+ (org-element-begin datum))
(format "Unknown value \"%s\" for header \"%s\""
v
(car header)))
@@ -1268,7 +1268,7 @@ Use \"export %s\" instead"
(org-element-map ast '(headline inlinetask)
(lambda (h)
(when (member "" (org-element-property :tags h))
- (list (org-element-property :begin h)
+ (list (org-element-begin h)
"Tags contain a spurious colon")))))
(defun org-lint-non-existent-bibliography (ast)
@@ -1278,7 +1278,7 @@ Use \"export %s\" instead"
(let ((file (org-strip-quotes (org-element-property :value k))))
(and (not (file-remote-p file))
(not (file-exists-p file))
- (list (org-element-property :begin k)
+ (list (org-element-begin k)
(format "Non-existent bibliography %S" file))))))))
(defun org-lint-missing-print-bibliography (ast)
@@ -1295,7 +1295,7 @@ Use \"export %s\" instead"
(lambda (k)
(when (equal "CITE_EXPORT" (org-element-property :key k))
(let ((value (org-element-property :value k))
- (source (org-element-property :begin k)))
+ (source (org-element-begin k)))
(if (equal value "")
(list source "Missing export processor name")
(condition-case _
@@ -1317,7 +1317,7 @@ Use \"export %s\" instead"
;; XXX: The code below signals the error at the beginning
;; of the paragraph containing the faulty object. It is
;; not very accurate but may be enough for now.
- (list (org-element-property :contents-begin
+ (list (org-element-contents-begin
(org-element-parent text))
"Possibly incomplete citation markup")))))
@@ -1335,13 +1335,13 @@ Use \"export %s\" instead"
(string-to-number (match-string 0 bullet)))))
(true-number
(org-list-get-item-number
- (org-element-property :begin item)
+ (org-element-begin item)
(org-element-property :structure item)
(org-list-prevs-alist (org-element-property :structure
item))
(org-list-parents-alist (org-element-property :structure
item)))))
(unless (equal bullet-number (car (last true-number)))
(list
- (org-element-property :begin item)
+ (org-element-begin item)
(format "Bullet counter \"%s\" is not the same with item position
%d. Consider adding manual [@%d] counter."
bullet (car (last true-number)) bullet-number))))))))
@@ -1351,7 +1351,7 @@ AST is the buffer parse tree."
(org-element-map ast 'latex-fragment
(lambda (fragment)
(and (string-match-p "^[$][^$]" (org-element-property :value fragment))
- (list (org-element-property :begin fragment)
+ (list (org-element-begin fragment)
"Potentially confusing LaTeX fragment format. Prefer using
more reliable \\(...\\)")))))
(defun org-lint-LaTeX-$-ambiguous (_)
"Report LaTeX fragment-like text.
diff --git a/lisp/org-list.el b/lisp/org-list.el
index c59083cdb7..0713b4021e 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -117,6 +117,13 @@
(declare-function org-element-normalize-string "org-element" (s))
(declare-function org-element-parse-buffer "org-element" (&optional
granularity visible-only keep-deferred))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-begin "org-element" (node))
+(declare-function org-element-end "org-element" (node))
+(declare-function org-element-contents-begin "org-element" (node))
+(declare-function org-element-contents-end "org-element" (node))
+(declare-function org-element-post-affiliated "org-element" (node))
+(declare-function org-element-post-blank "org-element" (node))
+(declare-function org-element-parent "org-element-ast" (node))
(declare-function org-element-put-property "org-element-ast" (node property
value))
(declare-function org-element-set "org-element-ast" (old new))
(declare-function org-element-type-p "org-element-ast" (node types))
@@ -2383,10 +2390,10 @@ is an integer, 0 means `-', 1 means `+' etc. If WHICH
is
(when (org-element-type-p e '(item plain-list))
;; Look for ATTR_ORG attribute in the current plain list.
(let ((plain-list (org-element-lineage e 'plain-list t)))
- (org-with-point-at (org-element-property :post-affiliated plain-list)
+ (org-with-point-at (org-element-post-affiliated plain-list)
(let ((case-fold-search t)
(regexp "^[ \t]*#\\+attr_org:.* :radio \\(\\S-+\\)")
- (begin (org-element-property :begin plain-list)))
+ (begin (org-element-begin plain-list)))
(and (re-search-backward regexp begin t)
(not (string-equal "nil" (match-string 1)))))))))))
@@ -2583,7 +2590,7 @@ With optional prefix argument ALL, do this for the whole
buffer."
'(drawer center-block dynamic-block inlinetask item
quote-block special-block verse-block)))
(beg (if container
- (org-element-property :contents-begin container)
+ (org-element-contents-begin container)
(save-excursion
(org-with-limited-levels
(outline-previous-heading))
@@ -2593,7 +2600,7 @@ With optional prefix argument ALL, do this for the whole
buffer."
(goto-char beg)
(let ((end
(if container
- (org-element-property :contents-end container)
+ (org-element-contents-end container)
(save-excursion
(org-with-limited-levels (outline-next-heading))
(point))))
@@ -2608,7 +2615,7 @@ With optional prefix argument ALL, do this for the whole
buffer."
(while (setq element (org-element-lineage
element 'plain-list))
(goto-char
- (min (org-element-property :end element)
+ (min (org-element-end element)
end))))))
;; Cache count for cookies applying to the same
;; area. Then return it.
@@ -3050,25 +3057,23 @@ With a prefix argument ARG, change the region in a
single item."
(setq element (org-element-at-point))
(when (org-element-type-p element 'footnote-definition)
(push (buffer-substring-no-properties
- (org-element-property :begin element)
- (org-element-property :end element))
+ (org-element-begin element)
+ (org-element-end element))
definitions)
;; Ensure at least 2 blank lines after the last
;; footnote definition, thus not slurping the
;; following element.
- (unless (<= 2 (org-element-property
- :post-blank
+ (unless (<= 2 (org-element-post-blank
(org-element-at-point)))
(setf (car definitions)
(concat (car definitions)
(make-string
- (- 2 (org-element-property
- :post-blank
+ (- 2 (org-element-post-blank
(org-element-at-point)))
?\n))))
(delete-region
- (org-element-property :begin element)
- (org-element-property :end element))))
+ (org-element-begin element)
+ (org-element-end element))))
definitions))))
(shift-text
(lambda (ind end)
@@ -3215,8 +3220,7 @@ With a prefix argument ARG, change the region in a single
item."
(when footnote-definitions
;; If the new list is followed by same-level items,
;; move past them as well.
- (goto-char (org-element-property
- :end
+ (goto-char (org-element-end
(org-element-lineage
(org-element-at-point (1- end))
'plain-list t)))
diff --git a/lisp/org-macro.el b/lisp/org-macro.el
index 5846894063..e694118fc9 100644
--- a/lisp/org-macro.el
+++ b/lisp/org-macro.el
@@ -63,6 +63,8 @@
(declare-function org-element-put-property "org-element-ast" (node property
value))
(declare-function org-element-parse-secondary-string "org-element" (string
restriction &optional parent))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-begin "org-element" (node))
+(declare-function org-element-end "org-element" (node))
(declare-function org-element-restriction "org-element" (element))
(declare-function org-element-type "org-element-ast" (node &optional
anonymous))
(declare-function org-element-type-p "org-element-ast" (node types))
@@ -255,7 +257,7 @@ a definition in TEMPLATES."
(org-element-put-property macro :parent nil)
(let* ((key (org-element-property :key macro))
(value (org-macro-expand macro templates))
- (begin (org-element-property :begin macro))
+ (begin (org-element-begin macro))
(signature (list begin
macro
(org-element-property :args macro))))
@@ -269,7 +271,7 @@ a definition in TEMPLATES."
(delete-region
begin
;; Preserve white spaces after the macro.
- (progn (goto-char (org-element-property :end macro))
+ (progn (goto-char (org-element-end macro))
(skip-chars-backward " \t")
(point)))
;; Leave point before replacement in case of
diff --git a/lisp/org-pcomplete.el b/lisp/org-pcomplete.el
index c2fe76a088..e7ff89245f 100644
--- a/lisp/org-pcomplete.el
+++ b/lisp/org-pcomplete.el
@@ -40,6 +40,7 @@
(declare-function org-buffer-property-keys "org" (&optional specials defaults
columns))
(declare-function org-element-at-point "org-element" (&optional pom
cached-only))
(declare-function org-element-property "org-element-ast" property node)
+(declare-function org-element-end "org-element" (node))
(declare-function org-element-type-p "org-element-ast" (node types))
(declare-function org-end-of-meta-data "org" (&optional full))
(declare-function org-entry-properties "org" (&optional pom which))
@@ -399,7 +400,7 @@ This needs more work, to handle headings with lots of
spaces in them."
(let ((drawer (org-element-at-point)))
(when (org-element-type-p drawer '(drawer property-drawer))
(push (org-element-property :drawer-name drawer) names)
- (goto-char (org-element-property :end drawer))))))
+ (goto-char (org-element-end drawer))))))
(pcomplete-uniquify-list names))))
(substring pcomplete-stub 1))) ;remove initial colon
diff --git a/lisp/org-src.el b/lisp/org-src.el
index 357ad84691..e7f9dbf880 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -52,6 +52,13 @@
(blob &optional types with-self))
(declare-function org-element--parse-paired-brackets "org-element" (char))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-begin "org-element" (node))
+(declare-function org-element-end "org-element" (node))
+(declare-function org-element-contents-begin "org-element" (node))
+(declare-function org-element-contents-end "org-element" (node))
+(declare-function org-element-post-affiliated "org-element" (node))
+(declare-function org-element-post-blank "org-element" (node))
+(declare-function org-element-parent "org-element-ast" (node))
(declare-function org-element-type "org-element-ast" (node &optional
anonymous))
(declare-function org-element-type-p "org-element-ast" (node types))
(declare-function org-footnote-goto-definition "org-footnote"
@@ -378,36 +385,36 @@ where BEG and END are buffer positions and CONTENTS is a
string."
(cond
((eq type 'footnote-definition)
(let* ((beg (progn
- (goto-char (org-element-property :post-affiliated datum))
+ (goto-char (org-element-post-affiliated datum))
(search-forward "]")))
- (end (or (org-element-property :contents-end datum) beg)))
+ (end (or (org-element-contents-end datum) beg)))
(list beg end (buffer-substring-no-properties beg end))))
((eq type 'inline-src-block)
- (let ((beg (progn (goto-char (org-element-property :begin datum))
+ (let ((beg (progn (goto-char (org-element-begin datum))
(search-forward "{" (line-end-position) t)))
- (end (progn (goto-char (org-element-property :end datum))
+ (end (progn (goto-char (org-element-end datum))
(search-backward "}" (line-beginning-position) t))))
(list beg end (buffer-substring-no-properties beg end))))
((eq type 'latex-fragment)
- (let ((beg (org-element-property :begin datum))
- (end (org-with-point-at (org-element-property :end datum)
+ (let ((beg (org-element-begin datum))
+ (end (org-with-point-at (org-element-end datum)
(skip-chars-backward " \t")
(point))))
(list beg end (buffer-substring-no-properties beg end))))
- ((org-element-property :contents-begin datum)
- (let ((beg (org-element-property :contents-begin datum))
- (end (org-element-property :contents-end datum)))
+ ((org-element-contents-begin datum)
+ (let ((beg (org-element-contents-begin datum))
+ (end (org-element-contents-end datum)))
(list beg end (buffer-substring-no-properties beg end))))
((memq type '(example-block export-block src-block comment-block))
- (list (progn (goto-char (org-element-property :post-affiliated datum))
+ (list (progn (goto-char (org-element-post-affiliated datum))
(line-beginning-position 2))
- (progn (goto-char (org-element-property :end datum))
+ (progn (goto-char (org-element-end datum))
(skip-chars-backward " \r\t\n")
(line-beginning-position 1))
(org-element-property :value datum)))
((memq type '(fixed-width latex-environment table))
- (let ((beg (org-element-property :post-affiliated datum))
- (end (progn (goto-char (org-element-property :end datum))
+ (let ((beg (org-element-post-affiliated datum))
+ (end (progn (goto-char (org-element-end datum))
(skip-chars-backward " \r\t\n")
(line-beginning-position 2))))
(list beg
@@ -448,10 +455,10 @@ END."
"Non-nil when point is on DATUM.
DATUM is an element or an object. Consider blank lines or white
spaces after it as being outside."
- (and (>= (point) (org-element-property :begin datum))
+ (and (>= (point) (org-element-begin datum))
(<= (point)
(org-with-wide-buffer
- (goto-char (org-element-property :end datum))
+ (goto-char (org-element-end datum))
(skip-chars-backward " \r\t\n")
(if (eq (org-element-class datum) 'element)
(line-end-position)
@@ -541,7 +548,7 @@ Leave point in edit buffer."
(source-file-name (buffer-file-name (buffer-base-buffer)))
(source-tab-width (if indent-tabs-mode tab-width 0))
(type (org-element-type datum))
- (block-ind (org-with-point-at (org-element-property :begin datum)
+ (block-ind (org-with-point-at (org-element-begin datum)
(cond
((save-excursion (skip-chars-backward " \t") (bolp))
(org-current-text-indentation))
@@ -1052,12 +1059,12 @@ A coderef format regexp can only match at the end of a
line."
(contents
(org-with-wide-buffer
(buffer-substring-no-properties
- (or (org-element-property :post-affiliated definition)
- (org-element-property :begin definition))
+ (or (org-element-post-affiliated definition)
+ (org-element-begin definition))
(cond
- (inline? (1+ (org-element-property :contents-end definition)))
- ((org-element-property :contents-end definition))
- (t (goto-char (org-element-property :post-affiliated definition))
+ (inline? (1+ (org-element-contents-end definition)))
+ ((org-element-contents-end definition))
+ (t (goto-char (org-element-post-affiliated definition))
(line-end-position)))))))
(add-text-properties
0
@@ -1128,9 +1135,9 @@ Throw an error when not at such a table."
(user-error "Not on a LaTeX fragment"))
(let* ((contents
(buffer-substring-no-properties
- (org-element-property :begin context)
- (- (org-element-property :end context)
- (org-element-property :post-blank context))))
+ (org-element-begin context)
+ (- (org-element-end context)
+ (org-element-post-blank context))))
(delim-length (if (string-match "\\`\\$[^$]" contents) 1 2)))
;; Make the LaTeX deliminators read-only.
(add-text-properties 0 delim-length
diff --git a/lisp/org-table.el b/lisp/org-table.el
index ebb09be3f5..568c6870b4 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -59,6 +59,8 @@
(declare-function org-element-map "org-element" (data types fun &optional info
first-match no-recursion with-affiliated))
(declare-function org-element-parse-buffer "org-element" (&optional
granularity visible-only keep-deferred))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-end "org-element" (node))
+(declare-function org-element-post-affiliated "org-element" (node))
(declare-function org-element-type-p "org-element-ast" (node types))
(declare-function org-element-cache-reset "org-element" (&optional all
no-persistence))
(declare-function org-entry-get "org" (pom property &optional inherit
literal-nil))
@@ -1015,7 +1017,7 @@ With a non-nil optional argument TABLE-TYPE, return the
beginning
of a table.el-type table. This function assumes point is on
a table."
(cond (table-type
- (org-element-property :post-affiliated (org-element-at-point)))
+ (org-element-post-affiliated (org-element-at-point)))
((save-excursion
(and (re-search-backward org-table-border-regexp nil t)
(line-beginning-position 2))))
@@ -1029,7 +1031,7 @@ a table.el-type table. This function assumes point is on
a table."
(save-excursion
(cond (table-type
- (goto-char (org-element-property :end (org-element-at-point)))
+ (goto-char (org-element-end (org-element-at-point)))
(skip-chars-backward " \t\n")
(line-beginning-position 2))
((re-search-forward org-table-border-regexp nil t)
@@ -4264,8 +4266,8 @@ beginning and end position of the current table."
(unless quietly
(message "Mapping tables: %d%%"
(floor (* 100.0 (point)) (buffer-size))))
- (goto-char (org-element-property :post-affiliated table))
- (let ((end (copy-marker (org-element-property :end table))))
+ (goto-char (org-element-post-affiliated table))
+ (let ((end (copy-marker (org-element-end table))))
(unwind-protect
(progn (funcall f) (goto-char end))
(set-marker end nil)))))))
diff --git a/lisp/org.el b/lisp/org.el
index e747efabba..a80f3c90f3 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -186,6 +186,13 @@ Stars are put in group 1 and the trimmed body in group 2.")
(declare-function org-element-parse-buffer "org-element" (&optional
granularity visible-only keep-deferred))
(declare-function org-element-parse-secondary-string "org-element" (string
restriction &optional parent))
(declare-function org-element-property "org-element-ast" (property node))
+(declare-function org-element-begin "org-element" (node))
+(declare-function org-element-end "org-element" (node))
+(declare-function org-element-contents-begin "org-element" (node))
+(declare-function org-element-contents-end "org-element" (node))
+(declare-function org-element-post-affiliated "org-element" (node))
+(declare-function org-element-post-blank "org-element" (node))
+(declare-function org-element-parent "org-element-ast" (node))
(declare-function org-element-put-property "org-element-ast" (node property
value))
(declare-function org-element-restriction "org-element" (element))
(declare-function org-element-swap-A-B "org-element" (elem-a elem-b))
@@ -6850,7 +6857,7 @@ Assume point is at a heading or an inlinetask beginning."
((and (looking-at-p org-footnote-definition-re)
(let ((e (org-element-at-point)))
(and (org-element-type-p e 'footnote-definition)
- (goto-char (org-element-property :end e))))))
+ (goto-char (org-element-end e))))))
((looking-at-p org-outline-regexp) (forward-line))
;; Give up if shifting would move before column 0 or
;; if it would introduce a headline or a footnote
@@ -6871,7 +6878,7 @@ Assume point is at a heading or an inlinetask beginning."
e '(example-block src-block))
(or org-src-preserve-indentation
(org-element-property :preserve-indent e))
- (goto-char (org-element-property :end e))
+ (goto-char (org-element-end e))
(progn (skip-chars-backward " \r\t\n")
(beginning-of-line)
t))))
@@ -6884,7 +6891,7 @@ Assume point is at a heading or an inlinetask beginning."
((and (looking-at-p org-footnote-definition-re)
(let ((e (org-element-at-point)))
(and (org-element-type-p e 'footnote-definition)
- (goto-char (org-element-property :end e))))))
+ (goto-char (org-element-end e))))))
((looking-at-p org-outline-regexp) (forward-line))
((looking-at-p "[ \t]*$") (forward-line))
(t
@@ -6896,7 +6903,7 @@ Assume point is at a heading or an inlinetask beginning."
e '(example-block src-block))
(or org-src-preserve-indentation
(org-element-property :preserve-indent e))
- (goto-char (org-element-property :end e))
+ (goto-char (org-element-end e))
(progn (skip-chars-backward " \r\t\n")
(beginning-of-line)
t))))
@@ -7275,9 +7282,9 @@ Use the command `\\[widen]' to see the whole buffer
again."
(let* ((heading (org-element-lineage
(or element (org-element-at-point))
'headline t))
- (end (org-element-property :end heading)))
+ (end (org-element-end heading)))
(if (and heading end)
- (narrow-to-region (org-element-property :begin heading)
+ (narrow-to-region (org-element-begin heading)
(if (= end (point-max))
end (1- end)))
(signal 'outline-before-first-heading nil)))
@@ -7595,7 +7602,7 @@ Assume S may contain only objects."
(let ((new (org-element-property :value o)))
(org-element-insert-before new o)
(org-element-put-property
- new :post-blank (org-element-property :post-blank o))))
+ new :post-blank (org-element-post-blank o))))
;; Non-terminal objects. Splice contents.
(type
(let ((contents
@@ -7607,7 +7614,7 @@ Assume S may contain only objects."
(setq c (pop contents))
(org-element-insert-before c o))
(org-element-put-property
- c :post-blank (org-element-property :post-blank o)))))
+ c :post-blank (org-element-post-blank o)))))
(org-element-extract o)))
;; Return modified tree.
tree)))
@@ -7959,7 +7966,7 @@ call CMD."
(let ((pos (or pos (point))))
(if (org-element--cache-active-p)
;; Sync cache.
- (org-with-point-at (org-element-property :begin
(org-element-at-point pos))
+ (org-with-point-at (org-element-begin (org-element-at-point pos))
(or (org-entry-get-with-inheritance "CATEGORY")
"???"))
(or (get-text-property pos 'org-category)
@@ -8487,9 +8494,9 @@ a link."
;; to be on par with behavior on links.
(skip-chars-forward " \t")
(let ((begin
- (org-element-property :contents-begin context)))
+ (org-element-contents-begin context)))
(if begin (< (point) begin)
- (= (org-element-property :post-affiliated context)
+ (= (org-element-post-affiliated context)
(line-beginning-position)))))))
(org-footnote-action))
;; On a planning line. Check if we are really on a timestamp.
@@ -8500,14 +8507,14 @@ a link."
;; before opening it.
((and (eq type 'clock)
value
- (>= (point) (org-element-property :begin value))
- (<= (point) (org-element-property :end value)))
+ (>= (point) (org-element-begin value))
+ (<= (point) (org-element-end value)))
(org-follow-timestamp-link))
((eq type 'src-block) (org-babel-open-src-block-result))
;; Do nothing on white spaces after an object.
((>= (point)
(save-excursion
- (goto-char (org-element-property :end context))
+ (goto-char (org-element-end context))
(skip-chars-backward " \t")
(point)))
(user-error "No link found"))
@@ -10471,7 +10478,7 @@ narrowing."
(while (re-search-forward regexp end t)
(let ((element (org-element-at-point)))
(when (org-element-type-p element 'drawer)
- (let ((cend (org-element-property :contents-end element)))
+ (let ((cend (org-element-contents-end element)))
(when (and (not org-log-states-order-reversed) cend)
(goto-char cend)))
(throw 'exit nil))))
@@ -10681,9 +10688,9 @@ POS may also be a marker."
(goto-char pos)
(let ((drawer (org-element-at-point)))
(when (and (org-element-type-p drawer '(drawer property-drawer))
- (not (org-element-property :contents-begin drawer)))
- (delete-region (org-element-property :begin drawer)
- (progn (goto-char (org-element-property :end drawer))
+ (not (org-element-contents-begin drawer)))
+ (delete-region (org-element-begin drawer)
+ (progn (goto-char (org-element-end drawer))
(skip-chars-backward " \r\t\n")
(forward-line)
(point))))))))
@@ -11090,7 +11097,7 @@ headlines matching this string."
org-outline-regexp))))
(org-element-cache-map
(lambda (el)
- (goto-char (org-element-property :begin el))
+ (goto-char (org-element-begin el))
(setq todo (org-element-property :todo-keyword el)
level (org-element-property :level el)
category (org-entry-get-with-inheritance "CATEGORY" nil
el)
@@ -11154,7 +11161,7 @@ headlines matching this string."
(setq txt (org-add-props txt nil
'effort effort
'effort-minutes effort-minutes)))
- (goto-char (org-element-property :begin el))
+ (goto-char (org-element-begin el))
(setq marker (org-agenda-new-marker))
(org-add-props txt props
'org-marker marker 'org-hd-marker marker 'org-category
category
@@ -11172,7 +11179,7 @@ headlines matching this string."
;; if we are to skip sublevels, jump to end of subtree
(unless org-tags-match-list-sublevels
- (goto-char (1- (org-element-property :end el))))))
+ (goto-char (1- (org-element-end el))))))
;; Get the correct position from where to continue
(when org-map-continue-from
(setq org-element-cache-map-continue-from
org-map-continue-from)
@@ -13017,7 +13024,7 @@ However, if LITERAL-NIL is set, return the string value
\"nil\" instead."
value)))
(cond
((car v)
- (move-marker org-entry-property-inherited-from
(org-element-property :begin element))
+ (move-marker org-entry-property-inherited-from
(org-element-begin element))
(throw 'exit nil))
((org-element-parent element)
(setq element (org-element-parent element)))
@@ -15880,8 +15887,8 @@ fragments in the buffer."
;; Toggle preview on LaTeX code at point.
((let ((datum (org-element-context)))
(and (org-element-type-p datum '(latex-environment latex-fragment))
- (let ((beg (org-element-property :begin datum))
- (end (org-element-property :end datum)))
+ (let ((beg (org-element-begin datum))
+ (end (org-element-end datum)))
(if (org-clear-latex-preview beg end)
(message "LaTeX preview removed")
(message "Creating LaTeX preview...")
@@ -15932,9 +15939,9 @@ Some of the options can be changed using the variable
(when (memq type '(latex-environment latex-fragment))
(let ((block-type (eq type 'latex-environment))
(value (org-element-property :value context))
- (beg (org-element-property :begin context))
+ (beg (org-element-begin context))
(end (save-excursion
- (goto-char (org-element-property :end context))
+ (goto-char (org-element-end context))
(skip-chars-backward " \r\t\n")
(point))))
(cond
@@ -16485,7 +16492,7 @@ buffer boundaries with possible narrowing."
;; contains filenames in both the path and the
;; description, prioritize the path only when
;; INCLUDE-LINKED is non-nil.
- ((or (not (org-element-property :contents-begin link))
+ ((or (not (org-element-contents-begin link))
include-linked)
(and (or (equal "file" linktype)
(equal "attachment" linktype))
@@ -16503,7 +16510,7 @@ buffer boundaries with possible narrowing."
org-link-plain-re))
;; File name must fill the whole
;; description.
- (= (org-element-property :contents-end link)
+ (= (org-element-contents-end link)
(match-end 0))
(progn
(setq linktype (match-string 1))
@@ -16519,17 +16526,17 @@ buffer boundaries with possible narrowing."
(when (and file (file-exists-p file))
(let ((width (org-display-inline-image--width link))
(old (get-char-property-and-overlay
- (org-element-property :begin link)
+ (org-element-begin link)
'org-image-overlay)))
(if (and (car-safe old) refresh)
(image-flush (overlay-get (cdr old) 'display))
(let ((image (org--create-inline-image file width)))
(when image
(let ((ov (make-overlay
- (org-element-property :begin link)
+ (org-element-begin link)
(progn
(goto-char
- (org-element-property :end link))
+ (org-element-end link))
(skip-chars-backward " \t")
(point)))))
;; FIXME: See bug#59902. We cannot rely
@@ -16568,11 +16575,11 @@ buffer boundaries with possible narrowing."
(let* ((case-fold-search t)
(par (org-element-lineage link 'paragraph))
(attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)")
- (par-end (org-element-property :post-affiliated par))
+ (par-end (org-element-post-affiliated par))
;; Try to find an attribute providing a :width.
(attr-width
(when (and par (org-with-point-at
- (org-element-property :begin par)
+ (org-element-begin par)
(re-search-forward attr-re par-end t)))
(match-string 1)))
(width
@@ -17644,7 +17651,7 @@ This command does many different things, depending on
context:
(let ((parent (org-element-parent context)))
(when (and (org-element-type-p parent 'item)
(= (line-beginning-position)
- (org-element-property :begin parent)))
+ (org-element-begin parent)))
(setq context parent)
(setq type 'item))))
;; Act according to type of element or object at point.
@@ -17674,14 +17681,14 @@ This command does many different things, depending on
context:
(org-clock-update-time-maybe)))
(`dynamic-block
(save-excursion
- (goto-char (org-element-property :post-affiliated context))
+ (goto-char (org-element-post-affiliated context))
(org-update-dblock)))
(`footnote-definition
- (goto-char (org-element-property :post-affiliated context))
+ (goto-char (org-element-post-affiliated context))
(call-interactively 'org-footnote-action))
(`footnote-reference (call-interactively #'org-footnote-action))
((or `headline `inlinetask)
- (save-excursion (goto-char (org-element-property :begin context))
+ (save-excursion (goto-char (org-element-begin context))
(call-interactively #'org-set-tags-command)))
(`item
;; At an item: `C-u C-u' sets checkbox to "[-]"
@@ -17699,7 +17706,7 @@ This command does many different things, depending on
context:
(prevs (org-list-prevs-alist struct))
(orderedp (org-not-nil (org-entry-get nil "ORDERED"))))
(org-list-set-checkbox
- (org-element-property :begin context) struct
+ (org-element-begin context) struct
(cond ((equal arg '(16)) "[-]")
((and (not box) (equal arg '(4))) "[ ]")
((or (not box) (equal arg '(4))) nil)
@@ -17735,7 +17742,7 @@ This command does many different things, depending on
context:
(and (boundp org-list-checkbox-radio-mode)
org-list-checkbox-radio-mode))
(org-toggle-radio-button arg)
- (let* ((begin (org-element-property :contents-begin context))
+ (let* ((begin (org-element-contents-begin context))
(struct (org-element-property :structure context))
(old-struct (copy-tree struct))
(first-box (save-excursion
@@ -17783,7 +17790,7 @@ This command does many different things, depending on
context:
;; send the table if necessary.
(cond
((and (org-match-line "[ \t]*#\\+plot:")
- (< (point) (org-element-property :post-affiliated context)))
+ (< (point) (org-element-post-affiliated context)))
(org-plot/gnuplot))
;; If the table has a `table.el' type, just give up.
((eq (org-element-property :type context) 'table.el)
@@ -17794,12 +17801,12 @@ Use `\\[org-edit-special]' to edit table.el tables")))
((or (eq type 'table)
;; Check if point is at a TBLFM line.
(and (eq type 'table-row)
- (= (point) (org-element-property :end context))))
+ (= (point) (org-element-end context))))
(save-excursion
(if (org-at-TBLFM-p)
(progn (require 'org-table)
(org-table-calc-current-TBLFM))
- (goto-char (org-element-property :contents-begin context))
+ (goto-char (org-element-contents-begin context))
(org-call-with-arg 'org-table-recalculate (or arg t))
(orgtbl-send-table 'maybe))))
(t
@@ -17934,8 +17941,8 @@ object (e.g., within a comment). In these case, you
need to use
;; column or after last one, split the table.
((or (and (eq 'table element-type)
(not (eq 'table.el (org-element-property :type context)))
- (>= (point) (org-element-property :contents-begin context))
- (< (point) (org-element-property :contents-end context)))
+ (>= (point) (org-element-contents-begin context))
+ (< (point) (org-element-contents-end context)))
(org-element-lineage context '(table-row table-cell) t))
(if (or (looking-at-p "[ \t]*$")
(save-excursion (skip-chars-backward " \t") (bolp)))
@@ -17950,7 +17957,7 @@ object (e.g., within a comment). In these case, you
need to use
;; Ensure point is not on the white spaces after
;; the link.
(let ((origin (point)))
- (org-with-point-at (org-element-property :end context)
+ (org-with-point-at (org-element-end context)
(skip-chars-backward " \t")
(> (point) origin))))
(org-in-regexp org-ts-regexp-both nil t)
@@ -18673,10 +18680,10 @@ When ELEMENT is provided, it is considered to be
element at point."
(when (org-element-type-p element 'src-block)
(or (not inside)
(not (or (= (line-beginning-position)
- (org-element-property :post-affiliated element))
+ (org-element-post-affiliated element))
(= (1+ (line-end-position))
- (- (org-element-property :end element)
- (org-element-property :post-blank element))))))))
+ (- (org-element-end element)
+ (org-element-post-blank element))))))))
(defun org-context ()
"Return a list of contexts of the current cursor position.
@@ -19002,7 +19009,7 @@ Optional argument ELEMENT contains element at BEG."
(org-element-property :drawer-name element)))
(`clock
;; Previous element must be headline metadata or headline.
- (goto-char (1- (org-element-property :begin element)))
+ (goto-char (1- (org-element-begin element)))
(or (org-at-heading-p)
(org--at-headline-data-p)))))))
@@ -19013,8 +19020,8 @@ ELEMENT is an element containing point. CONTENTSP is
non-nil
when indentation is to be computed according to contents of
ELEMENT."
(let ((type (org-element-type element))
- (start (org-element-property :begin element))
- (post-affiliated (org-element-property :post-affiliated element)))
+ (start (org-element-begin element))
+ (post-affiliated (org-element-post-affiliated element)))
(org-with-wide-buffer
(cond
(contentsp
@@ -19053,16 +19060,16 @@ ELEMENT."
(goto-char (1- start))
(let* ((previous (org-element-at-point))
(parent previous))
- (while (and parent (<= (org-element-property :end parent) start))
+ (while (and parent (<= (org-element-end parent) start))
(setq previous parent
parent (org-element-parent parent)))
(cond
((not previous) (throw 'exit 0))
- ((> (org-element-property :end previous) start)
+ ((> (org-element-end previous) start)
(throw 'exit (org--get-expected-indentation previous t)))
((org-element-type-p
previous '(footnote-definition inlinetask))
- (setq start (org-element-property :begin previous)))
+ (setq start (org-element-begin previous)))
;; Do not indent like previous when the previous
;; element is headline data and `org-adapt-indentation'
;; is set to `headline-data'.
@@ -19071,7 +19078,7 @@ ELEMENT."
(or (org-at-heading-p)
(org--at-headline-data-p (1- start) previous)))
(throw 'exit 0))
- (t (goto-char (org-element-property :begin previous))
+ (t (goto-char (org-element-begin previous))
(throw 'exit
(if (bolp) (current-indentation)
;; At first paragraph in an item or
@@ -19107,7 +19114,7 @@ ELEMENT."
;; POS is after contents in a greater element. Indent like
;; the beginning of the element.
((and (memq type org-element-greater-elements)
- (let ((cend (org-element-property :contents-end element)))
+ (let ((cend (org-element-contents-end element)))
(and cend (<= cend pos))))
;; As a special case, if point is at the end of a footnote
;; definition or an item, indent like the very last element
@@ -19193,26 +19200,26 @@ Also align node properties according to
`org-property-format'."
;; Not at headline data and previous is headline
data/headline.
(or (memq type '(headline inlinetask)) ; blank lines
after heading
(save-excursion
- (goto-char (1- (org-element-property :begin
element)))
+ (goto-char (1- (org-element-begin element)))
(or (org-at-heading-p)
(org--at-headline-data-p))))))
(cond ((and (memq type '(plain-list item))
(= (line-beginning-position)
- (org-element-property :post-affiliated element)))
+ (org-element-post-affiliated element)))
nil)
((and (eq type 'latex-environment)
- (>= (point) (org-element-property :post-affiliated element))
+ (>= (point) (org-element-post-affiliated element))
(< (point)
- (org-with-point-at (org-element-property :end element)
+ (org-with-point-at (org-element-end element)
(skip-chars-backward " \t\n")
(line-beginning-position 2))))
nil)
((and (eq type 'src-block)
org-src-tab-acts-natively
(> (line-beginning-position)
- (org-element-property :post-affiliated element))
+ (org-element-post-affiliated element))
(< (line-beginning-position)
- (org-with-point-at (org-element-property :end element)
+ (org-with-point-at (org-element-end element)
(skip-chars-backward " \t\n")
(line-beginning-position))))
;; At the beginning of a blank line, do some preindentation. This
@@ -19220,7 +19227,7 @@ Also align node properties according to
`org-property-format'."
(when (and (looking-at-p "^[[:space:]]*$")
(not org-src-preserve-indentation))
(let (block-content-ind some-ind)
- (org-with-point-at (org-element-property :begin element)
+ (org-with-point-at (org-element-begin element)
(setq block-content-ind (+ (org-current-text-indentation)
org-edit-src-content-indentation))
(forward-line)
@@ -19268,7 +19275,7 @@ assumed to be significant there."
(if (or (looking-at-p " \r\t\n") (org-at-heading-p)) (forward-line)
(let* ((element (org-element-at-point))
(type (org-element-type element))
- (element-end (copy-marker (org-element-property :end element)))
+ (element-end (copy-marker (org-element-end element)))
(ind (org--get-expected-indentation element nil)))
(cond
;; Element indented as a single block. Example blocks
@@ -19282,8 +19289,8 @@ assumed to be significant there."
(org-element-property :preserve-indent element)))))
(let ((offset (- ind (current-indentation))))
(unless (zerop offset)
- (indent-rigidly (org-element-property :begin element)
- (org-element-property :end element)
+ (indent-rigidly (org-element-begin element)
+ (org-element-end element)
offset)))
(goto-char element-end))
;; Elements indented line wise. Be sure to exclude
@@ -19291,7 +19298,7 @@ assumed to be significant there."
;; blocks from this category as they are treated
;; specially later.
((or (memq type '(paragraph table table-row))
- (not (or (org-element-property :contents-begin element)
+ (not (or (org-element-contents-begin element)
(memq type '(example-block src-block)))))
(when (eq type 'node-property)
(org--align-node-property)
@@ -19304,11 +19311,11 @@ assumed to be significant there."
;; indented as a single block.
(t
(let* ((post (copy-marker
- (org-element-property :post-affiliated element)))
+ (org-element-post-affiliated element)))
(cbeg
(copy-marker
(cond
- ((not (org-element-property :contents-begin element))
+ ((not (org-element-contents-begin element))
;; Fake contents for source blocks.
(org-with-wide-buffer
(goto-char post)
@@ -19323,9 +19330,9 @@ assumed to be significant there."
(end-of-line)
(skip-chars-forward " \r\t\n")
(if (eobp) (point) (line-beginning-position))))
- (t (org-element-property :contents-begin element)))))
+ (t (org-element-contents-begin element)))))
(cend (copy-marker
- (or (org-element-property :contents-end element)
+ (or (org-element-contents-end element)
;; Fake contents for source blocks.
(org-with-wide-buffer
(goto-char element-end)
@@ -19338,8 +19345,8 @@ assumed to be significant there."
(cond ((eq type 'plain-list)
(let ((offset (- ind (org-current-text-indentation))))
(unless (zerop offset)
- (indent-rigidly (org-element-property :begin element)
- (org-element-property :end element)
+ (indent-rigidly (org-element-begin element)
+ (org-element-end element)
offset))
(goto-char cbeg)))
((eq type 'item) (goto-char cbeg))
@@ -19376,8 +19383,8 @@ assumed to be significant there."
(unless (org-element-type-p element '(drawer property-drawer))
(user-error "Not at a drawer"))
(org-with-wide-buffer
- (org-indent-region (org-element-property :begin element)
- (org-element-property :end element))))
+ (org-indent-region (org-element-begin element)
+ (org-element-end element))))
(message "Drawer at point indented"))
(defun org-indent-block ()
@@ -19396,8 +19403,8 @@ assumed to be significant there."
src-block verse-block))
(user-error "Not at a block"))
(org-with-wide-buffer
- (org-indent-region (org-element-property :begin element)
- (org-element-property :end element))))
+ (org-indent-region (org-element-begin element)
+ (org-element-end element))))
(message "Block at point indented"))
@@ -19471,7 +19478,7 @@ matches in paragraphs or comments, use it."
(beginning-of-line)
(org-element-at-point)))
(type (org-element-type element))
- (post-affiliated (org-element-property :post-affiliated element)))
+ (post-affiliated (org-element-post-affiliated element)))
(unless (< p post-affiliated)
(cl-case type
(comment
@@ -19490,7 +19497,7 @@ matches in paragraphs or comments, use it."
(beginning-of-line)
(cond ((org-element-type-p parent 'item)
(make-string (org-list-item-body-column
- (org-element-property :begin parent))
+ (org-element-begin parent))
?\s))
((and adaptive-fill-regexp
;; Locally disable
@@ -19500,7 +19507,7 @@ matches in paragraphs or comments, use it."
(let (adaptive-fill-function)
(fill-context-prefix
post-affiliated
- (org-element-property :end element)))))
+ (org-element-end element)))))
((looking-at "[ \t]+") (match-string 0))
(t "")))))
(comment-block
@@ -19509,7 +19516,7 @@ matches in paragraphs or comments, use it."
(forward-line)
(point)))
(cend (save-excursion
- (goto-char (org-element-property :end element))
+ (goto-char (org-element-end element))
(skip-chars-backward " \r\t\n")
(line-beginning-position))))
(when (and (>= p cbeg) (< p cend))
@@ -19557,15 +19564,15 @@ a footnote definition, try to fill the first
paragraph within."
(table
(when (eq (org-element-property :type element) 'org)
(save-excursion
- (goto-char (org-element-property :post-affiliated element))
+ (goto-char (org-element-post-affiliated element))
(org-table-align)))
t)
(paragraph
;; Paragraphs may contain `line-break' type objects.
(let ((beg (max (point-min)
- (org-element-property :contents-begin element)))
+ (org-element-contents-begin element)))
(end (min (point-max)
- (org-element-property :contents-end element))))
+ (org-element-contents-end element))))
;; Do nothing if point is at an affiliated keyword.
(if (< (line-end-position) beg) t
;; Fill paragraph, taking line breaks into account.
@@ -19588,12 +19595,12 @@ a footnote definition, try to fill the first
paragraph within."
(comment-block
(let* ((case-fold-search t)
(beg (save-excursion
- (goto-char (org-element-property :begin element))
+ (goto-char (org-element-begin element))
(re-search-forward "^[ \t]*#\\+begin_comment" nil t)
(forward-line)
(point)))
(end (save-excursion
- (goto-char (org-element-property :end element))
+ (goto-char (org-element-end element))
(re-search-backward "^[ \t]*#\\+end_comment" nil t)
(line-beginning-position))))
(if (or (< (point) beg) (> (point) end)) t
@@ -19607,8 +19614,8 @@ a footnote definition, try to fill the first paragraph
within."
justify))))
;; Fill comments.
(comment
- (let ((begin (org-element-property :post-affiliated element))
- (end (org-element-property :end element)))
+ (let ((begin (org-element-post-affiliated element))
+ (end (org-element-end element)))
(when (and (>= (point) begin) (<= (point) end))
(let ((begin (save-excursion
(end-of-line)
@@ -19757,14 +19764,14 @@ region only contains such lines."
((and (memq type '(babel-call clock comment diary-sexp headline
horizontal-rule keyword paragraph
planning))
- (<= (org-element-property :post-affiliated element) (point)))
+ (<= (org-element-post-affiliated element) (point)))
(skip-chars-forward " \t")
(insert ": "))
((and (looking-at-p "[ \t]*$")
(or (eq type 'inlinetask)
(save-excursion
(skip-chars-forward " \r\t\n")
- (<= (org-element-property :end element) (point)))))
+ (<= (org-element-end element) (point)))))
(delete-region (point) (line-end-position))
(org-indent-line)
(insert ": "))
@@ -19789,7 +19796,7 @@ region only contains such lines."
(while (< (point) end)
(let ((element (org-element-at-point)))
(if (org-element-type-p element 'fixed-width)
- (goto-char (org-element-property :end element))
+ (goto-char (org-element-end element))
(throw 'not-all-p nil))))
t))))
(if all-fixed-width-p
@@ -19828,7 +19835,7 @@ region only contains such lines."
(forward-line)))
((looking-at-p "[ \t]*:\\( \\|$\\)")
(let* ((element (org-element-at-point))
- (element-end (org-element-property :end element)))
+ (element-end (org-element-end element)))
(if (org-element-type-p element 'fixed-width)
(progn (goto-char element-end)
(skip-chars-backward " \r\t\n")
@@ -19891,11 +19898,11 @@ Throw an error if no block is found."
example-block export-block quote-block
special-block src-block verse-block))
(<= (match-beginning 0)
- (org-element-property :post-affiliated element)))
+ (org-element-post-affiliated element)))
(setq last-element element)
(cl-decf count))))
(if (= count 0)
- (prog1 (goto-char (org-element-property :post-affiliated last-element))
+ (prog1 (goto-char (org-element-post-affiliated last-element))
(save-match-data (org-fold-show-context)))
(goto-char origin)
(user-error "No %s code blocks" (if backward "previous" "further")))))
@@ -19943,11 +19950,11 @@ major mode."
(if (let ((element (org-element-at-point)))
(and (org-element-type-p element 'src-block)
(< (save-excursion
- (goto-char (org-element-property :post-affiliated element))
+ (goto-char (org-element-post-affiliated element))
(line-end-position))
(point))
(> (save-excursion
- (goto-char (org-element-property :end element))
+ (goto-char (org-element-end element))
(skip-chars-backward " \r\t\n")
(line-beginning-position))
(point))))
@@ -19967,11 +19974,11 @@ strictly within a source block, use appropriate
comment syntax."
(if (let ((element (org-element-at-point)))
(and (org-element-type-p element 'src-block)
(< (save-excursion
- (goto-char (org-element-property :post-affiliated element))
+ (goto-char (org-element-post-affiliated element))
(line-end-position))
beg)
(>= (save-excursion
- (goto-char (org-element-property :end element))
+ (goto-char (org-element-end element))
(skip-chars-backward " \r\t\n")
(line-beginning-position))
end)))
@@ -20329,18 +20336,18 @@ This will call `backward-sentence' or
`org-table-beginning-of-field',
depending on context."
(interactive)
(let* ((element (org-element-at-point))
- (contents-begin (org-element-property :contents-begin element))
+ (contents-begin (org-element-contents-begin element))
(table (org-element-lineage element 'table t)))
(if (and table
(> (point) contents-begin)
- (<= (point) (org-element-property :contents-end table)))
+ (<= (point) (org-element-contents-end table)))
(call-interactively #'org-table-beginning-of-field)
(save-restriction
(when (and contents-begin
(< (point-min) contents-begin)
(> (point) contents-begin))
(narrow-to-region contents-begin
- (org-element-property :contents-end element)))
+ (org-element-contents-end element)))
(call-interactively #'backward-sentence)))))
(defun org-forward-sentence (&optional _arg)
@@ -20354,20 +20361,20 @@ depending on context."
(narrow-to-region (line-beginning-position) (line-end-position))
(call-interactively #'forward-sentence))
(let* ((element (org-element-at-point))
- (contents-end (org-element-property :contents-end element))
+ (contents-end (org-element-contents-end element))
(table (org-element-lineage element 'table t)))
(if (and table
- (>= (point) (org-element-property :contents-begin table))
+ (>= (point) (org-element-contents-begin table))
(< (point) contents-end))
(call-interactively #'org-table-end-of-field)
(save-restriction
(when (and contents-end
(> (point-max) contents-end)
;; Skip blank lines between elements.
- (< (org-element-property :end element)
+ (< (org-element-end element)
(save-excursion (goto-char contents-end)
(skip-chars-forward " \r\t\n"))))
- (narrow-to-region (org-element-property :contents-begin element)
+ (narrow-to-region (org-element-contents-begin element)
contents-end))
;; End of heading is considered as the end of a sentence.
(let ((sentence-end (concat (sentence-end) "\\|^\\*+ .*$")))
@@ -20519,7 +20526,7 @@ interactive command with similar behavior."
'(headline inlinetask)
'include-self)))
(when heading
- (goto-char (org-element-property :begin heading)))
+ (goto-char (org-element-begin heading)))
(while (and (not invisible-ok)
heading
(org-fold-folded-p))
@@ -20528,7 +20535,7 @@ interactive command with similar behavior."
'(headline inlinetask)
'include-self))
(when heading
- (goto-char (org-element-property :begin heading))))
+ (goto-char (org-element-begin heading))))
(unless heading
(user-error "Before first headline at position %d in buffer %s"
(point) (current-buffer)))
@@ -20571,7 +20578,7 @@ Respect narrowing."
(if cached
(let ((cached-headline (org-element-lineage cached 'headline t)))
(or (not cached-headline)
- (< (org-element-property :begin cached-headline) (point-min))))
+ (< (org-element-begin cached-headline) (point-min))))
(org-with-limited-levels
(save-excursion
(end-of-line)
@@ -20694,13 +20701,13 @@ make a significant difference in outlines with very
many siblings."
(let* ((current-heading (org-element-lineage element '(headline
inlinetask) 'with-self))
(parent (org-element-lineage current-heading 'headline)))
(if (and parent
- (<= (point-min) (org-element-property :begin parent)))
+ (<= (point-min) (org-element-begin parent)))
(progn
- (goto-char (org-element-property :begin parent))
+ (goto-char (org-element-begin parent))
(org-element-property :level parent))
(when (and current-heading
- (<= (point-min) (org-element-property :begin
current-heading)))
- (goto-char (org-element-property :begin current-heading))
+ (<= (point-min) (org-element-begin current-heading)))
+ (goto-char (org-element-begin current-heading))
nil)))
(when (ignore-errors (org-back-to-heading t))
(let (level-cache)
@@ -20783,12 +20790,12 @@ return nil."
t)))
(when heading
(unless (or (org-element-type-p heading 'inlinetask)
- (not (org-element-property :contents-begin heading)))
+ (not (org-element-contents-begin heading)))
(let ((pos (point)))
- (goto-char (org-element-property :contents-begin heading))
+ (goto-char (org-element-contents-begin heading))
(if (re-search-forward
org-outline-regexp-bol
- (org-element-property :end heading)
+ (org-element-end heading)
t)
(progn (goto-char (match-beginning 0)) t)
(goto-char pos) nil)))))
@@ -20840,8 +20847,7 @@ If there is no such heading, return nil."
(let ((cached (or element (org-element-at-point nil t))))
(and cached
(org-element-type-p cached 'headline)
- (goto-char (org-element-property
- :end cached)))))
+ (goto-char (org-element-end cached)))))
(let ((first t)
(level (funcall outline-level)))
(cond ((= level 0)
@@ -21062,27 +21068,27 @@ Function may return a real element, or a
pseudo-element with type
(triplet
(cond
((memq type '(table property-drawer))
- (list (org-element-property :begin e)
- (org-element-property :end e)
+ (list (org-element-begin e)
+ (org-element-end e)
(org-element-parent e)))
((memq type '(node-property table-row))
(let ((e (org-element-parent e)))
- (list (org-element-property :begin e)
- (org-element-property :end e)
+ (list (org-element-begin e)
+ (org-element-end e)
(org-element-parent e))))
((memq type '(clock diary-sexp keyword))
(let* ((regexp (pcase type
(`clock org-clock-line-re)
(`diary-sexp "%%(")
(_ org-keyword-regexp)))
- (end (if (< 0 (org-element-property :post-blank e))
- (org-element-property :end e)
+ (end (if (< 0 (org-element-post-blank e))
+ (org-element-end e)
(org-with-wide-buffer
(forward-line)
(while (looking-at regexp) (forward-line))
(skip-chars-forward " \t\n")
(line-beginning-position))))
- (begin (org-with-point-at (org-element-property :begin e)
+ (begin (org-with-point-at (org-element-begin e)
(while (and (not (bobp)) (looking-at regexp))
(forward-line -1))
;; We may have gotten one line too far.
@@ -21098,12 +21104,12 @@ Function may return a real element, or a
pseudo-element with type
'(item plain-list))
(setq l (org-element-parent l)))
(and l org--single-lines-list-is-paragraph
- (org-with-point-at (org-element-property :post-affiliated l)
+ (org-with-point-at (org-element-post-affiliated l)
(forward-line (length (org-element-property :structure l)))
- (= (point) (org-element-property :contents-end l)))
+ (= (point) (org-element-contents-end l)))
;; Return value.
- (list (org-element-property :begin l)
- (org-element-property :end l)
+ (list (org-element-begin l)
+ (org-element-end l)
(org-element-parent l)))))
(t nil)))) ;no triplet: return element
(pcase triplet
@@ -21130,9 +21136,9 @@ See `org-forward-paragraph'."
(t
(let* ((element (org--paragraph-at-point))
(type (org-element-type element))
- (contents-begin (org-element-property :contents-begin element))
- (end (org-element-property :end element))
- (post-affiliated (org-element-property :post-affiliated element)))
+ (contents-begin (org-element-contents-begin element))
+ (end (org-element-end element))
+ (post-affiliated (org-element-post-affiliated element)))
(cond
((eq type 'plain-list)
(forward-char)
@@ -21203,10 +21209,10 @@ See `org-backward-paragraph'."
(t
(let* ((element (org--paragraph-at-point))
(type (org-element-type element))
- (begin (org-element-property :begin element))
- (post-affiliated (org-element-property :post-affiliated element))
- (contents-end (org-element-property :contents-end element))
- (end (org-element-property :end element))
+ (begin (org-element-begin element))
+ (post-affiliated (org-element-post-affiliated element))
+ (contents-end (org-element-contents-end element))
+ (end (org-element-end element))
(parent (org-element-parent element))
(reach
;; Move to the visible empty line above position P, or
@@ -21231,8 +21237,8 @@ See `org-backward-paragraph'."
;; element. Move to the beginning of the greater element.
((and parent
(not (org-element-type-p parent 'section))
- (= begin (org-element-property :contents-begin parent)))
- (funcall reach (org-element-property :begin parent)))
+ (= begin (org-element-contents-begin parent)))
+ (funcall reach (org-element-begin parent)))
;; Since we have to move anyway, find the beginning
;; position of the element above.
(t
@@ -21292,10 +21298,10 @@ Move to the next element at the same level, when
possible."
(user-error "Cannot move further down"))))
(t
(let* ((elem (org-element-at-point))
- (end (org-element-property :end elem))
+ (end (org-element-end elem))
(parent (org-element-parent elem)))
- (cond ((and parent (= (org-element-property :contents-end parent)
end))
- (goto-char (org-element-property :end parent)))
+ (cond ((and parent (= (org-element-contents-end parent) end))
+ (goto-char (org-element-end parent)))
((integer-or-marker-p end) (goto-char end))
(t (message "No element at point")))))))
@@ -21317,7 +21323,7 @@ Move to the previous element at the same level, when
possible."
(user-error "Cannot move further up"))))))
(t
(let* ((elem (org-element-at-point))
- (beg (org-element-property :begin elem)))
+ (beg (org-element-begin elem)))
(cond
;; Move to beginning of current element if point isn't
;; there already.
@@ -21327,10 +21333,10 @@ Move to the previous element at the same level, when
possible."
(skip-chars-backward " \r\t\n")
(unless (bobp)
(let ((prev (org-element-at-point)))
- (goto-char (org-element-property :begin prev))
+ (goto-char (org-element-begin prev))
(while (and (setq prev (org-element-parent prev))
- (<= (org-element-property :end prev) beg))
- (goto-char (org-element-property :begin prev)))))))))))
+ (<= (org-element-end prev) beg))
+ (goto-char (org-element-begin prev)))))))))))
(defun org-up-element ()
"Move to upper element."
@@ -21344,7 +21350,7 @@ Move to the previous element at the same level, when
possible."
(setq parent (org-element-parent parent)))
(if (and parent
(not (org-element-type-p parent 'org-data)))
- (goto-char (org-element-property :begin parent))
+ (goto-char (org-element-begin parent))
(if (org-with-limited-levels (org-before-first-heading-p))
(user-error "No surrounding element")
(org-with-limited-levels (org-back-to-heading)))))))
@@ -21355,12 +21361,12 @@ Move to the previous element at the same level, when
possible."
(let ((element (org-element-at-point)))
(cond
((org-element-type-p element '(plain-list table))
- (goto-char (org-element-property :contents-begin element))
+ (goto-char (org-element-contents-begin element))
(forward-char))
((org-element-type-p element org-element-greater-elements)
;; If contents are hidden, first disclose them.
(when (org-invisible-p (line-end-position)) (org-cycle))
- (goto-char (or (org-element-property :contents-begin element)
+ (goto-char (or (org-element-contents-begin element)
(user-error "No content for this element"))))
(t (user-error "No inner element")))))
@@ -21377,14 +21383,14 @@ Move to the previous element at the same level, when
possible."
(forward-char (- offset))))
(let ((prev-elem
(save-excursion
- (goto-char (org-element-property :begin elem))
+ (goto-char (org-element-begin elem))
(skip-chars-backward " \r\t\n")
(unless (bobp)
- (let* ((beg (org-element-property :begin elem))
+ (let* ((beg (org-element-begin elem))
(prev (org-element-at-point))
(up prev))
(while (and (setq up (org-element-parent up))
- (<= (org-element-property :end up) beg))
+ (<= (org-element-end up) beg))
(setq prev up))
prev)))))
;; Error out if no previous element or previous element is
@@ -21393,8 +21399,8 @@ Move to the previous element at the same level, when
possible."
(user-error "Cannot drag element backward")
(let ((pos (point)))
(org-element-swap-A-B prev-elem elem)
- (goto-char (+ (org-element-property :begin prev-elem)
- (- pos (org-element-property :begin elem))))))))))
+ (goto-char (+ (org-element-begin prev-elem)
+ (- pos (org-element-begin elem))))))))))
(defun org-drag-element-forward ()
"Move forward element at point."
@@ -21402,9 +21408,9 @@ Move to the previous element at the same level, when
possible."
(let* ((pos (point))
(elem (or (org-element-at-point)
(user-error "No element at point"))))
- (when (= (point-max) (org-element-property :end elem))
+ (when (= (point-max) (org-element-end elem))
(user-error "Cannot drag element forward"))
- (goto-char (org-element-property :end elem))
+ (goto-char (org-element-end elem))
(let ((next-elem (org-element-at-point)))
(when (or (org-element-nested-p elem next-elem)
(and (org-element-type-p next-elem 'headline)
@@ -21415,16 +21421,16 @@ Move to the previous element at the same level, when
possible."
;; body's length (without final blanks) and by the length of
;; blanks between ELEM and NEXT-ELEM.
(let ((size-next (- (save-excursion
- (goto-char (org-element-property :end next-elem))
+ (goto-char (org-element-end next-elem))
(skip-chars-backward " \r\t\n")
(forward-line)
;; Small correction if buffer doesn't end
;; with a newline character.
(if (and (eolp) (not (bolp))) (1+ (point)) (point)))
- (org-element-property :begin next-elem)))
- (size-blank (- (org-element-property :end elem)
+ (org-element-begin next-elem)))
+ (size-blank (- (org-element-end elem)
(save-excursion
- (goto-char (org-element-property :end elem))
+ (goto-char (org-element-end elem))
(skip-chars-backward " \r\t\n")
(forward-line)
(point)))))
@@ -21464,12 +21470,12 @@ ones already marked."
(set-mark
(save-excursion
(goto-char (mark))
- (goto-char (org-element-property :end (org-element-at-point)))
+ (goto-char (org-element-end (org-element-at-point)))
(point)))
(let ((element (org-element-at-point)))
(end-of-line)
- (push-mark (min (point-max) (org-element-property :end element)) t t)
- (goto-char (org-element-property :begin element))))))
+ (push-mark (min (point-max) (org-element-end element)) t t)
+ (goto-char (org-element-begin element))))))
(defun org-narrow-to-element ()
"Narrow buffer to current element.
@@ -21479,23 +21485,23 @@ Use the command `\\[widen]' to see the whole buffer
again."
(cond
((eq (car elem) 'headline)
(narrow-to-region
- (org-element-property :begin elem)
- (org-element-property :end elem)))
+ (org-element-begin elem)
+ (org-element-end elem)))
((memq (car elem) org-element-greater-elements)
(narrow-to-region
- (org-element-property :contents-begin elem)
- (org-element-property :contents-end elem)))
+ (org-element-contents-begin elem)
+ (org-element-contents-end elem)))
(t
(narrow-to-region
- (org-element-property :begin elem)
- (org-element-property :end elem))))))
+ (org-element-begin elem)
+ (org-element-end elem))))))
(defun org-transpose-element ()
"Transpose current and previous elements, keeping blank lines between.
Point is moved after both elements."
(interactive)
(org-skip-whitespace)
- (let ((end (org-element-property :end (org-element-at-point))))
+ (let ((end (org-element-end (org-element-at-point))))
(org-drag-element-backward)
(goto-char end)))
@@ -21515,8 +21521,8 @@ modified."
(save-excursion
(save-restriction
(narrow-to-region
- (org-element-property :begin element)
- (org-element-property :end element))
+ (org-element-begin element)
+ (org-element-end element))
(org-do-remove-indentation))))))))
(funcall unindent-tree (org-element-contents parse-tree))))
diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el
index e7d44f84a3..e323dcafa0 100644
--- a/lisp/ox-ascii.el
+++ b/lisp/ox-ascii.el
@@ -1482,7 +1482,7 @@ contextual information."
(org-element-property :bullet item)))
(num (number-to-string
(car (last (org-list-get-item-number
- (org-element-property :begin item)
+ (org-element-begin item)
struct
(org-list-prevs-alist struct)
(org-list-parents-alist struct)))))))
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index 450856cd61..a83fe26474 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -745,7 +745,7 @@ INFO is a plist used as a communication channel."
(org-not-nil
(org-export-read-attribute :attr_texinfo plain-list
:compact)))
(not (org-element-contents item))
- (eq 1 (org-element-property :post-blank item)))
+ (eq 1 (org-element-post-blank item)))
(org-element-put-property next-item :findex findex)
(org-element-put-property next-item :kindex kindex)
(org-element-put-property item :findex nil)
@@ -1186,12 +1186,12 @@ contextual information."
(when (and compact
(org-export-get-next-element item info)
(not (org-element-contents item))
- (eq 1 (org-element-property :post-blank item)))
+ (eq 1 (org-element-post-blank item)))
(org-element-put-property item :post-blank 0))
(if (and compact
(setq previous-item (org-export-get-previous-element item info))
(not (org-element-contents previous-item))
- (eq 0 (org-element-property :post-blank previous-item)))
+ (eq 0 (org-element-post-blank previous-item)))
(format "@itemx%s\n%s"
(if tag (concat " " (org-export-data tag info)) "")
(or contents ""))
@@ -1769,8 +1769,8 @@ a communication channel."
;; approximation of the length of the cell in the
;; output. It can sometimes fail (e.g. it considers
;; "/a/" being larger than "ab").
- (let ((w (- (org-element-property :contents-end cell)
- (org-element-property :contents-begin cell))))
+ (let ((w (- (org-element-contents-end cell)
+ (org-element-contents-begin cell))))
(aset widths idx (max w (aref widths idx))))
(cl-incf idx))
info)))
diff --git a/lisp/ox.el b/lisp/ox.el
index a807631e56..1982f4e363 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -1785,8 +1785,8 @@ not exported."
;; local structure of the document upon interpreting it back into
;; Org syntax.
(let* ((previous (org-export-get-previous-element datum options))
- (before (or (org-element-property :post-blank previous) 0))
- (after (or (org-element-property :post-blank datum) 0)))
+ (before (or (org-element-post-blank previous) 0))
+ (after (or (org-element-post-blank datum) 0)))
(when previous
(org-element-put-property previous :post-blank (max before after 1))))
t)
@@ -1998,7 +1998,7 @@ Return a string."
(t
(org-export-filter-apply-functions
(plist-get info (intern (format ":filter-%s" type)))
- (let ((blank (or (org-element-property :post-blank data) 0)))
+ (let ((blank (or (org-element-post-blank data) 0)))
(if (eq (org-element-class data parent) 'object)
(concat results (make-string blank ?\s))
(concat (org-element-normalize-string results)
@@ -2747,8 +2747,8 @@ Narrowing, if any, is ignored."
(while (re-search-forward regexp nil t)
(let ((element (org-element-at-point)))
(when (org-element-property :commentedp element)
- (delete-region (org-element-property :begin element)
- (org-element-property :end element))))))))
+ (delete-region (org-element-begin element)
+ (org-element-end element))))))))
(defun org-export--prune-tree (data info)
"Prune non exportable elements from DATA.
@@ -2772,7 +2772,7 @@ from tree."
(let ((type (org-element-type data)))
(if (org-export--skip-p data info selected excluded)
(if (memq type '(table-cell table-row)) (push data ignore)
- (let ((post-blank (org-element-property :post-blank
data)))
+ (let ((post-blank (org-element-post-blank data)))
(if (or (not post-blank) (zerop post-blank)
(eq 'element (org-element-class data)))
(org-element-extract data)
@@ -2786,7 +2786,7 @@ from tree."
(`plain-text
(string-match-p
(rx whitespace eos) previous))
- (_ (org-element-property :post-blank
previous))))
+ (_ (org-element-post-blank previous))))
;; Previous object ends with whitespace
already.
(org-element-extract data)
(org-element-set data (make-string post-blank
?\s)))))))
@@ -2883,8 +2883,8 @@ a list of footnote definitions or in the widened buffer."
;; Parse definition with contents.
(save-restriction
(narrow-to-region
- (org-element-property :begin datum)
- (org-element-property :end datum))
+ (org-element-begin datum)
+ (org-element-end datum))
(org-element-map (org-element-parse-buffer nil nil
'defer)
'footnote-definition #'identity nil t))))))
(_ nil)))
@@ -2984,7 +2984,7 @@ returned by the function."
(lambda (datum)
(let* ((type (org-element-type datum))
(post-blank
- (pcase (org-element-property :post-blank datum)
+ (pcase (org-element-post-blank datum)
(`nil nil)
(n (make-string n (if (eq type 'latex-environment) ?\n ?\s)))))
(new
@@ -3585,9 +3585,9 @@ Return a string of lines to be included in the format
expected by
(error "%s for %s::%s" (error-message-string err) file location)))
(let* ((element (org-element-at-point))
(contents-begin
- (and only-contents (org-element-property :contents-begin element))))
+ (and only-contents (org-element-contents-begin element))))
(narrow-to-region
- (or contents-begin (org-element-property :begin element))
+ (or contents-begin (org-element-begin element))
(org-element-property (if contents-begin :contents-end :end) element))
(when (and only-contents
(org-element-type-p element '(headline inlinetask)))
@@ -3637,18 +3637,18 @@ Move point after the link."
(if (or (not (string= "file" (org-element-property :type link)))
(file-remote-p path)
(file-name-absolute-p path))
- (goto-char (org-element-property :end link))
+ (goto-char (org-element-end link))
(let ((new-path (file-relative-name (expand-file-name path file-dir)
includer-dir))
(new-link (org-element-copy link)))
(org-element-put-property new-link :path new-path)
- (when (org-element-property :contents-begin link)
+ (when (org-element-contents-begin link)
(org-element-adopt new-link
(buffer-substring
- (org-element-property :contents-begin link)
- (org-element-property :contents-end link))))
- (delete-region (org-element-property :begin link)
- (org-element-property :end link))
+ (org-element-contents-begin link)
+ (org-element-contents-end link))))
+ (delete-region (org-element-begin link)
+ (org-element-end link))
(insert (org-element-interpret-data new-link))))))
(defun org-export--prepare-file-contents
@@ -3714,11 +3714,11 @@ is to happen."
;; `org-export-insert-image-links' may activate
;; them.
(let ((contents-begin
- (org-element-property :contents-begin link))
- (begin (org-element-property :begin link)))
+ (org-element-contents-begin link))
+ (begin (org-element-begin link)))
(when contents-begin
(save-excursion
- (goto-char (org-element-property :contents-end link))
+ (goto-char (org-element-contents-end link))
(while (re-search-backward regexp contents-begin t)
(save-match-data
(org-export--update-included-link
@@ -3789,7 +3789,7 @@ is to happen."
(lambda (f old new)
;; Replace OLD label with NEW in footnote F.
(save-excursion
- (goto-char (+ (org-element-property :begin f) 4))
+ (goto-char (+ (org-element-begin f) 4))
(looking-at (regexp-quote old))
(replace-match new))))
(seen-alist))
@@ -4874,7 +4874,7 @@ objects of the same type."
;; Special case 2: An item returns its number as a list.
(item (let ((struct (org-element-property :structure element)))
(org-list-get-item-number
- (org-element-property :begin element)
+ (org-element-begin element)
struct
(org-list-prevs-alist struct)
(org-list-parents-alist struct))))
@@ -5960,7 +5960,7 @@ INFO is the current export state, as a plist."
text info)))
(cond ((not p) nil)
((stringp p) (substring p -1))
- ((memq (org-element-property :post-blank p)
+ ((memq (org-element-post-blank p)
'(0 nil))
'no-blank)
(t 'blank)))))
diff --git a/testing/examples/babel.org b/testing/examples/babel.org
index 613c3c77f1..d46afeb5e9 100644
--- a/testing/examples/babel.org
+++ b/testing/examples/babel.org
@@ -489,5 +489,4 @@ The =[[= causes a false positive which ~org-babel-detangle~
should handle proper
:ID: 73115FB0-6565-442B-BB95-50195A499EF4
:END:
#+begin_src emacs-lisp :tangle yes :comments link
- ;; detangle
#+end_src
- [elpa] externals/org 6a7aee2c35 034/101: org-texinfo--normalize-headlines: Use `org-element-create', (continued)
- [elpa] externals/org 6a7aee2c35 034/101: org-texinfo--normalize-headlines: Use `org-element-create', ELPA Syncer, 2023/07/01
- [elpa] externals/org 3b1693c461 043/101: org-back-to-heading: Use org-element API, ELPA Syncer, 2023/07/01
- [elpa] externals/org eb0a293a02 048/101: Remove 'org-category text property cache, ELPA Syncer, 2023/07/01
- [elpa] externals/org e3d690edf8 054/101: org-element-cache-map: Allow when cache is disabled, ELPA Syncer, 2023/07/01
- [elpa] externals/org ebbdd67a2a 059/101: Remove effort property cache, ELPA Syncer, 2023/07/01
- [elpa] externals/org c22697f472 023/101: Use new function names `org-element-extract' and `org-element-set', ELPA Syncer, 2023/07/01
- [elpa] externals/org a06dc07cc0 028/101: org-element: Defer more when parsing headings and inlinetasks, ELPA Syncer, 2023/07/01
- [elpa] externals/org ea4f4fdf58 035/101: Rename `org-export-get-parent' to `org-element-parent', ELPA Syncer, 2023/07/01
- [elpa] externals/org a2730b47fa 032/101: org-odt--paragraph-style: Use `org-element-lineage', ELPA Syncer, 2023/07/01
- [elpa] externals/org a43cc8c9aa 033/101: org-export-get-node-property: Use `org-element-property-inherited', ELPA Syncer, 2023/07/01
- [elpa] externals/org bc29f5de41 038/101: org-element: New `org-element-*property*' functions,
ELPA Syncer <=
- [elpa] externals/org 7cbc441915 044/101: org-entry-get-with-inheritance: Use org-element API, ELPA Syncer, 2023/07/01
- [elpa] externals/org 31d53cb015 056/101: org-end-of-subtree: Use org-element API, ELPA Syncer, 2023/07/01
- [elpa] externals/org 7dee228569 063/101: org-element-at-point-no-context: Update docstring, ELPA Syncer, 2023/07/01
- [elpa] externals/org e1a2ea65ef 064/101: Allow syntax nodes to be supplied in place of POM in API functions, ELPA Syncer, 2023/07/01
- [elpa] externals/org 16d7cdcf52 068/101: org-manual: Remove unused drawer properties to disable, ELPA Syncer, 2023/07/01
- [elpa] externals/org 96b754c105 083/101: org-get-category, org-get-tags: Clarify that match data is modified, ELPA Syncer, 2023/07/01
- [elpa] externals/org fcde1f779d 090/101: test-org-element/at-point: Add new test, ELPA Syncer, 2023/07/01
- [elpa] externals/org 383d5dacb7 096/101: org-fold-show-set-visibility: Fix lineage visibility, ELPA Syncer, 2023/07/01
- [elpa] externals/org 4a8849340d 005/101: org-element-ast: New functions to map and resolve property values, ELPA Syncer, 2023/07/01
- [elpa] externals/org ea9d5b45db 012/101: org-element-create: Allow single &rest argument as a list, ELPA Syncer, 2023/07/01