Function: org-element-headline-interpreter

org-element-headline-interpreter is a byte-compiled function defined in org-element.el.gz.

Signature

(org-element-headline-interpreter HEADLINE CONTENTS)

Documentation

Interpret HEADLINE element as Org syntax.

CONTENTS is the contents of the element.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
(defun org-element-headline-interpreter (headline contents)
  "Interpret HEADLINE element as Org syntax.
CONTENTS is the contents of the element."
  (let* ((level (org-element-property :level headline))
	 (todo (org-element-property :todo-keyword headline))
	 (priority (org-element-property :priority headline))
	 (title (org-element-interpret-data
		 (org-element-property :title headline)))
	 (tags (let ((tag-list (org-element-property :tags headline)))
		 (and tag-list
		      (format ":%s:" (mapconcat #'identity tag-list ":")))))
	 (commentedp (org-element-property :commentedp headline))
	 (pre-blank (or (org-element-property :pre-blank headline) 0))
	 (heading
	  (concat (make-string (if org-odd-levels-only (1- (* level 2)) level)
			       ?*)
		  (and todo (concat " " todo))
		  (and commentedp (concat " " org-element-comment-string))
		  (and priority (format " [#%c]" priority))
		  " "
		  (if (and org-footnote-section
			   (org-element-property :footnote-section-p headline))
		      org-footnote-section
		    title))))
    (concat
     heading
     ;; Align tags.
     (when tags
       (cond
	((zerop org-tags-column) (format " %s" tags))
	((< org-tags-column 0)
	 (concat
	  (make-string
	   (max (- (+ org-tags-column (length heading) (length tags))) 1)
	   ?\s)
	  tags))
	(t
	 (concat
	  (make-string (max (- org-tags-column (length heading)) 1) ?\s)
	  tags))))
     (make-string (1+ pre-blank) ?\n)
     contents)))