[Timeline] Use org-modes parser to parse headlines
The headline will now also have a property called ’marker, pointing to the corresponding headline in the org-mode file
This commit is contained in:
parent
1acc866b76
commit
ffa06f0ee3
|
@ -95,18 +95,14 @@ Return whatever is found first."
|
||||||
(org-entry-get marker "CATEGORY"))))
|
(org-entry-get marker "CATEGORY"))))
|
||||||
|
|
||||||
(defun timeline-tools-entry-headlines (entry)
|
(defun timeline-tools-entry-headlines (entry)
|
||||||
"Return list of all headlines associated with ENTRY."
|
"Return list of all headlines associated with ENTRY.
|
||||||
|
The headline will be a string, propertized with a property called
|
||||||
|
`marker’ and a corresponding marker pointing to the headline."
|
||||||
(mapcar (lambda (marker)
|
(mapcar (lambda (marker)
|
||||||
(save-match-data
|
(let ((heading (org-with-point-at marker
|
||||||
(let* ((heading (save-mark-and-excursion
|
(org-element-headline-parser (point-max)))))
|
||||||
(with-current-buffer (marker-buffer marker)
|
(propertize (plist-get (cadr heading) :raw-value)
|
||||||
(goto-char (marker-position marker))
|
'marker marker)))
|
||||||
(thing-at-point 'line t)))))
|
|
||||||
(string-match (format "^\\(\\*+\\)\\(?: +%s\\)?\\(?: %s\\)? +\\(.*?\\)[ \t]*\\(?::\\(?:[A-Za-z_]+:\\)+\\)?$"
|
|
||||||
(regexp-opt org-todo-keywords-1)
|
|
||||||
org-priority-regexp)
|
|
||||||
heading)
|
|
||||||
(match-string 4 heading))))
|
|
||||||
(timeline-tools-entry-markers entry)))
|
(timeline-tools-entry-markers entry)))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue