Function: org-check-for-hidden

org-check-for-hidden is a byte-compiled function defined in org.el.gz.

Signature

(org-check-for-hidden WHAT)

Documentation

Check if there are hidden headlines/items in the current visual line.

WHAT can be either headlines or items. If the current line is an outline or item heading and it has a folded subtree below it, this function returns t, nil otherwise.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-check-for-hidden (what)
  "Check if there are hidden headlines/items in the current visual line.
WHAT can be either `headlines' or `items'.  If the current line is
an outline or item heading and it has a folded subtree below it,
this function returns t, nil otherwise."
  (let ((re (cond
	     ((eq what 'headlines) org-outline-regexp-bol)
	     ((eq what 'items) (org-item-beginning-re))
	     (t (error "This should not happen"))))
	beg end)
    (save-excursion
      (catch 'exit
	(unless (org-region-active-p)
          (setq beg (line-beginning-position))
	  (forward-line 1)
	  (while (and (not (eobp)) ;; this is like `next-line'
		      (org-invisible-p (1- (point))))
	    (forward-line 1))
	  (setq end (point))
	  (goto-char beg)
          (goto-char (line-end-position))
	  (setq end (max end (point)))
	  (while (re-search-forward re end t)
	    (when (org-invisible-p (match-beginning 0))
	      (throw 'exit t))))
	nil))))