From 9d334897e3c6be7bc567b1ad489e7b815e8a87f6 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 9 Sep 2012 14:03:36 +0200 Subject: [PATCH 1/2] Don't consider tags as a replacement for a missing title in an headline * lisp/org.el (org-set-regexps-and-options): Don't consider tags as a replacement for a missing title in an headline. --- lisp/org.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index d6dd767a5..90d40e2a5 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4824,7 +4824,7 @@ but the stars and the body are.") (concat "^\\(\\*+\\)" "\\(?: +" org-todo-regexp "\\)?" "\\(?: +\\(\\[#.\\]\\)\\)?" - "\\(?: +\\(.*?\\)\\)?" + "\\(?: +\\(.*?\\)\\)??" (org-re "\\(?:[ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)?") "[ \t]*$") org-complex-heading-regexp-format @@ -4842,7 +4842,7 @@ but the stars and the body are.") org-todo-line-tags-regexp (concat "^\\(\\*+\\)" "\\(?: +" org-todo-regexp "\\)?" - "\\(?: +\\(.*?\\)\\)?" + "\\(?: +\\(.*?\\)\\)??" (org-re "\\(?:[ \t]+\\(:[[:alnum:]:_@#%]+:\\)\\)?") "[ \t]*$") org-deadline-regexp (concat "\\<" org-deadline-string) From f29131c3d2581a3089a5862dd84eb6cb435d2e45 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 9 Sep 2012 14:13:24 +0200 Subject: [PATCH 2/2] 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. --- lisp/org-element.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index ebaf3f6f6..456ed15d2 100644 --- a/lisp/org-element.el +++ b/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))) (tags (let ((raw-tags (nth 5 components))) (and raw-tags (org-split-string raw-tags ":")))) - (raw-value (nth 4 components)) + (raw-value (or (nth 4 components) "")) (quotedp (let ((case-fold-search nil)) (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 containing `:title', `:begin', `:end', `:hiddenp', `: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, 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))) (tags (let ((raw-tags (nth 5 components))) (and raw-tags (org-split-string raw-tags ":")))) + (raw-value (or (nth 4 components) "")) ;; Normalize property names: ":SOME_PROP:" becomes ;; ":some-prop". (standard-props (let (plist) @@ -901,7 +903,8 @@ Assume point is at beginning of the inline task." (inlinetask (list 'inlinetask (nconc - (list :begin begin + (list :raw-value raw-value + :begin begin :end end :hiddenp hidden :contents-begin contents-begin @@ -920,9 +923,9 @@ Assume point is at beginning of the inline task." (cadr keywords))))) (org-element-put-property inlinetask :title - (if raw-secondary-p (nth 4 components) + (if raw-secondary-p raw-value (org-element-parse-secondary-string - (nth 4 components) + raw-value (org-element-restriction 'inlinetask) inlinetask))))))