Преглед изворни кода

org-element: Rename a few internal functions

* contrib/lisp/org-element.el (org-element--parse-elements): Renamed
  from `org-element-parse-elements'.
(org-element--parse-objects): Renamed from `org-element-parse-objects'.
(org-element--get-next-object-candidates): Renamed from
`org-element-get-next-object-candidates'.
(org-element--interpret-affiliated-keywords): Renamed from
`org-element-interpret--affiliated-keywords'.
(org-element--current-element): Renamed from
`org-element-current-element'.
(org-element--collect-affiliated-keywords): Renamed from
`org-element-collect-affiliated-keywords'.
(org-element-center-block-parser, org-element-drawer-parser,
org-element-dynamic-block-parser,
org-element-footnote-definition-parser, org-element-inlinetask-parser,
org-element-plain-list-parser, org-element-quote-block-parser,
org-element-special-block-parser, org-element-comment-parser,
org-element-comment-block-parser, org-element-example-block-parser,
org-element-export-block-parser, org-element-fixed-width-parser,
org-element-horizontal-rule-parser,
org-element-latex-environment-parser, org-element-paragraph-parser,
org-element-src-block-parser, org-element-table-parser,
org-element-verse-block-parser, org-element-fill-paragraph,
org-element-context, org-element-at-point, org-element-interpret-data,
org-element-parse-secondary-string, org-element-parse-buffer): Apply
name change.
* contrib/lisp/org-export.el (org-export-get-buffer-attributes): Apply
  name change.
* testing/lisp/test-org-element.el: Update tests accordingly.
* testing/lisp/test-org-export.el: Update tests accordingly.
Nicolas Goaziou пре 13 година
родитељ
комит
070e03011d
4 измењених фајлова са 78 додато и 86 уклоњено
  1. 49 48
      contrib/lisp/org-element.el
  2. 1 1
      contrib/lisp/org-export.el
  3. 20 22
      testing/lisp/test-org-element.el
  4. 8 15
      testing/lisp/test-org-export.el

+ 49 - 48
contrib/lisp/org-element.el

@@ -122,6 +122,7 @@
 ;;
 ;;
 ;; These variables really act as a control center for the parsing
 ;; These variables really act as a control center for the parsing
 ;; process.
 ;; process.
+
 (defconst org-element-paragraph-separate
 (defconst org-element-paragraph-separate
   (concat "\f" "\\|" "^[ \t]*$" "\\|"
   (concat "\f" "\\|" "^[ \t]*$" "\\|"
 	  ;; Headlines and inlinetasks.
 	  ;; Headlines and inlinetasks.
@@ -450,7 +451,7 @@ Return parent element."
 ;; cannot contain other greater elements of their own type.
 ;; cannot contain other greater elements of their own type.
 ;;
 ;;
 ;; Beside implementing a parser and an interpreter, adding a new
 ;; Beside implementing a parser and an interpreter, adding a new
-;; greater element requires to tweak `org-element-current-element'.
+;; greater element requires to tweak `org-element--current-element'.
 ;; Moreover, the newly defined type must be added to both
 ;; Moreover, the newly defined type must be added to both
 ;; `org-element-all-elements' and `org-element-greater-elements'.
 ;; `org-element-all-elements' and `org-element-greater-elements'.
 
 
@@ -474,7 +475,7 @@ Assume point is at the beginning of the block."
 	(org-element-comment-parser limit)
 	(org-element-comment-parser limit)
       (let ((contents-end (match-beginning 0)))
       (let ((contents-end (match-beginning 0)))
 	(save-excursion
 	(save-excursion
-	  (let* ((keywords (org-element-collect-affiliated-keywords))
+	  (let* ((keywords (org-element--collect-affiliated-keywords))
 		 (begin (car keywords))
 		 (begin (car keywords))
 		 (contents-begin (progn (forward-line) (point)))
 		 (contents-begin (progn (forward-line) (point)))
 		 (hidden (org-invisible-p2))
 		 (hidden (org-invisible-p2))
@@ -515,7 +516,7 @@ Assume point is at beginning of drawer."
     (let* ((case-fold-search t)
     (let* ((case-fold-search t)
 	   (name (progn (looking-at org-drawer-regexp)
 	   (name (progn (looking-at org-drawer-regexp)
 			(org-match-string-no-properties 1)))
 			(org-match-string-no-properties 1)))
-	   (keywords (org-element-collect-affiliated-keywords))
+	   (keywords (org-element--collect-affiliated-keywords))
 	   (begin (car keywords))
 	   (begin (car keywords))
 	   (contents-begin (progn (forward-line) (point)))
 	   (contents-begin (progn (forward-line) (point)))
 	   (hidden (org-invisible-p2))
 	   (hidden (org-invisible-p2))
@@ -565,7 +566,7 @@ Assume point is at beginning of dynamic block."
 	  (let* ((name (progn (looking-at org-dblock-start-re)
 	  (let* ((name (progn (looking-at org-dblock-start-re)
 			      (org-match-string-no-properties 1)))
 			      (org-match-string-no-properties 1)))
 		 (arguments (org-match-string-no-properties 3))
 		 (arguments (org-match-string-no-properties 3))
-		 (keywords (org-element-collect-affiliated-keywords))
+		 (keywords (org-element--collect-affiliated-keywords))
 		 (begin (car keywords))
 		 (begin (car keywords))
 		 (contents-begin (progn (forward-line) (point)))
 		 (contents-begin (progn (forward-line) (point)))
 		 (hidden (org-invisible-p2))
 		 (hidden (org-invisible-p2))
@@ -611,7 +612,7 @@ Assume point is at the beginning of the footnote definition."
   (save-excursion
   (save-excursion
     (looking-at org-footnote-definition-re)
     (looking-at org-footnote-definition-re)
     (let* ((label (org-match-string-no-properties 1))
     (let* ((label (org-match-string-no-properties 1))
-	   (keywords (org-element-collect-affiliated-keywords))
+	   (keywords (org-element--collect-affiliated-keywords))
 	   (begin (car keywords))
 	   (begin (car keywords))
 	   (contents-begin (progn (search-forward "]")
 	   (contents-begin (progn (search-forward "]")
 				  (org-skip-whitespace)
 				  (org-skip-whitespace)
@@ -818,7 +819,7 @@ string instead.
 
 
 Assume point is at beginning of the inline task."
 Assume point is at beginning of the inline task."
   (save-excursion
   (save-excursion
-    (let* ((keywords (org-element-collect-affiliated-keywords))
+    (let* ((keywords (org-element--collect-affiliated-keywords))
 	   (begin (car keywords))
 	   (begin (car keywords))
 	   (components (org-heading-components))
 	   (components (org-heading-components))
 	   (todo (nth 2 components))
 	   (todo (nth 2 components))
@@ -1056,7 +1057,7 @@ Assume point is at the beginning of the list."
 	   (parents (org-list-parents-alist struct))
 	   (parents (org-list-parents-alist struct))
 	   (type (org-list-get-list-type (point) struct prevs))
 	   (type (org-list-get-list-type (point) struct prevs))
 	   (contents-begin (point))
 	   (contents-begin (point))
-	   (keywords (org-element-collect-affiliated-keywords))
+	   (keywords (org-element--collect-affiliated-keywords))
 	   (begin (car keywords))
 	   (begin (car keywords))
 	   (contents-end
 	   (contents-end
 	    (goto-char (org-list-get-list-end (point) struct prevs)))
 	    (goto-char (org-list-get-list-end (point) struct prevs)))
@@ -1104,7 +1105,7 @@ Assume point is at the beginning of the block."
 	(org-element-comment-parser limit)
 	(org-element-comment-parser limit)
       (let ((contents-end (match-beginning 0)))
       (let ((contents-end (match-beginning 0)))
 	(save-excursion
 	(save-excursion
-	  (let* ((keywords (org-element-collect-affiliated-keywords))
+	  (let* ((keywords (org-element--collect-affiliated-keywords))
 		 (begin (car keywords))
 		 (begin (car keywords))
 		 (contents-begin (progn (forward-line) (point)))
 		 (contents-begin (progn (forward-line) (point)))
 		 (hidden (org-invisible-p2))
 		 (hidden (org-invisible-p2))
@@ -1182,7 +1183,7 @@ Assume point is at the beginning of the block."
 	(org-element-comment-parser limit)
 	(org-element-comment-parser limit)
       (let ((contents-end (match-beginning 0)))
       (let ((contents-end (match-beginning 0)))
 	(save-excursion
 	(save-excursion
-	  (let* ((keywords (org-element-collect-affiliated-keywords))
+	  (let* ((keywords (org-element--collect-affiliated-keywords))
 		 (begin (car keywords))
 		 (begin (car keywords))
 		 (contents-begin (progn (forward-line) (point)))
 		 (contents-begin (progn (forward-line) (point)))
 		 (hidden (org-invisible-p2))
 		 (hidden (org-invisible-p2))
@@ -1217,7 +1218,7 @@ CONTENTS is the contents of the element."
 ;;
 ;;
 ;; Also, as for greater elements, adding a new element type is done
 ;; Also, as for greater elements, adding a new element type is done
 ;; through the following steps: implement a parser and an interpreter,
 ;; through the following steps: implement a parser and an interpreter,
-;; tweak `org-element-current-element' so that it recognizes the new
+;; tweak `org-element--current-element' so that it recognizes the new
 ;; type and add that new type to `org-element-all-elements'.
 ;; type and add that new type to `org-element-all-elements'.
 ;;
 ;;
 ;; As a special case, when the newly defined type is a block type,
 ;; As a special case, when the newly defined type is a block type,
@@ -1321,7 +1322,7 @@ keywords.
 
 
 Assume point is at comment beginning."
 Assume point is at comment beginning."
   (save-excursion
   (save-excursion
-    (let* ((keywords (org-element-collect-affiliated-keywords))
+    (let* ((keywords (org-element--collect-affiliated-keywords))
 	   (begin (car keywords))
 	   (begin (car keywords))
 	   ;; Match first line with a loose regexp since it might as
 	   ;; Match first line with a loose regexp since it might as
 	   ;; well be an ill-defined keyword.
 	   ;; well be an ill-defined keyword.
@@ -1378,7 +1379,7 @@ Assume point is at comment block beginning."
 	(org-element-comment-parser limit)
 	(org-element-comment-parser limit)
       (let ((contents-end (match-beginning 0)))
       (let ((contents-end (match-beginning 0)))
 	(save-excursion
 	(save-excursion
-	  (let* ((keywords (org-element-collect-affiliated-keywords))
+	  (let* ((keywords (org-element--collect-affiliated-keywords))
 		 (begin (car keywords))
 		 (begin (car keywords))
 		 (contents-begin (progn (forward-line) (point)))
 		 (contents-begin (progn (forward-line) (point)))
 		 (hidden (org-invisible-p2))
 		 (hidden (org-invisible-p2))
@@ -1446,7 +1447,7 @@ containing `:begin', `:end', `:number-lines', `:preserve-indent',
 				 (string-match "-l +\"\\([^\"\n]+\\)\"" switches)
 				 (string-match "-l +\"\\([^\"\n]+\\)\"" switches)
 				 (match-string 1 switches)))
 				 (match-string 1 switches)))
 		 ;; Standard block parsing.
 		 ;; Standard block parsing.
-		 (keywords (org-element-collect-affiliated-keywords))
+		 (keywords (org-element--collect-affiliated-keywords))
 		 (begin (car keywords))
 		 (begin (car keywords))
 		 (contents-begin (progn (forward-line) (point)))
 		 (contents-begin (progn (forward-line) (point)))
 		 (hidden (org-invisible-p2))
 		 (hidden (org-invisible-p2))
@@ -1502,7 +1503,7 @@ Assume point is at export-block beginning."
 	(org-element-comment-parser limit)
 	(org-element-comment-parser limit)
       (let ((contents-end (match-beginning 0)))
       (let ((contents-end (match-beginning 0)))
 	(save-excursion
 	(save-excursion
-	  (let* ((keywords (org-element-collect-affiliated-keywords))
+	  (let* ((keywords (org-element--collect-affiliated-keywords))
 		 (begin (car keywords))
 		 (begin (car keywords))
 		 (contents-begin (progn (forward-line) (point)))
 		 (contents-begin (progn (forward-line) (point)))
 		 (hidden (org-invisible-p2))
 		 (hidden (org-invisible-p2))
@@ -1544,7 +1545,7 @@ containing `:begin', `:end', `:value' and `:post-blank' keywords.
 
 
 Assume point is at the beginning of the fixed-width area."
 Assume point is at the beginning of the fixed-width area."
   (save-excursion
   (save-excursion
-    (let* ((keywords (org-element-collect-affiliated-keywords))
+    (let* ((keywords (org-element--collect-affiliated-keywords))
 	   (begin (car keywords))
 	   (begin (car keywords))
 	   value
 	   value
 	   (end-area
 	   (end-area
@@ -1586,7 +1587,7 @@ LIMIT bounds the search.
 Return a list whose CAR is `horizontal-rule' and CDR is a plist
 Return a list whose CAR is `horizontal-rule' and CDR is a plist
 containing `:begin', `:end' and `:post-blank' keywords."
 containing `:begin', `:end' and `:post-blank' keywords."
   (save-excursion
   (save-excursion
-    (let* ((keywords (org-element-collect-affiliated-keywords))
+    (let* ((keywords (org-element--collect-affiliated-keywords))
 	   (begin (car keywords))
 	   (begin (car keywords))
 	   (post-hr (progn (forward-line) (point)))
 	   (post-hr (progn (forward-line) (point)))
 	   (end (progn (org-skip-whitespace)
 	   (end (progn (org-skip-whitespace)
@@ -1654,7 +1655,7 @@ Assume point is at the beginning of the latex environment."
   (save-excursion
   (save-excursion
     (let* ((case-fold-search t)
     (let* ((case-fold-search t)
 	   (code-begin (point))
 	   (code-begin (point))
-	   (keywords (org-element-collect-affiliated-keywords))
+	   (keywords (org-element--collect-affiliated-keywords))
 	   (begin (car keywords))
 	   (begin (car keywords))
 	   (env (progn (looking-at "^[ \t]*\\\\begin{\\([A-Za-z0-9*]+\\)}")
 	   (env (progn (looking-at "^[ \t]*\\\\begin{\\([A-Za-z0-9*]+\\)}")
 		       (regexp-quote (match-string 1))))
 		       (regexp-quote (match-string 1))))
@@ -1693,7 +1694,7 @@ containing `:begin', `:end', `:contents-begin' and
 Assume point is at the beginning of the paragraph."
 Assume point is at the beginning of the paragraph."
   (save-excursion
   (save-excursion
     (let* ((contents-begin (point))
     (let* ((contents-begin (point))
-	   (keywords (org-element-collect-affiliated-keywords))
+	   (keywords (org-element--collect-affiliated-keywords))
 	   (begin (car keywords))
 	   (begin (car keywords))
 	   (contents-end
 	   (contents-end
 	    (progn (end-of-line)
 	    (progn (end-of-line)
@@ -1879,7 +1880,7 @@ Assume point is at the beginning of the block."
 	(org-element-comment-parser limit)
 	(org-element-comment-parser limit)
       (let ((contents-end (match-beginning 0)))
       (let ((contents-end (match-beginning 0)))
 	(save-excursion
 	(save-excursion
-	  (let* ((keywords (org-element-collect-affiliated-keywords))
+	  (let* ((keywords (org-element--collect-affiliated-keywords))
 		 ;; Get beginning position.
 		 ;; Get beginning position.
 		 (begin (car keywords))
 		 (begin (car keywords))
 		 ;; Get language as a string.
 		 ;; Get language as a string.
@@ -1985,7 +1986,7 @@ Assume point is at the beginning of the table."
     (let* ((case-fold-search t)
     (let* ((case-fold-search t)
 	   (table-begin (point))
 	   (table-begin (point))
 	   (type (if (org-at-table.el-p) 'table.el 'org))
 	   (type (if (org-at-table.el-p) 'table.el 'org))
-	   (keywords (org-element-collect-affiliated-keywords))
+	   (keywords (org-element--collect-affiliated-keywords))
 	   (begin (car keywords))
 	   (begin (car keywords))
 	   (table-end (goto-char (marker-position (org-table-end t))))
 	   (table-end (goto-char (marker-position (org-table-end t))))
 	   (tblfm (let (acc)
 	   (tblfm (let (acc)
@@ -2084,7 +2085,7 @@ Assume point is at beginning of the block."
 	(org-element-comment-parser limit)
 	(org-element-comment-parser limit)
       (let ((contents-end (match-beginning 0)))
       (let ((contents-end (match-beginning 0)))
 	(save-excursion
 	(save-excursion
-	  (let* ((keywords (org-element-collect-affiliated-keywords))
+	  (let* ((keywords (org-element--collect-affiliated-keywords))
 		 (begin (car keywords))
 		 (begin (car keywords))
 		 (hidden (progn (forward-line) (org-invisible-p2)))
 		 (hidden (progn (forward-line) (org-invisible-p2)))
 		 (contents-begin (point))
 		 (contents-begin (point))
@@ -3188,17 +3189,17 @@ CONTENTS is nil."
 
 
 ;;; Parsing Element Starting At Point
 ;;; Parsing Element Starting At Point
 ;;
 ;;
-;; `org-element-current-element' is the core function of this section.
+;; `org-element--current-element' is the core function of this section.
 ;; It returns the Lisp representation of the element starting at
 ;; It returns the Lisp representation of the element starting at
 ;; point.
 ;; point.
 ;;
 ;;
-;; `org-element-current-element' makes use of special modes.  They are
-;; activated for fixed element chaining (i.e. `plain-list' > `item')
-;; or fixed conditional element chaining (i.e. `headline' >
+;; `org-element--current-element' makes use of special modes.  They
+;; are activated for fixed element chaining (i.e. `plain-list' >
+;; `item') or fixed conditional element chaining (i.e. `headline' >
 ;; `section'). Special modes are: `first-section', `section',
 ;; `section'). Special modes are: `first-section', `section',
 ;; `quote-section', `item' and `table-row'.
 ;; `quote-section', `item' and `table-row'.
 
 
-(defun org-element-current-element
+(defun org-element--current-element
   (limit &optional granularity special structure)
   (limit &optional granularity special structure)
   "Parse the element starting at point.
   "Parse the element starting at point.
 
 
@@ -3356,7 +3357,7 @@ element it has to parse."
 ;;
 ;;
 ;; A keyword may belong to more than one category.
 ;; A keyword may belong to more than one category.
 
 
-(defun org-element-collect-affiliated-keywords
+(defun org-element--collect-affiliated-keywords
   (&optional key-re trans-list consed parsed duals)
   (&optional key-re trans-list consed parsed duals)
   "Collect affiliated keywords before point.
   "Collect affiliated keywords before point.
 
 
@@ -3469,7 +3470,7 @@ Assume buffer is in Org mode."
   (save-excursion
   (save-excursion
     (goto-char (point-min))
     (goto-char (point-min))
     (org-skip-whitespace)
     (org-skip-whitespace)
-    (org-element-parse-elements
+    (org-element--parse-elements
      (point-at-bol) (point-max)
      (point-at-bol) (point-max)
      ;; Start in `first-section' mode so text before the first
      ;; Start in `first-section' mode so text before the first
      ;; headline belongs to a section.
      ;; headline belongs to a section.
@@ -3486,7 +3487,7 @@ containing the secondary string.  It is used to set correctly
 `:parent' property within the string."
 `:parent' property within the string."
   (with-temp-buffer
   (with-temp-buffer
     (insert string)
     (insert string)
-    (let ((secondary (org-element-parse-objects
+    (let ((secondary (org-element--parse-objects
 		      (point-min) (point-max) nil restriction)))
 		      (point-min) (point-max) nil restriction)))
       (mapc (lambda (obj) (org-element-put-property obj :parent parent))
       (mapc (lambda (obj) (org-element-put-property obj :parent parent))
 	    secondary))))
 	    secondary))))
@@ -3591,13 +3592,13 @@ Nil values returned from FUN do not appear in the results."
 
 
 ;; The following functions are internal parts of the parser.
 ;; The following functions are internal parts of the parser.
 ;;
 ;;
-;; The first one, `org-element-parse-elements' acts at the element's
+;; The first one, `org-element--parse-elements' acts at the element's
 ;; level.
 ;; level.
 ;;
 ;;
-;; The second one, `org-element-parse-objects' applies on all objects
+;; The second one, `org-element--parse-objects' applies on all objects
 ;; of a paragraph or a secondary string.  It uses
 ;; of a paragraph or a secondary string.  It uses
-;; `org-element-get-candidates' to optimize the search of the next
-;; object in the buffer.
+;; `org-element--get-next-object-candidates' to optimize the search of
+;; the next object in the buffer.
 ;;
 ;;
 ;; More precisely, that function looks for every allowed object type
 ;; More precisely, that function looks for every allowed object type
 ;; first.  Then, it discards failed searches, keeps further matches,
 ;; first.  Then, it discards failed searches, keeps further matches,
@@ -3606,7 +3607,7 @@ Nil values returned from FUN do not appear in the results."
 ;; object is searched only once at top level (but sometimes more for
 ;; object is searched only once at top level (but sometimes more for
 ;; nested types).
 ;; nested types).
 
 
-(defun org-element-parse-elements
+(defun org-element--parse-elements
   (beg end special structure granularity visible-only acc)
   (beg end special structure granularity visible-only acc)
   "Parse elements between BEG and END positions.
   "Parse elements between BEG and END positions.
 
 
@@ -3633,7 +3634,7 @@ Elements are accumulated into ACC."
     (while (< (point) end)
     (while (< (point) end)
       ;; Find current element's type and parse it accordingly to
       ;; Find current element's type and parse it accordingly to
       ;; its category.
       ;; its category.
-      (let* ((element (org-element-current-element
+      (let* ((element (org-element--current-element
 		       end granularity special structure))
 		       end granularity special structure))
 	     (type (org-element-type element))
 	     (type (org-element-type element))
 	     (cbeg (org-element-property :contents-begin element)))
 	     (cbeg (org-element-property :contents-begin element)))
@@ -3653,7 +3654,7 @@ Elements are accumulated into ACC."
 		   (and (eq granularity 'greater-element)
 		   (and (eq granularity 'greater-element)
 			(eq type 'section))
 			(eq type 'section))
 		   (eq type 'headline)))
 		   (eq type 'headline)))
-	  (org-element-parse-elements
+	  (org-element--parse-elements
 	   cbeg (org-element-property :contents-end element)
 	   cbeg (org-element-property :contents-end element)
 	   ;; Possibly switch to a special mode.
 	   ;; Possibly switch to a special mode.
 	   (case type
 	   (case type
@@ -3667,14 +3668,14 @@ Elements are accumulated into ACC."
 	 ;; ELEMENT has contents.  Parse objects inside, if
 	 ;; ELEMENT has contents.  Parse objects inside, if
 	 ;; GRANULARITY allows it.
 	 ;; GRANULARITY allows it.
 	 ((memq granularity '(object nil))
 	 ((memq granularity '(object nil))
-	  (org-element-parse-objects
+	  (org-element--parse-objects
 	   cbeg (org-element-property :contents-end element) element
 	   cbeg (org-element-property :contents-end element) element
 	   (org-element-restriction type))))
 	   (org-element-restriction type))))
 	(org-element-adopt-element acc element t)))
 	(org-element-adopt-element acc element t)))
     ;; Return result.
     ;; Return result.
     acc))
     acc))
 
 
-(defun org-element-parse-objects (beg end acc restriction)
+(defun org-element--parse-objects (beg end acc restriction)
   "Parse objects between BEG and END and return recursive structure.
   "Parse objects between BEG and END and return recursive structure.
 
 
 Objects are accumulated in ACC.
 Objects are accumulated in ACC.
@@ -3685,7 +3686,7 @@ current object."
     (save-excursion
     (save-excursion
       (goto-char beg)
       (goto-char beg)
       (while (and (< (point) end)
       (while (and (< (point) end)
-		  (setq candidates (org-element-get-next-object-candidates
+		  (setq candidates (org-element--get-next-object-candidates
 				    end restriction candidates)))
 				    end restriction candidates)))
 	(let ((next-object
 	(let ((next-object
 	       (let ((pos (apply 'min (mapcar 'cdr candidates))))
 	       (let ((pos (apply 'min (mapcar 'cdr candidates))))
@@ -3713,7 +3714,7 @@ current object."
 		(narrow-to-region
 		(narrow-to-region
 		 cont-beg
 		 cont-beg
 		 (org-element-property :contents-end next-object))
 		 (org-element-property :contents-end next-object))
-		(org-element-parse-objects
+		(org-element--parse-objects
 		 (point-min) (point-max) next-object
 		 (point-min) (point-max) next-object
 		 (org-element-restriction next-object))))
 		 (org-element-restriction next-object))))
 	    (setq acc (org-element-adopt-element acc next-object t))
 	    (setq acc (org-element-adopt-element acc next-object t))
@@ -3729,7 +3730,7 @@ current object."
       ;; Result.
       ;; Result.
       acc)))
       acc)))
 
 
-(defun org-element-get-next-object-candidates (limit restriction objects)
+(defun org-element--get-next-object-candidates (limit restriction objects)
   "Return an alist of candidates for the next object.
   "Return an alist of candidates for the next object.
 
 
 LIMIT bounds the search, and RESTRICTION narrows candidates to
 LIMIT bounds the search, and RESTRICTION narrows candidates to
@@ -3773,7 +3774,7 @@ OBJECTS is the previous candidates alist."
 ;; Hence `org-element-interpret-data'.
 ;; Hence `org-element-interpret-data'.
 ;;
 ;;
 ;; The function relies internally on
 ;; The function relies internally on
-;; `org-element-interpret--affiliated-keywords'.
+;; `org-element--interpret-affiliated-keywords'.
 
 
 (defun org-element-interpret-data (data &optional parent)
 (defun org-element-interpret-data (data &optional parent)
   "Interpret DATA as Org syntax.
   "Interpret DATA as Org syntax.
@@ -3837,11 +3838,11 @@ Return Org syntax as a string."
 	(if (memq type org-element-all-objects)
 	(if (memq type org-element-all-objects)
 	    (concat results (make-string post-blank 32))
 	    (concat results (make-string post-blank 32))
 	  (concat
 	  (concat
-	   (org-element-interpret--affiliated-keywords data)
+	   (org-element--interpret-affiliated-keywords data)
 	   (org-element-normalize-string results)
 	   (org-element-normalize-string results)
 	   (make-string post-blank 10)))))))
 	   (make-string post-blank 10)))))))
 
 
-(defun org-element-interpret--affiliated-keywords (element)
+(defun org-element--interpret-affiliated-keywords (element)
   "Return ELEMENT's affiliated keywords as Org syntax.
   "Return ELEMENT's affiliated keywords as Org syntax.
 If there is no affiliated keyword, return the empty string."
 If there is no affiliated keyword, return the empty string."
   (let ((keyword-to-org
   (let ((keyword-to-org
@@ -3992,7 +3993,7 @@ indentation is not done with TAB characters."
 ;; containing point.  This is the job of `org-element-at-point'.  It
 ;; containing point.  This is the job of `org-element-at-point'.  It
 ;; basically jumps back to the beginning of section containing point
 ;; basically jumps back to the beginning of section containing point
 ;; and moves, element after element, with
 ;; and moves, element after element, with
-;; `org-element-current-element' until the container is found.
+;; `org-element--current-element' until the container is found.
 ;;
 ;;
 ;; At a deeper level, `org-element-context' lists all elements and
 ;; At a deeper level, `org-element-context' lists all elements and
 ;; objects containing point.
 ;; objects containing point.
@@ -4044,7 +4045,7 @@ first element of current section."
        (catch 'exit
        (catch 'exit
          (while t
          (while t
            (setq element
            (setq element
-		 (org-element-current-element end 'element special-flag struct)
+		 (org-element--current-element end 'element special-flag struct)
                  type (car element))
                  type (car element))
 	   (push element trail)
 	   (push element trail)
            (cond
            (cond
@@ -4126,7 +4127,7 @@ and are ordered from closest to farthest."
 	 elements
 	 elements
        (let ((restriction (org-element-restriction element)) candidates)
        (let ((restriction (org-element-restriction element)) candidates)
 	 (catch 'exit
 	 (catch 'exit
-	   (while (setq candidates (org-element-get-next-object-candidates
+	   (while (setq candidates (org-element--get-next-object-candidates
 				    end restriction candidates))
 				    end restriction candidates))
 	     (let ((closest-cand (rassq (apply 'min (mapcar 'cdr candidates))
 	     (let ((closest-cand (rassq (apply 'min (mapcar 'cdr candidates))
 					candidates)))
 					candidates)))
@@ -4502,7 +4503,7 @@ width for filling."
                 (nreverse
                 (nreverse
                  (cons beg
                  (cons beg
                        (org-element-map
                        (org-element-map
-                        (org-element-parse-objects
+                        (org-element--parse-objects
                          beg end nil org-element-all-objects)
                          beg end nil org-element-all-objects)
                         'line-break
                         'line-break
                         (lambda (lb) (org-element-property :end lb)))))))) t)))
                         (lambda (lb) (org-element-property :end lb)))))))) t)))

+ 1 - 1
contrib/lisp/org-export.el

@@ -1342,7 +1342,7 @@ Assume buffer is in Org mode.  Narrowing, if any, is ignored."
 			    ;; Like `org-element-parse-buffer', but
 			    ;; Like `org-element-parse-buffer', but
 			    ;; makes sure the definition doesn't start
 			    ;; makes sure the definition doesn't start
 			    ;; with a section element.
 			    ;; with a section element.
-			    (org-element-parse-elements
+			    (org-element--parse-elements
 			     (point-min) (point-max) nil nil nil nil
 			     (point-min) (point-max) nil nil nil nil
 			     (list 'org-data nil))))
 			     (list 'org-data nil))))
 		    alist))))
 		    alist))))

+ 20 - 22
testing/lisp/test-org-element.el

@@ -438,97 +438,95 @@ CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] =>  0:01"
   (let ((org-coderef-label-format "(ref:%s)"))
   (let ((org-coderef-label-format "(ref:%s)"))
     ;; 1. Test "-i" switch.
     ;; 1. Test "-i" switch.
     (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n(+ 1 1)\n#+END_SRC"
     (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n(+ 1 1)\n#+END_SRC"
-      (let ((element (org-element-current-element (point-max))))
-	(should-not (org-element-property :preserve-indent element))))
+      (should-not
+       (org-element-property :preserve-indent (org-element-at-point))))
     (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp -i\n(+ 1 1)\n#+END_SRC"
     (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp -i\n(+ 1 1)\n#+END_SRC"
-      (let ((element (org-element-current-element (point-max))))
-	(should (org-element-property :preserve-indent element))))
+      (should (org-element-property :preserve-indent (org-element-at-point))))
     (org-test-with-temp-text "#+BEGIN_EXAMPLE\nText.\n#+END_EXAMPLE"
     (org-test-with-temp-text "#+BEGIN_EXAMPLE\nText.\n#+END_EXAMPLE"
-      (let ((element (org-element-current-element (point-max))))
-	(should-not (org-element-property :preserve-indent element))))
+      (should-not
+       (org-element-property :preserve-indent (org-element-at-point))))
     (org-test-with-temp-text "#+BEGIN_EXAMPLE -i\nText.\n#+END_EXAMPLE"
     (org-test-with-temp-text "#+BEGIN_EXAMPLE -i\nText.\n#+END_EXAMPLE"
-      (let ((element (org-element-current-element (point-max))))
-	(should (org-element-property :preserve-indent element))))
+      (should (org-element-property :preserve-indent (org-element-at-point))))
     ;; 2. "-n -r -k" combination should number lines, retain labels but
     ;; 2. "-n -r -k" combination should number lines, retain labels but
     ;;    not use them in coderefs.
     ;;    not use them in coderefs.
     (org-test-with-temp-text "#+BEGIN_EXAMPLE -n -r -k\nText.\n#+END_EXAMPLE"
     (org-test-with-temp-text "#+BEGIN_EXAMPLE -n -r -k\nText.\n#+END_EXAMPLE"
-      (let ((element (org-element-current-element (point-max))))
+      (let ((element (org-element-at-point)))
 	(should (and (org-element-property :number-lines element)
 	(should (and (org-element-property :number-lines element)
 		     (org-element-property :retain-labels element)
 		     (org-element-property :retain-labels element)
 		     (not (org-element-property :use-labels element))))))
 		     (not (org-element-property :use-labels element))))))
     (org-test-with-temp-text
     (org-test-with-temp-text
 	"#+BEGIN_SRC emacs-lisp -n -r -k\n(+ 1 1)\n#+END_SRC"
 	"#+BEGIN_SRC emacs-lisp -n -r -k\n(+ 1 1)\n#+END_SRC"
-      (let ((element (org-element-current-element (point-max))))
+      (let ((element (org-element-at-point)))
 	(should (and (org-element-property :number-lines element)
 	(should (and (org-element-property :number-lines element)
 		     (org-element-property :retain-labels element)
 		     (org-element-property :retain-labels element)
 		     (not (org-element-property :use-labels element))))))
 		     (not (org-element-property :use-labels element))))))
     ;; 3. "-n -r" combination should number-lines remove labels and not
     ;; 3. "-n -r" combination should number-lines remove labels and not
     ;;    use them in coderefs.
     ;;    use them in coderefs.
     (org-test-with-temp-text "#+BEGIN_EXAMPLE -n -r\nText.\n#+END_EXAMPLE"
     (org-test-with-temp-text "#+BEGIN_EXAMPLE -n -r\nText.\n#+END_EXAMPLE"
-      (let ((element (org-element-current-element (point-max))))
+      (let ((element (org-element-at-point)))
 	(should (and (org-element-property :number-lines element)
 	(should (and (org-element-property :number-lines element)
 		     (not (org-element-property :retain-labels element))
 		     (not (org-element-property :retain-labels element))
 		     (not (org-element-property :use-labels element))))))
 		     (not (org-element-property :use-labels element))))))
     (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp -n -r\n(+ 1 1)\n#+END_SRC"
     (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp -n -r\n(+ 1 1)\n#+END_SRC"
-      (let ((element (org-element-current-element (point-max))))
+      (let ((element (org-element-at-point)))
 	(should (and (org-element-property :number-lines element)
 	(should (and (org-element-property :number-lines element)
 		     (not (org-element-property :retain-labels element))
 		     (not (org-element-property :retain-labels element))
 		     (not (org-element-property :use-labels element))))))
 		     (not (org-element-property :use-labels element))))))
     ;; 4. "-n" or "+n" should number lines, retain labels and use them
     ;; 4. "-n" or "+n" should number lines, retain labels and use them
     ;;    in coderefs.
     ;;    in coderefs.
     (org-test-with-temp-text "#+BEGIN_EXAMPLE -n\nText.\n#+END_EXAMPLE"
     (org-test-with-temp-text "#+BEGIN_EXAMPLE -n\nText.\n#+END_EXAMPLE"
-      (let ((element (org-element-current-element (point-max))))
+      (let ((element (org-element-at-point)))
 	(should (and (org-element-property :number-lines element)
 	(should (and (org-element-property :number-lines element)
 		     (org-element-property :retain-labels element)
 		     (org-element-property :retain-labels element)
 		     (org-element-property :use-labels element)))))
 		     (org-element-property :use-labels element)))))
     (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp -n\n(+ 1 1)\n#+END_SRC"
     (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp -n\n(+ 1 1)\n#+END_SRC"
-      (let ((element (org-element-current-element (point-max))))
+      (let ((element (org-element-at-point)))
 	(should (and (org-element-property :number-lines element)
 	(should (and (org-element-property :number-lines element)
 		     (org-element-property :retain-labels element)
 		     (org-element-property :retain-labels element)
 		     (org-element-property :use-labels element)))))
 		     (org-element-property :use-labels element)))))
     (org-test-with-temp-text "#+BEGIN_EXAMPLE +n\nText.\n#+END_EXAMPLE"
     (org-test-with-temp-text "#+BEGIN_EXAMPLE +n\nText.\n#+END_EXAMPLE"
-      (let ((element (org-element-current-element (point-max))))
+      (let ((element (org-element-at-point)))
 	(should (and (org-element-property :number-lines element)
 	(should (and (org-element-property :number-lines element)
 		     (org-element-property :retain-labels element)
 		     (org-element-property :retain-labels element)
 		     (org-element-property :use-labels element)))))
 		     (org-element-property :use-labels element)))))
     (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp +n\n(+ 1 1)\n#+END_SRC"
     (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp +n\n(+ 1 1)\n#+END_SRC"
-      (let ((element (org-element-current-element (point-max))))
+      (let ((element (org-element-at-point)))
 	(should (and (org-element-property :number-lines element)
 	(should (and (org-element-property :number-lines element)
 		     (org-element-property :retain-labels element)
 		     (org-element-property :retain-labels element)
 		     (org-element-property :use-labels element)))))
 		     (org-element-property :use-labels element)))))
     ;; 5. No switch should not number lines, but retain labels and use
     ;; 5. No switch should not number lines, but retain labels and use
     ;;    them in coderefs.
     ;;    them in coderefs.
     (org-test-with-temp-text "#+BEGIN_EXAMPLE\nText.\n#+END_EXAMPLE"
     (org-test-with-temp-text "#+BEGIN_EXAMPLE\nText.\n#+END_EXAMPLE"
-      (let ((element (org-element-current-element (point-max))))
+      (let ((element (org-element-at-point)))
 	(should (and (not (org-element-property :number-lines element))
 	(should (and (not (org-element-property :number-lines element))
 		     (org-element-property :retain-labels element)
 		     (org-element-property :retain-labels element)
 		     (org-element-property :use-labels element)))))
 		     (org-element-property :use-labels element)))))
     (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n(+ 1 1)\n#+END_SRC"
     (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n(+ 1 1)\n#+END_SRC"
-      (let ((element (org-element-current-element (point-max))))
+      (let ((element (org-element-at-point)))
 	(should (and (not (org-element-property :number-lines element))
 	(should (and (not (org-element-property :number-lines element))
 		     (org-element-property :retain-labels element)
 		     (org-element-property :retain-labels element)
 		     (org-element-property :use-labels element)))))
 		     (org-element-property :use-labels element)))))
     ;; 6. "-r" switch only: do not number lines, remove labels, and
     ;; 6. "-r" switch only: do not number lines, remove labels, and
     ;;    don't use labels in coderefs.
     ;;    don't use labels in coderefs.
     (org-test-with-temp-text "#+BEGIN_EXAMPLE -r\nText.\n#+END_EXAMPLE"
     (org-test-with-temp-text "#+BEGIN_EXAMPLE -r\nText.\n#+END_EXAMPLE"
-      (let ((element (org-element-current-element (point-max))))
+      (let ((element (org-element-at-point)))
 	(should (and (not (org-element-property :number-lines element))
 	(should (and (not (org-element-property :number-lines element))
 		     (not (org-element-property :retain-labels element))
 		     (not (org-element-property :retain-labels element))
 		     (not (org-element-property :use-labels element))))))
 		     (not (org-element-property :use-labels element))))))
     (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp -r\n(+ 1 1)\n#+END_SRC"
     (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp -r\n(+ 1 1)\n#+END_SRC"
-      (let ((element (org-element-current-element (point-max))))
+      (let ((element (org-element-at-point)))
 	(should (and (not (org-element-property :number-lines element))
 	(should (and (not (org-element-property :number-lines element))
 		     (not (org-element-property :retain-labels element))
 		     (not (org-element-property :retain-labels element))
 		     (not (org-element-property :use-labels element))))))
 		     (not (org-element-property :use-labels element))))))
     ;; 7. Recognize coderefs with user-defined syntax.
     ;; 7. Recognize coderefs with user-defined syntax.
     (org-test-with-temp-text
     (org-test-with-temp-text
 	"#+BEGIN_EXAMPLE -l \"[ref:%s]\"\nText [ref:text]\n#+END_EXAMPLE"
 	"#+BEGIN_EXAMPLE -l \"[ref:%s]\"\nText [ref:text]\n#+END_EXAMPLE"
-      (let ((element (org-element-current-element (point-max))))
+      (let ((element (org-element-at-point)))
 	(should
 	(should
 	 (equal (org-element-property :label-fmt element) "[ref:%s]"))))
 	 (equal (org-element-property :label-fmt element) "[ref:%s]"))))
     (org-test-with-temp-text
     (org-test-with-temp-text
 	"#+BEGIN_SRC emacs-lisp -l \"[ref:%s]\"\n(+ 1 1) [ref:text]\n#+END_SRC"
 	"#+BEGIN_SRC emacs-lisp -l \"[ref:%s]\"\n(+ 1 1) [ref:text]\n#+END_SRC"
-      (let ((element (org-element-current-element (point-max))))
+      (let ((element (org-element-at-point)))
 	(should
 	(should
 	 (equal (org-element-property :label-fmt element) "[ref:%s]"))))))
 	 (equal (org-element-property :label-fmt element) "[ref:%s]"))))))
 
 

+ 8 - 15
testing/lisp/test-org-export.el

@@ -400,14 +400,13 @@ body\n")))
     (org-export-read-attribute
     (org-export-read-attribute
      :attr_html
      :attr_html
      (org-test-with-temp-text "#+ATTR_HTML: :a 1 :b 2\nParagraph"
      (org-test-with-temp-text "#+ATTR_HTML: :a 1 :b 2\nParagraph"
-       (org-element-current-element (point-max))))
+       (org-element-at-point)))
     '(:a 1 :b 2)))
     '(:a 1 :b 2)))
   ;; Return nil on empty attribute.
   ;; Return nil on empty attribute.
   (should-not
   (should-not
    (org-export-read-attribute
    (org-export-read-attribute
     :attr_html
     :attr_html
-    (org-test-with-temp-text "Paragraph"
-      (org-element-current-element (point-max))))))
+    (org-test-with-temp-text "Paragraph" (org-element-at-point)))))
 
 
 
 
 
 
@@ -997,20 +996,17 @@ Another text. (ref:text)
   (let ((org-coderef-label-format "(ref:%s)"))
   (let ((org-coderef-label-format "(ref:%s)"))
     ;; 1. Code without reference.
     ;; 1. Code without reference.
     (org-test-with-temp-text "#+BEGIN_EXAMPLE\n(+ 1 1)\n#+END_EXAMPLE"
     (org-test-with-temp-text "#+BEGIN_EXAMPLE\n(+ 1 1)\n#+END_EXAMPLE"
-      (should (equal (org-export-unravel-code
-		      (org-element-current-element (point-max)))
+      (should (equal (org-export-unravel-code (org-element-at-point))
 		     '("(+ 1 1)\n"))))
 		     '("(+ 1 1)\n"))))
     ;; 2. Code with reference.
     ;; 2. Code with reference.
     (org-test-with-temp-text
     (org-test-with-temp-text
 	"#+BEGIN_EXAMPLE\n(+ 1 1) (ref:test)\n#+END_EXAMPLE"
 	"#+BEGIN_EXAMPLE\n(+ 1 1) (ref:test)\n#+END_EXAMPLE"
-      (should (equal (org-export-unravel-code
-		      (org-element-current-element (point-max)))
+      (should (equal (org-export-unravel-code (org-element-at-point))
 		     '("(+ 1 1)\n" (1 . "test")))))
 		     '("(+ 1 1)\n" (1 . "test")))))
     ;; 3. Code with user-defined reference.
     ;; 3. Code with user-defined reference.
     (org-test-with-temp-text
     (org-test-with-temp-text
 	"#+BEGIN_EXAMPLE -l \"[ref:%s]\"\n(+ 1 1) [ref:test]\n#+END_EXAMPLE"
 	"#+BEGIN_EXAMPLE -l \"[ref:%s]\"\n(+ 1 1) [ref:test]\n#+END_EXAMPLE"
-      (should (equal (org-export-unravel-code
-		      (org-element-current-element (point-max)))
+      (should (equal (org-export-unravel-code (org-element-at-point))
 		     '("(+ 1 1)\n" (1 . "test")))))
 		     '("(+ 1 1)\n" (1 . "test")))))
     ;; 4. Code references keys are relative to the current block.
     ;; 4. Code references keys are relative to the current block.
     (org-test-with-temp-text "
     (org-test-with-temp-text "
@@ -1022,23 +1018,20 @@ Another text. (ref:text)
 \(+ 3 3) (ref:one)
 \(+ 3 3) (ref:one)
 #+END_EXAMPLE"
 #+END_EXAMPLE"
       (goto-line 5)
       (goto-line 5)
-      (should (equal (org-export-unravel-code
-		      (org-element-current-element (point-max)))
+      (should (equal (org-export-unravel-code (org-element-at-point))
 		     '("(+ 2 2)\n(+ 3 3)\n" (2 . "one")))))
 		     '("(+ 2 2)\n(+ 3 3)\n" (2 . "one")))))
     ;; 5. Free up comma-protected lines.
     ;; 5. Free up comma-protected lines.
     ;;
     ;;
     ;; 5.1. In an Org source block, every line is protected.
     ;; 5.1. In an Org source block, every line is protected.
     (org-test-with-temp-text
     (org-test-with-temp-text
 	"#+BEGIN_SRC org\n,* Test\n,# comment\n,Text\n#+END_SRC"
 	"#+BEGIN_SRC org\n,* Test\n,# comment\n,Text\n#+END_SRC"
-      (should (equal (org-export-unravel-code
-		      (org-element-current-element (point-max)))
+      (should (equal (org-export-unravel-code (org-element-at-point))
 		     '("* Test\n# comment\nText\n"))))
 		     '("* Test\n# comment\nText\n"))))
     ;; 5.2. In other blocks, only headlines, comments and keywords are
     ;; 5.2. In other blocks, only headlines, comments and keywords are
     ;;      protected.
     ;;      protected.
     (org-test-with-temp-text
     (org-test-with-temp-text
 	"#+BEGIN_EXAMPLE\n,* Headline\n, * Not headline\n,Keep\n#+END_EXAMPLE"
 	"#+BEGIN_EXAMPLE\n,* Headline\n, * Not headline\n,Keep\n#+END_EXAMPLE"
-      (should (equal (org-export-unravel-code
-		      (org-element-current-element (point-max)))
+      (should (equal (org-export-unravel-code (org-element-at-point))
 		     '("* Headline\n, * Not headline\n,Keep\n"))))))
 		     '("* Headline\n, * Not headline\n,Keep\n"))))))