Browse Source

org-element: Remove folding status in parsed data

* lisp/org-element.el (org-element-center-block-parser,
  org-element-drawer-parser, org-element-dynamic-block-parser,
  org-element-item-parser, org-element-quote-block-parser,
  org-element-comment-block-parser, org-element-export-block-parser,
  org-element-verse-block-parser, org-element-special-block-parser,
  org-element-example-block-parser, org-element-headline-parser,
  org-element-inlinetask-parser): Remove :hiddenp property.
* lisp/org.el (org-end-of-line, org-down-element): Use an equivalent
  of :hiddenp property.
* testing/lisp/test-org-element.el: Remove tests.

The property is removed because it is buggy (e.g., when there's a link
just after a block opening line) and not really useful.
Nicolas Goaziou 11 years ago
parent
commit
fe27ca9906
3 changed files with 44 additions and 154 deletions
  1. 34 67
      lisp/org-element.el
  2. 2 2
      lisp/org.el
  3. 8 85
      testing/lisp/test-org-element.el

+ 34 - 67
lisp/org-element.el

@@ -493,8 +493,8 @@ keyword and CDR is a plist of affiliated keywords along with
 their value.
 their value.
 
 
 Return a list whose CAR is `center-block' and CDR is a plist
 Return a list whose CAR is `center-block' and CDR is a plist
-containing `:begin', `:end', `:hiddenp', `:contents-begin',
-`:contents-end', `:post-blank' and `:post-affiliated' keywords.
+containing `:begin', `:end', `:contents-begin', `:contents-end',
+`:post-blank' and `:post-affiliated' keywords.
 
 
 Assume point is at the beginning of the block."
 Assume point is at the beginning of the block."
   (let ((case-fold-search t))
   (let ((case-fold-search t))
@@ -510,7 +510,6 @@ Assume point is at the beginning of the block."
 				      (and (< (point) block-end-line)
 				      (and (< (point) block-end-line)
 					   (point))))
 					   (point))))
 	       (contents-end (and contents-begin block-end-line))
 	       (contents-end (and contents-begin block-end-line))
-	       (hidden (org-invisible-p2))
 	       (pos-before-blank (progn (goto-char block-end-line)
 	       (pos-before-blank (progn (goto-char block-end-line)
 					(forward-line)
 					(forward-line)
 					(point)))
 					(point)))
@@ -521,7 +520,6 @@ Assume point is at the beginning of the block."
 		(nconc
 		(nconc
 		 (list :begin begin
 		 (list :begin begin
 		       :end end
 		       :end end
-		       :hiddenp hidden
 		       :contents-begin contents-begin
 		       :contents-begin contents-begin
 		       :contents-end contents-end
 		       :contents-end contents-end
 		       :post-blank (count-lines pos-before-blank end)
 		       :post-blank (count-lines pos-before-blank end)
@@ -545,7 +543,7 @@ keyword and CDR is a plist of affiliated keywords along with
 their value.
 their value.
 
 
 Return a list whose CAR is `drawer' and CDR is a plist containing
 Return a list whose CAR is `drawer' and CDR is a plist containing
-`:drawer-name', `:begin', `:end', `:hiddenp', `:contents-begin',
+`:drawer-name', `:begin', `:end', `:contents-begin',
 `:contents-end', `:post-blank' and `:post-affiliated' keywords.
 `:contents-end', `:post-blank' and `:post-affiliated' keywords.
 
 
 Assume point is at beginning of drawer."
 Assume point is at beginning of drawer."
@@ -564,7 +562,6 @@ Assume point is at beginning of drawer."
 				      (and (< (point) drawer-end-line)
 				      (and (< (point) drawer-end-line)
 					   (point))))
 					   (point))))
 	       (contents-end (and contents-begin drawer-end-line))
 	       (contents-end (and contents-begin drawer-end-line))
-	       (hidden (org-invisible-p2))
 	       (pos-before-blank (progn (goto-char drawer-end-line)
 	       (pos-before-blank (progn (goto-char drawer-end-line)
 					(forward-line)
 					(forward-line)
 					(point)))
 					(point)))
@@ -576,7 +573,6 @@ Assume point is at beginning of drawer."
 		 (list :begin begin
 		 (list :begin begin
 		       :end end
 		       :end end
 		       :drawer-name name
 		       :drawer-name name
-		       :hiddenp hidden
 		       :contents-begin contents-begin
 		       :contents-begin contents-begin
 		       :contents-end contents-end
 		       :contents-end contents-end
 		       :post-blank (count-lines pos-before-blank end)
 		       :post-blank (count-lines pos-before-blank end)
@@ -602,9 +598,9 @@ keyword and CDR is a plist of affiliated keywords along with
 their value.
 their value.
 
 
 Return a list whose CAR is `dynamic-block' and CDR is a plist
 Return a list whose CAR is `dynamic-block' and CDR is a plist
-containing `:block-name', `:begin', `:end', `:hiddenp',
-`:contents-begin', `:contents-end', `:arguments', `:post-blank'
-and `:post-affiliated' keywords.
+containing `:block-name', `:begin', `:end', `:contents-begin',
+`:contents-end', `:arguments', `:post-blank' and
+`:post-affiliated' keywords.
 
 
 Assume point is at beginning of dynamic block."
 Assume point is at beginning of dynamic block."
   (let ((case-fold-search t))
   (let ((case-fold-search t))
@@ -624,7 +620,6 @@ Assume point is at beginning of dynamic block."
 					(and (< (point) block-end-line)
 					(and (< (point) block-end-line)
 					     (point))))
 					     (point))))
 		 (contents-end (and contents-begin block-end-line))
 		 (contents-end (and contents-begin block-end-line))
-		 (hidden (org-invisible-p2))
 		 (pos-before-blank (progn (goto-char block-end-line)
 		 (pos-before-blank (progn (goto-char block-end-line)
 					  (forward-line)
 					  (forward-line)
 					  (point)))
 					  (point)))
@@ -637,7 +632,6 @@ Assume point is at beginning of dynamic block."
 			 :end end
 			 :end end
 			 :block-name name
 			 :block-name name
 			 :arguments arguments
 			 :arguments arguments
-			 :hiddenp hidden
 			 :contents-begin contents-begin
 			 :contents-begin contents-begin
 			 :contents-end contents-end
 			 :contents-end contents-end
 			 :post-blank (count-lines pos-before-blank end)
 			 :post-blank (count-lines pos-before-blank end)
@@ -720,11 +714,10 @@ CONTENTS is the contents of the footnote-definition."
 
 
 Return a list whose CAR is `headline' and CDR is a plist
 Return a list whose CAR is `headline' and CDR is a plist
 containing `:raw-value', `:title', `:alt-title', `:begin',
 containing `:raw-value', `:title', `:alt-title', `:begin',
-`:end', `:pre-blank', `:hiddenp', `:contents-begin' and
-`:contents-end', `:level', `:priority', `:tags',
-`:todo-keyword',`:todo-type', `:scheduled', `:deadline',
-`:closed', `:quotedp', `:archivedp', `:commentedp' and
-`:footnote-section-p' keywords.
+`:end', `:pre-blank', `:contents-begin' and `:contents-end',
+`:level', `:priority', `:tags', `:todo-keyword',`:todo-type',
+`:scheduled', `:deadline', `:closed', `:quotedp', `:archivedp',
+`:commentedp' and `:footnote-section-p' keywords.
 
 
 The plist also contains any property set in the property drawer,
 The plist also contains any property set in the property drawer,
 with its name in upper cases and colons added at the
 with its name in upper cases and colons added at the
@@ -791,7 +784,6 @@ Assume point is at beginning of the headline."
 	   (contents-begin (save-excursion
 	   (contents-begin (save-excursion
 			     (skip-chars-forward " \r\t\n" end)
 			     (skip-chars-forward " \r\t\n" end)
 			     (and (/= (point) end) (line-beginning-position))))
 			     (and (/= (point) end) (line-beginning-position))))
-	   (hidden (org-invisible-p2))
 	   (contents-end (and contents-begin
 	   (contents-end (and contents-begin
 			      (progn (goto-char end)
 			      (progn (goto-char end)
 				     (skip-chars-backward " \r\t\n")
 				     (skip-chars-backward " \r\t\n")
@@ -818,7 +810,6 @@ Assume point is at beginning of the headline."
 			  :pre-blank
 			  :pre-blank
 			  (if (not contents-begin) 0
 			  (if (not contents-begin) 0
 			    (count-lines pos-after-head contents-begin))
 			    (count-lines pos-after-head contents-begin))
-			  :hiddenp hidden
 			  :contents-begin contents-begin
 			  :contents-begin contents-begin
 			  :contents-end contents-end
 			  :contents-end contents-end
 			  :level level
 			  :level level
@@ -904,10 +895,10 @@ CONTENTS is the contents of the element."
   "Parse an inline task.
   "Parse an inline task.
 
 
 Return a list whose CAR is `inlinetask' and CDR is a plist
 Return a list whose CAR is `inlinetask' and CDR is a plist
-containing `:title', `:begin', `:end', `:hiddenp',
-`:contents-begin' and `:contents-end', `:level', `:priority',
-`:raw-value', `:tags', `:todo-keyword', `:todo-type',
-`:scheduled', `:deadline', `:closed' and `:post-blank' keywords.
+containing `:title', `:begin', `:end', `:contents-begin' and
+`:contents-end', `:level', `:priority', `:raw-value', `:tags',
+`:todo-keyword', `:todo-type', `:scheduled', `:deadline',
+`:closed' and `:post-blank' keywords.
 
 
 The plist also contains any property set in the property drawer,
 The plist also contains any property set in the property drawer,
 with its name in upper cases and colons added at the
 with its name in upper cases and colons added at the
@@ -965,7 +956,6 @@ Assume point is at beginning of the inline task."
 			    (match-beginning 0))))
 			    (match-beginning 0))))
 	   (contents-begin (progn (forward-line)
 	   (contents-begin (progn (forward-line)
 				  (and task-end (< (point) task-end) (point))))
 				  (and task-end (< (point) task-end) (point))))
-	   (hidden (and contents-begin (org-invisible-p2)))
 	   (contents-end (and contents-begin task-end))
 	   (contents-end (and contents-begin task-end))
 	   (before-blank (if (not task-end) (point)
 	   (before-blank (if (not task-end) (point)
 			   (goto-char task-end)
 			   (goto-char task-end)
@@ -980,7 +970,6 @@ Assume point is at beginning of the inline task."
 		   (list :raw-value raw-value
 		   (list :raw-value raw-value
 			 :begin begin
 			 :begin begin
 			 :end end
 			 :end end
-			 :hiddenp hidden
 			 :contents-begin contents-begin
 			 :contents-begin contents-begin
 			 :contents-end contents-end
 			 :contents-end contents-end
 			 :level (nth 1 components)
 			 :level (nth 1 components)
@@ -1047,8 +1036,8 @@ STRUCT is the structure of the plain list.
 
 
 Return a list whose CAR is `item' and CDR is a plist containing
 Return a list whose CAR is `item' and CDR is a plist containing
 `:bullet', `:begin', `:end', `:contents-begin', `:contents-end',
 `:bullet', `:begin', `:end', `:contents-begin', `:contents-end',
-`:checkbox', `:counter', `:tag', `:structure', `:hiddenp' and
-`:post-blank' keywords.
+`:checkbox', `:counter', `:tag', `:structure' and `:post-blank'
+keywords.
 
 
 When optional argument RAW-SECONDARY-P is non-nil, item's tag, if
 When optional argument RAW-SECONDARY-P is non-nil, item's tag, if
 any, will not be parsed as a secondary string, but as a plain
 any, will not be parsed as a secondary string, but as a plain
@@ -1088,8 +1077,6 @@ Assume point is at the beginning of the item."
 		   ;; If first line isn't empty, contents really start
 		   ;; If first line isn't empty, contents really start
 		   ;; at the text after item's meta-data.
 		   ;; at the text after item's meta-data.
 		   (if (= (point-at-bol) begin) (point) (point-at-bol))))
 		   (if (= (point-at-bol) begin) (point) (point-at-bol))))
-	   (hidden (progn (forward-line)
-			  (and (not (= (point) end)) (org-invisible-p2))))
 	   (contents-end (progn (goto-char end)
 	   (contents-end (progn (goto-char end)
 				(skip-chars-backward " \r\t\n")
 				(skip-chars-backward " \r\t\n")
 				(forward-line)
 				(forward-line)
@@ -1108,7 +1095,6 @@ Assume point is at the beginning of the item."
 			:contents-end (max contents-begin contents-end)
 			:contents-end (max contents-begin contents-end)
 			:checkbox checkbox
 			:checkbox checkbox
 			:counter counter
 			:counter counter
-			:hiddenp hidden
 			:structure struct
 			:structure struct
 			:post-blank (count-lines contents-end end)))))
 			:post-blank (count-lines contents-end end)))))
       (org-element-put-property
       (org-element-put-property
@@ -1300,8 +1286,8 @@ keyword and CDR is a plist of affiliated keywords along with
 their value.
 their value.
 
 
 Return a list whose CAR is `property-drawer' and CDR is a plist
 Return a list whose CAR is `property-drawer' and CDR is a plist
-containing `:begin', `:end', `:hiddenp', `:contents-begin',
-`:contents-end', `:post-blank' and `:post-affiliated' keywords.
+containing `:begin', `:end', `:contents-begin', `:contents-end',
+`:post-blank' and `:post-affiliated' keywords.
 
 
 Assume point is at the beginning of the property drawer."
 Assume point is at the beginning of the property drawer."
   (save-excursion
   (save-excursion
@@ -1318,7 +1304,6 @@ Assume point is at the beginning of the property drawer."
 					(and (< (point) drawer-end-line)
 					(and (< (point) drawer-end-line)
 					     (point))))
 					     (point))))
 		 (contents-end (and contents-begin drawer-end-line))
 		 (contents-end (and contents-begin drawer-end-line))
-		 (hidden (org-invisible-p2))
 		 (pos-before-blank (progn (goto-char drawer-end-line)
 		 (pos-before-blank (progn (goto-char drawer-end-line)
 					  (forward-line)
 					  (forward-line)
 					  (point)))
 					  (point)))
@@ -1329,7 +1314,6 @@ Assume point is at the beginning of the property drawer."
 		  (nconc
 		  (nconc
 		   (list :begin begin
 		   (list :begin begin
 			 :end end
 			 :end end
-			 :hiddenp hidden
 			 :contents-begin contents-begin
 			 :contents-begin contents-begin
 			 :contents-end contents-end
 			 :contents-end contents-end
 			 :post-blank (count-lines pos-before-blank end)
 			 :post-blank (count-lines pos-before-blank end)
@@ -1353,8 +1337,8 @@ keyword and CDR is a plist of affiliated keywords along with
 their value.
 their value.
 
 
 Return a list whose CAR is `quote-block' and CDR is a plist
 Return a list whose CAR is `quote-block' and CDR is a plist
-containing `:begin', `:end', `:hiddenp', `:contents-begin',
-`:contents-end', `:post-blank' and `:post-affiliated' keywords.
+containing `:begin', `:end', `:contents-begin', `:contents-end',
+`:post-blank' and `:post-affiliated' keywords.
 
 
 Assume point is at the beginning of the block."
 Assume point is at the beginning of the block."
   (let ((case-fold-search t))
   (let ((case-fold-search t))
@@ -1371,7 +1355,6 @@ Assume point is at the beginning of the block."
 					(and (< (point) block-end-line)
 					(and (< (point) block-end-line)
 					     (point))))
 					     (point))))
 		 (contents-end (and contents-begin block-end-line))
 		 (contents-end (and contents-begin block-end-line))
-		 (hidden (org-invisible-p2))
 		 (pos-before-blank (progn (goto-char block-end-line)
 		 (pos-before-blank (progn (goto-char block-end-line)
 					  (forward-line)
 					  (forward-line)
 					  (point)))
 					  (point)))
@@ -1382,7 +1365,6 @@ Assume point is at the beginning of the block."
 		  (nconc
 		  (nconc
 		   (list :begin begin
 		   (list :begin begin
 			 :end end
 			 :end end
-			 :hiddenp hidden
 			 :contents-begin contents-begin
 			 :contents-begin contents-begin
 			 :contents-end contents-end
 			 :contents-end contents-end
 			 :post-blank (count-lines pos-before-blank end)
 			 :post-blank (count-lines pos-before-blank end)
@@ -1438,9 +1420,8 @@ keyword and CDR is a plist of affiliated keywords along with
 their value.
 their value.
 
 
 Return a list whose CAR is `special-block' and CDR is a plist
 Return a list whose CAR is `special-block' and CDR is a plist
-containing `:type', `:begin', `:end', `:hiddenp',
-`:contents-begin', `:contents-end', `:post-blank' and
-`:post-affiliated' keywords.
+containing `:type', `:begin', `:end', `:contents-begin',
+`:contents-end', `:post-blank' and `:post-affiliated' keywords.
 
 
 Assume point is at the beginning of the block."
 Assume point is at the beginning of the block."
   (let* ((case-fold-search t)
   (let* ((case-fold-search t)
@@ -1461,7 +1442,6 @@ Assume point is at the beginning of the block."
 					(and (< (point) block-end-line)
 					(and (< (point) block-end-line)
 					     (point))))
 					     (point))))
 		 (contents-end (and contents-begin block-end-line))
 		 (contents-end (and contents-begin block-end-line))
-		 (hidden (org-invisible-p2))
 		 (pos-before-blank (progn (goto-char block-end-line)
 		 (pos-before-blank (progn (goto-char block-end-line)
 					  (forward-line)
 					  (forward-line)
 					  (point)))
 					  (point)))
@@ -1473,7 +1453,6 @@ Assume point is at the beginning of the block."
 		   (list :type type
 		   (list :type type
 			 :begin begin
 			 :begin begin
 			 :end end
 			 :end end
-			 :hiddenp hidden
 			 :contents-begin contents-begin
 			 :contents-begin contents-begin
 			 :contents-end contents-end
 			 :contents-end contents-end
 			 :post-blank (count-lines pos-before-blank end)
 			 :post-blank (count-lines pos-before-blank end)
@@ -1661,8 +1640,8 @@ keyword and CDR is a plist of affiliated keywords along with
 their value.
 their value.
 
 
 Return a list whose CAR is `comment-block' and CDR is a plist
 Return a list whose CAR is `comment-block' and CDR is a plist
-containing `:begin', `:end', `:hiddenp', `:value', `:post-blank'
-and `:post-affiliated' keywords.
+containing `:begin', `:end', `:value', `:post-blank' and
+`:post-affiliated' keywords.
 
 
 Assume point is at comment block beginning."
 Assume point is at comment block beginning."
   (let ((case-fold-search t))
   (let ((case-fold-search t))
@@ -1675,7 +1654,6 @@ Assume point is at comment block beginning."
 	  (let* ((begin (car affiliated))
 	  (let* ((begin (car affiliated))
 		 (post-affiliated (point))
 		 (post-affiliated (point))
 		 (contents-begin (progn (forward-line) (point)))
 		 (contents-begin (progn (forward-line) (point)))
-		 (hidden (org-invisible-p2))
 		 (pos-before-blank (progn (goto-char contents-end)
 		 (pos-before-blank (progn (goto-char contents-end)
 					  (forward-line)
 					  (forward-line)
 					  (point)))
 					  (point)))
@@ -1689,7 +1667,6 @@ Assume point is at comment block beginning."
 		   (list :begin begin
 		   (list :begin begin
 			 :end end
 			 :end end
 			 :value value
 			 :value value
-			 :hiddenp hidden
 			 :post-blank (count-lines pos-before-blank end)
 			 :post-blank (count-lines pos-before-blank end)
 			 :post-affiliated post-affiliated)
 			 :post-affiliated post-affiliated)
 		   (cdr affiliated)))))))))
 		   (cdr affiliated)))))))))
@@ -1779,9 +1756,8 @@ their value.
 
 
 Return a list whose CAR is `example-block' and CDR is a plist
 Return a list whose CAR is `example-block' and CDR is a plist
 containing `:begin', `:end', `:number-lines', `:preserve-indent',
 containing `:begin', `:end', `:number-lines', `:preserve-indent',
-`:retain-labels', `:use-labels', `:label-fmt', `:hiddenp',
-`:switches', `:value', `:post-blank' and `:post-affiliated'
-keywords."
+`:retain-labels', `:use-labels', `:label-fmt', `:switches',
+`:value', `:post-blank' and `:post-affiliated' keywords."
   (let ((case-fold-search t))
   (let ((case-fold-search t))
     (if (not (save-excursion
     (if (not (save-excursion
 	       (re-search-forward "^[ \t]*#\\+END_EXAMPLE[ \t]*$" limit t)))
 	       (re-search-forward "^[ \t]*#\\+END_EXAMPLE[ \t]*$" limit t)))
@@ -1822,7 +1798,6 @@ keywords."
 		 (post-affiliated (point))
 		 (post-affiliated (point))
 		 (block-ind (progn (skip-chars-forward " \t") (current-column)))
 		 (block-ind (progn (skip-chars-forward " \t") (current-column)))
 		 (contents-begin (progn (forward-line) (point)))
 		 (contents-begin (progn (forward-line) (point)))
-		 (hidden (org-invisible-p2))
 		 (value (org-element--remove-indentation
 		 (value (org-element--remove-indentation
 			 (org-unescape-code-in-string
 			 (org-unescape-code-in-string
 			  (buffer-substring-no-properties
 			  (buffer-substring-no-properties
@@ -1845,7 +1820,6 @@ keywords."
 			 :retain-labels retain-labels
 			 :retain-labels retain-labels
 			 :use-labels use-labels
 			 :use-labels use-labels
 			 :label-fmt label-fmt
 			 :label-fmt label-fmt
-			 :hiddenp hidden
 			 :post-blank (count-lines pos-before-blank end)
 			 :post-blank (count-lines pos-before-blank end)
 			 :post-affiliated post-affiliated)
 			 :post-affiliated post-affiliated)
 		   (cdr affiliated)))))))))
 		   (cdr affiliated)))))))))
@@ -1871,8 +1845,8 @@ keyword and CDR is a plist of affiliated keywords along with
 their value.
 their value.
 
 
 Return a list whose CAR is `export-block' and CDR is a plist
 Return a list whose CAR is `export-block' and CDR is a plist
-containing `:begin', `:end', `:type', `:hiddenp', `:value',
-`:post-blank' and `:post-affiliated' keywords.
+containing `:begin', `:end', `:type', `:value', `:post-blank' and
+`:post-affiliated' keywords.
 
 
 Assume point is at export-block beginning."
 Assume point is at export-block beginning."
   (let* ((case-fold-search t)
   (let* ((case-fold-search t)
@@ -1888,7 +1862,6 @@ Assume point is at export-block beginning."
 	  (let* ((begin (car affiliated))
 	  (let* ((begin (car affiliated))
 		 (post-affiliated (point))
 		 (post-affiliated (point))
 		 (contents-begin (progn (forward-line) (point)))
 		 (contents-begin (progn (forward-line) (point)))
-		 (hidden (org-invisible-p2))
 		 (pos-before-blank (progn (goto-char contents-end)
 		 (pos-before-blank (progn (goto-char contents-end)
 					  (forward-line)
 					  (forward-line)
 					  (point)))
 					  (point)))
@@ -1903,7 +1876,6 @@ Assume point is at export-block beginning."
 			 :end end
 			 :end end
 			 :type type
 			 :type type
 			 :value value
 			 :value value
-			 :hiddenp hidden
 			 :post-blank (count-lines pos-before-blank end)
 			 :post-blank (count-lines pos-before-blank end)
 			 :post-affiliated post-affiliated)
 			 :post-affiliated post-affiliated)
 		   (cdr affiliated)))))))))
 		   (cdr affiliated)))))))))
@@ -2326,9 +2298,9 @@ their value.
 
 
 Return a list whose CAR is `src-block' and CDR is a plist
 Return a list whose CAR is `src-block' and CDR is a plist
 containing `:language', `:switches', `:parameters', `:begin',
 containing `:language', `:switches', `:parameters', `:begin',
-`:end', `:hiddenp', `:number-lines', `:retain-labels',
-`:use-labels', `:label-fmt', `:preserve-indent', `:value',
-`:post-blank' and `:post-affiliated' keywords.
+`:end', `:number-lines', `:retain-labels', `:use-labels',
+`:label-fmt', `:preserve-indent', `:value', `:post-blank' and
+`:post-affiliated' keywords.
 
 
 Assume point is at the beginning of the block."
 Assume point is at the beginning of the block."
   (let ((case-fold-search t))
   (let ((case-fold-search t))
@@ -2379,13 +2351,11 @@ Assume point is at the beginning of the block."
 			   (not (string-match "-k\\>" switches)))))
 			   (not (string-match "-k\\>" switches)))))
 		 ;; Indentation.
 		 ;; Indentation.
 		 (block-ind (progn (skip-chars-forward " \t") (current-column)))
 		 (block-ind (progn (skip-chars-forward " \t") (current-column)))
-		 ;; Get visibility status.
-		 (hidden (progn (forward-line) (org-invisible-p2)))
 		 ;; Retrieve code.
 		 ;; Retrieve code.
 		 (value (org-element--remove-indentation
 		 (value (org-element--remove-indentation
 			 (org-unescape-code-in-string
 			 (org-unescape-code-in-string
 			  (buffer-substring-no-properties
 			  (buffer-substring-no-properties
-			   (point) contents-end))
+			   (progn (forward-line) (point)) contents-end))
 			 (and preserve-indent block-ind)))
 			 (and preserve-indent block-ind)))
 		 (pos-before-blank (progn (goto-char contents-end)
 		 (pos-before-blank (progn (goto-char contents-end)
 					  (forward-line)
 					  (forward-line)
@@ -2408,7 +2378,6 @@ Assume point is at the beginning of the block."
 			 :retain-labels retain-labels
 			 :retain-labels retain-labels
 			 :use-labels use-labels
 			 :use-labels use-labels
 			 :label-fmt label-fmt
 			 :label-fmt label-fmt
-			 :hiddenp hidden
 			 :value value
 			 :value value
 			 :post-blank (count-lines pos-before-blank end)
 			 :post-blank (count-lines pos-before-blank end)
 			 :post-affiliated post-affiliated)
 			 :post-affiliated post-affiliated)
@@ -2553,7 +2522,7 @@ their value.
 
 
 Return a list whose CAR is `verse-block' and CDR is a plist
 Return a list whose CAR is `verse-block' and CDR is a plist
 containing `:begin', `:end', `:contents-begin', `:contents-end',
 containing `:begin', `:end', `:contents-begin', `:contents-end',
-`:hiddenp', `:post-blank' and `:post-affiliated' keywords.
+`:post-blank' and `:post-affiliated' keywords.
 
 
 Assume point is at beginning of the block."
 Assume point is at beginning of the block."
   (let ((case-fold-search t))
   (let ((case-fold-search t))
@@ -2565,8 +2534,7 @@ Assume point is at beginning of the block."
 	(save-excursion
 	(save-excursion
 	  (let* ((begin (car affiliated))
 	  (let* ((begin (car affiliated))
 		 (post-affiliated (point))
 		 (post-affiliated (point))
-		 (hidden (progn (forward-line) (org-invisible-p2)))
-		 (contents-begin (point))
+		 (contents-begin (progn (forward-line) (point)))
 		 (pos-before-blank (progn (goto-char contents-end)
 		 (pos-before-blank (progn (goto-char contents-end)
 					  (forward-line)
 					  (forward-line)
 					  (point)))
 					  (point)))
@@ -2579,7 +2547,6 @@ Assume point is at beginning of the block."
 			 :end end
 			 :end end
 			 :contents-begin contents-begin
 			 :contents-begin contents-begin
 			 :contents-end contents-end
 			 :contents-end contents-end
-			 :hiddenp hidden
 			 :post-blank (count-lines pos-before-blank end)
 			 :post-blank (count-lines pos-before-blank end)
 			 :post-affiliated post-affiliated)
 			 :post-affiliated post-affiliated)
 		   (cdr affiliated)))))))))
 		   (cdr affiliated)))))))))

+ 2 - 2
lisp/org.el

@@ -22806,7 +22806,7 @@ the cursor is already beyond the end of the headline."
 		      (goto-char (match-end 0))
 		      (goto-char (match-end 0))
 		    (goto-char (match-beginning 1))))
 		    (goto-char (match-beginning 1))))
 	      (call-interactively move-fun))))
 	      (call-interactively move-fun))))
-	 ((org-element-property :hiddenp element)
+	 ((outline-invisible-p (line-end-position))
 	  ;; If element is hidden, `move-end-of-line' would put point
 	  ;; If element is hidden, `move-end-of-line' would put point
 	  ;; after it.  Use `end-of-line' to stay on current line.
 	  ;; after it.  Use `end-of-line' to stay on current line.
 	  (call-interactively 'end-of-line))
 	  (call-interactively 'end-of-line))
@@ -23507,7 +23507,7 @@ Move to the previous element at the same level, when possible."
       (forward-char))
       (forward-char))
      ((memq (org-element-type element) org-element-greater-elements)
      ((memq (org-element-type element) org-element-greater-elements)
       ;; If contents are hidden, first disclose them.
       ;; If contents are hidden, first disclose them.
-      (when (org-element-property :hiddenp element) (org-cycle))
+      (when (outline-invisible-p (line-end-position)) (org-cycle))
       (goto-char (or (org-element-property :contents-begin element)
       (goto-char (or (org-element-property :contents-begin element)
 		     (user-error "No content for this element"))))
 		     (user-error "No content for this element"))))
      (t (user-error "No inner element")))))
      (t (user-error "No inner element")))))

+ 8 - 85
testing/lisp/test-org-element.el

@@ -273,14 +273,6 @@ Some other text
   (should
   (should
    (org-test-with-temp-text "#+begin_center\nText\n#+end_center"
    (org-test-with-temp-text "#+begin_center\nText\n#+end_center"
      (org-element-map (org-element-parse-buffer) 'center-block 'identity)))
      (org-element-map (org-element-parse-buffer) 'center-block 'identity)))
-  ;; Test folded block.
-  (org-test-with-temp-text "#+BEGIN_CENTER\nText\n#+END_CENTER"
-    (org-cycle)
-    (should
-     (org-element-property
-      :hiddenp
-      (org-element-map
-       (org-element-parse-buffer) 'center-block 'identity nil t))))
   ;; Ignore incomplete block.
   ;; Ignore incomplete block.
   (should-not
   (should-not
    (org-test-with-temp-text "#+BEGIN_CENTER"
    (org-test-with-temp-text "#+BEGIN_CENTER"
@@ -393,14 +385,6 @@ Some other text
    (org-test-with-temp-text "#+begin_comment\nText\n#+end_comment"
    (org-test-with-temp-text "#+begin_comment\nText\n#+end_comment"
      (org-element-map
      (org-element-map
       (org-element-parse-buffer) 'comment-block 'identity)))
       (org-element-parse-buffer) 'comment-block 'identity)))
-  ;; Test folded block.
-  (org-test-with-temp-text "#+BEGIN_COMMENT\nText\n#+END_COMMENT"
-    (org-cycle)
-    (should
-     (org-element-property
-      :hiddenp
-      (org-element-map
-       (org-element-parse-buffer) 'comment-block 'identity nil t))))
   ;; Ignore incomplete block.
   ;; Ignore incomplete block.
   (should-not
   (should-not
    (org-test-with-temp-text "#+BEGIN_COMMENT"
    (org-test-with-temp-text "#+BEGIN_COMMENT"
@@ -457,15 +441,6 @@ Some other text
    (org-test-with-temp-text
    (org-test-with-temp-text
        "#+BEGIN: myblock :param1 val1 :param2 val2\nText\n#+END:"
        "#+BEGIN: myblock :param1 val1 :param2 val2\nText\n#+END:"
      (org-element-map (org-element-parse-buffer) 'dynamic-block 'identity)))
      (org-element-map (org-element-parse-buffer) 'dynamic-block 'identity)))
-  ;; Folded view
-  (org-test-with-temp-text
-      "#+BEGIN: myblock :param1 val1 :param2 val2\nText\n#+END:"
-    (org-cycle)
-    (should
-     (org-element-property
-      :hiddenp
-      (org-element-map
-       (org-element-parse-buffer) 'dynamic-block 'identity nil t))))
   ;; Ignore case.
   ;; Ignore case.
   (should
   (should
    (org-test-with-temp-text
    (org-test-with-temp-text
@@ -518,11 +493,6 @@ Some other text
   (should
   (should
    (org-test-with-temp-text "#+BEGIN_EXAMPLE\nText\n#+END_EXAMPLE"
    (org-test-with-temp-text "#+BEGIN_EXAMPLE\nText\n#+END_EXAMPLE"
      (org-element-map (org-element-parse-buffer) 'example-block 'identity)))
      (org-element-map (org-element-parse-buffer) 'example-block 'identity)))
-  ;; Test folded block.
-  (should
-   (org-test-with-temp-text "#+BEGIN_EXAMPLE\nText\n#+END_EXAMPLE"
-     (org-cycle)
-     (org-element-property :hiddenp (org-element-at-point))))
   ;; Ignore incomplete block.
   ;; Ignore incomplete block.
   (should-not
   (should-not
    (eq 'example-block
    (eq 'example-block
@@ -682,17 +652,6 @@ Some other text
 	     '(("LATEX" . org-element-export-block-parser))))
 	     '(("LATEX" . org-element-export-block-parser))))
 	(org-element-parse-buffer))
 	(org-element-parse-buffer))
       'export-block 'identity)))
       'export-block 'identity)))
-  ;; Test folded block.
-  (org-test-with-temp-text "#+BEGIN_LATEX\nText\n#+END_LATEX"
-    (org-cycle)
-    (should
-     (org-element-property
-      :hiddenp
-      (org-element-map
-       (let ((org-element-block-name-alist
-	      '(("LATEX" . org-element-export-block-parser))))
-	 (org-element-parse-buffer))
-       'export-block 'identity nil t))))
   ;; Ignore case.
   ;; Ignore case.
   (should
   (should
    (org-test-with-temp-text "#+begin_latex\nText\n#+end_latex"
    (org-test-with-temp-text "#+begin_latex\nText\n#+end_latex"
@@ -1111,17 +1070,6 @@ DEADLINE: <2012-03-29 thu.>"
       (org-element-map
       (org-element-map
        (org-element-parse-buffer) 'item
        (org-element-parse-buffer) 'item
        (lambda (item) (org-element-property :checkbox item))))))
        (lambda (item) (org-element-property :checkbox item))))))
-  ;; Folded state.
-  (org-test-with-temp-text "* Headline
-- item
-
-  paragraph below"
-    (forward-line)
-    (let ((org-cycle-include-plain-lists t)) (org-cycle))
-    (should
-     (org-element-property
-      :hiddenp
-      (org-element-map (org-element-parse-buffer) 'item 'identity nil t))))
   ;; Item starting with special syntax.
   ;; Item starting with special syntax.
   (should
   (should
    (equal '(("- item"))
    (equal '(("- item"))
@@ -1598,14 +1546,6 @@ Outside list"
   (should
   (should
    (org-test-with-temp-text "#+BEGIN_QUOTE\nText\n#+END_QUOTE"
    (org-test-with-temp-text "#+BEGIN_QUOTE\nText\n#+END_QUOTE"
      (org-element-map (org-element-parse-buffer) 'quote-block 'identity)))
      (org-element-map (org-element-parse-buffer) 'quote-block 'identity)))
-  ;; Test folded block.
-  (org-test-with-temp-text "#+BEGIN_QUOTE\nText\n#+END_QUOTE"
-    (org-cycle)
-    (should
-     (org-element-property
-      :hiddenp
-      (org-element-map
-       (org-element-parse-buffer) 'quote-block 'identity nil t))))
   ;; Ignore incomplete block.
   ;; Ignore incomplete block.
   (should-not
   (should-not
    (org-test-with-temp-text "#+BEGIN_QUOTE"
    (org-test-with-temp-text "#+BEGIN_QUOTE"
@@ -1680,11 +1620,6 @@ Outside list"
        (org-test-with-temp-text "#+BEGIN_SPECIAL\nText\n#+END_SPECIAL"
        (org-test-with-temp-text "#+BEGIN_SPECIAL\nText\n#+END_SPECIAL"
 	 (forward-line)
 	 (forward-line)
 	 (org-element-type (org-element-at-point)))))
 	 (org-element-type (org-element-at-point)))))
-  ;; Test folded block.
-  (should
-   (org-test-with-temp-text "#+BEGIN_SPECIAL\nText\n#+END_SPECIAL"
-     (org-cycle)
-     (org-element-property :hiddenp (org-element-at-point))))
   ;; Ignore incomplete block.
   ;; Ignore incomplete block.
   (should-not
   (should-not
    (eq 'special-block
    (eq 'special-block
@@ -1707,11 +1642,6 @@ Outside list"
   (should
   (should
    (org-test-with-temp-text "#+BEGIN_SRC org\nText\n#+END_SRC"
    (org-test-with-temp-text "#+BEGIN_SRC org\nText\n#+END_SRC"
      (org-element-map (org-element-parse-buffer) 'src-block 'identity)))
      (org-element-map (org-element-parse-buffer) 'src-block 'identity)))
-  ;; Test folded block.
-  (should
-   (org-test-with-temp-text "#+BEGIN_SRC org\nText\n#+END_SRC"
-     (org-cycle)
-     (org-element-property :hiddenp (org-element-at-point))))
   ;; Ignore incomplete block.
   ;; Ignore incomplete block.
   (should-not
   (should-not
    (org-test-with-temp-text "#+BEGIN_SRC"
    (org-test-with-temp-text "#+BEGIN_SRC"
@@ -1994,29 +1924,22 @@ Outside list"
 (ert-deftest test-org-element/verse-block-parser ()
 (ert-deftest test-org-element/verse-block-parser ()
   "Test `verse-block' parser."
   "Test `verse-block' parser."
   ;; Standard test.
   ;; Standard test.
-  (org-test-with-temp-text "#+BEGIN_VERSE\nVerse block\n#+END_VERSE"
-    (should
+  (should
+   (org-test-with-temp-text "#+BEGIN_VERSE\nVerse block\n#+END_VERSE"
      (org-element-map (org-element-parse-buffer) 'verse-block 'identity)))
      (org-element-map (org-element-parse-buffer) 'verse-block 'identity)))
   ;; Ignore case.
   ;; Ignore case.
-  (org-test-with-temp-text "#+begin_verse\nVerse block\n#+end_verse"
-    (should
+  (should
+   (org-test-with-temp-text "#+begin_verse\nVerse block\n#+end_verse"
      (org-element-map (org-element-parse-buffer) 'verse-block 'identity)))
      (org-element-map (org-element-parse-buffer) 'verse-block 'identity)))
-  ;; Parse folding.
-  (org-test-with-temp-text "#+BEGIN_VERSE\nVerse block\n#+END_VERSE"
-    (org-hide-block-all)
-    (should
-     (org-element-property
-      :hiddenp
-      (org-element-map
-       (org-element-parse-buffer) 'verse-block 'identity nil t))))
   ;; Parse objects in verse blocks.
   ;; Parse objects in verse blocks.
-  (org-test-with-temp-text "#+BEGIN_VERSE\nVerse \\alpha\n#+END_VERSE"
-    (should (org-element-map (org-element-parse-buffer) 'entity 'identity)))
+  (should
+   (org-test-with-temp-text "#+BEGIN_VERSE\nVerse \\alpha\n#+END_VERSE"
+     (org-element-map (org-element-parse-buffer) 'entity 'identity)))
   ;; Ignore incomplete verse block.
   ;; Ignore incomplete verse block.
   (should-not
   (should-not
    (org-test-with-temp-text "#+BEGIN_VERSE"
    (org-test-with-temp-text "#+BEGIN_VERSE"
      (org-element-map
      (org-element-map
-      (org-element-parse-buffer) 'verse-block 'identity nil t))))
+	 (org-element-parse-buffer) 'verse-block 'identity nil t))))