Function: org-occur-next-match

org-occur-next-match is a byte-compiled function defined in org.el.gz.

Signature

(org-occur-next-match &optional N RESET)

Documentation

Function for next-error-function to find sparse tree matches.

N is the number of matches to move, when negative move backwards. This function always goes back to the starting point when no match is found.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-occur-next-match (&optional n _reset)
  "Function for `next-error-function' to find sparse tree matches.
N is the number of matches to move, when negative move backwards.
This function always goes back to the starting point when no
match is found."
  (let* ((limit (if (< n 0) (point-min) (point-max)))
	 (search-func (if (< n 0)
			  'previous-single-char-property-change
			'next-single-char-property-change))
	 (n (abs n))
	 (pos (point))
	 p1)
    (catch 'exit
      (while (setq p1 (funcall search-func (point) 'org-type))
	(when (equal p1 limit)
	  (goto-char pos)
	  (user-error "No more matches"))
	(when (equal (get-char-property p1 'org-type) 'org-occur)
	  (setq n (1- n))
	  (when (= n 0)
	    (goto-char p1)
	    (throw 'exit (point))))
	(goto-char p1))
      (goto-char p1)
      (user-error "No more matches"))))