Function: org--blank-before-heading-p

org--blank-before-heading-p is a byte-compiled function defined in org.el.gz.

Signature

(org--blank-before-heading-p &optional PARENT)

Documentation

Non-nil when an empty line should precede a new heading here.

When optional argument PARENT is non-nil, consider parent headline instead of current one.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
;;;; Structure editing

;;; Inserting headlines

(defun org--blank-before-heading-p (&optional parent)
  "Non-nil when an empty line should precede a new heading here.
When optional argument PARENT is non-nil, consider parent
headline instead of current one."
  (pcase (assq 'heading org-blank-before-new-entry)
    (`(heading . auto)
     (save-excursion
       (org-with-limited-levels
        (unless (and (org-before-first-heading-p)
                     (not (outline-next-heading)))
          (org-back-to-heading t)
          (when parent (org-up-heading-safe))
          (cond ((not (bobp))
                 (org-previous-line-empty-p))
		((outline-next-heading)
		 (org-previous-line-empty-p))
		;; Ignore trailing spaces on last buffer line.
		((progn (skip-chars-backward " \t") (bolp))
		 (org-previous-line-empty-p))
		(t nil))))))
    (`(heading . ,value) value)
    (_ nil)))