Browse Source

org-element: Handle nil titles in headlines

* lisp/org-element.el (org-element-headline-parser): Handle nil
  titles.
(org-element-inlinetask-parser): Add :raw-value property.  Also handle
nil titles.
Nicolas Goaziou 13 years ago
parent
commit
f29131c3d2
1 changed files with 9 additions and 6 deletions
  1. 9 6
      lisp/org-element.el

+ 9 - 6
lisp/org-element.el

@@ -701,7 +701,7 @@ Assume point is at beginning of the headline."
 	    (and todo (if (member todo org-done-keywords) 'done 'todo)))
 	    (and todo (if (member todo org-done-keywords) 'done 'todo)))
 	   (tags (let ((raw-tags (nth 5 components)))
 	   (tags (let ((raw-tags (nth 5 components)))
 		   (and raw-tags (org-split-string raw-tags ":"))))
 		   (and raw-tags (org-split-string raw-tags ":"))))
-	   (raw-value (nth 4 components))
+	   (raw-value (or (nth 4 components) ""))
 	   (quotedp
 	   (quotedp
 	    (let ((case-fold-search nil))
 	    (let ((case-fold-search nil))
 	      (string-match (format "^%s +" org-quote-string) raw-value)))
 	      (string-match (format "^%s +" org-quote-string) raw-value)))
@@ -844,8 +844,9 @@ CONTENTS is the contents of the element."
 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',
 containing `:title', `:begin', `:end', `:hiddenp',
 `:contents-begin' and `:contents-end', `:level', `:priority',
 `:contents-begin' and `:contents-end', `:level', `:priority',
-`:tags', `:todo-keyword', `:todo-type', `:scheduled',
-`:deadline', `:timestamp', `:clock' and `:post-blank' keywords.
+`:raw-value', `:tags', `:todo-keyword', `:todo-type',
+`:scheduled', `:deadline', `:timestamp', `:clock' 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 lowercase, the underscores replaced with hyphens
 with its name in lowercase, the underscores replaced with hyphens
@@ -865,6 +866,7 @@ Assume point is at beginning of the inline task."
 			   (if (member todo org-done-keywords) 'done 'todo)))
 			   (if (member todo org-done-keywords) 'done 'todo)))
 	   (tags (let ((raw-tags (nth 5 components)))
 	   (tags (let ((raw-tags (nth 5 components)))
 		   (and raw-tags (org-split-string raw-tags ":"))))
 		   (and raw-tags (org-split-string raw-tags ":"))))
+	   (raw-value (or (nth 4 components) ""))
 	   ;; Normalize property names: ":SOME_PROP:" becomes
 	   ;; Normalize property names: ":SOME_PROP:" becomes
 	   ;; ":some-prop".
 	   ;; ":some-prop".
 	   (standard-props (let (plist)
 	   (standard-props (let (plist)
@@ -901,7 +903,8 @@ Assume point is at beginning of the inline task."
 	   (inlinetask
 	   (inlinetask
 	    (list 'inlinetask
 	    (list 'inlinetask
 		  (nconc
 		  (nconc
-		   (list :begin begin
+		   (list :raw-value raw-value
+			 :begin begin
 			 :end end
 			 :end end
 			 :hiddenp hidden
 			 :hiddenp hidden
 			 :contents-begin contents-begin
 			 :contents-begin contents-begin
@@ -920,9 +923,9 @@ Assume point is at beginning of the inline task."
 		   (cadr keywords)))))
 		   (cadr keywords)))))
       (org-element-put-property
       (org-element-put-property
        inlinetask :title
        inlinetask :title
-       (if raw-secondary-p (nth 4 components)
+       (if raw-secondary-p raw-value
 	 (org-element-parse-secondary-string
 	 (org-element-parse-secondary-string
-	  (nth 4 components)
+	  raw-value
 	  (org-element-restriction 'inlinetask)
 	  (org-element-restriction 'inlinetask)
 	  inlinetask))))))
 	  inlinetask))))))