Function: org-get-heading

org-get-heading is a byte-compiled function defined in org.el.gz.

Signature

(org-get-heading &optional NO-TAGS NO-TODO NO-PRIORITY NO-COMMENT)

Documentation

Return the heading of the current entry, without the stars.

When NO-TAGS is non-nil, don't include tags. When NO-TODO is non-nil, don't include TODO keywords. When NO-PRIORITY is non-nil, don't include priority cookie. When NO-COMMENT is non-nil, don't include COMMENT string. Return nil before first heading.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-get-heading (&optional no-tags no-todo no-priority no-comment)
  "Return the heading of the current entry, without the stars.
When NO-TAGS is non-nil, don't include tags.
When NO-TODO is non-nil, don't include TODO keywords.
When NO-PRIORITY is non-nil, don't include priority cookie.
When NO-COMMENT is non-nil, don't include COMMENT string.
Return nil before first heading."
  (unless (org-before-first-heading-p)
    (save-excursion
      (org-back-to-heading t)
      (let ((case-fold-search nil))
	(looking-at org-complex-heading-regexp)
        ;; When using `org-fold-core--optimize-for-huge-buffers',
        ;; returned text will be invisible.  Clear it up.
        (save-match-data
          (org-fold-core-remove-optimization (match-beginning 0) (match-end 0)))
        (let ((todo (and (not no-todo) (match-string 2)))
	      (priority (and (not no-priority) (match-string 3)))
	      (headline (pcase (match-string 4)
			  (`nil "")
			  ((and (guard no-comment) h)
			   (replace-regexp-in-string
			    (eval-when-compile
			      (format "\\`%s[ \t]+" org-comment-string))
			    "" h))
			  (h h)))
	      (tags (and (not no-tags) (match-string 5))))
          ;; Restore cleared optimization.
          (org-fold-core-update-optimization (match-beginning 0) (match-end 0))
	  (mapconcat #'identity
		     (delq nil (list todo priority headline tags))
		     " "))))))