Function: hyrolo-outline-next-visible-heading

hyrolo-outline-next-visible-heading is an interactive and byte-compiled function defined in hyrolo.el.

Signature

(hyrolo-outline-next-visible-heading ARG)

Documentation

Move to next visible heading or match buffer header.

With ARG, repeats or can move backward if negative. Return t if find any matching next heading/header, nil otherwise.

A heading is one that starts with an outline-regexp match. A match buffer header is one that starts with hyrolo-hdr-regexp.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hyrolo.el
(defun hyrolo-outline-next-visible-heading (arg)
  "Move to next visible heading or match buffer header.
With ARG, repeats or can move backward if negative.
Return t if find any matching next heading/header, nil otherwise.

A heading is one that starts with an `outline-regexp' match.
A match buffer header is one that starts with `hyrolo-hdr-regexp'."
  (interactive "p")
  (let ((orig-arg arg)
	(found)
	(opoint (point))
	(last-point (point)))
    (condition-case nil
        (cl-flet ((to-prev-entry ()
                    (while (progn (unless (eobp)
                                    (hyrolo-to-entry-beginning))
                                  (setq last-point (point))
                                  (goto-char
                                   (or (previous-single-property-change
                                        (point) :hyrolo-level)
                                       (point)))
                                  (while (and (< (point) last-point)
                                              (outline-invisible-p)
                                              (progn
                                                (forward-visible-line 0)
                                                (hyrolo-hdr-to-first-line-p)
                                                (> (point)
                                                   (hyrolo-to-entry-beginning))))))))
                  (to-next-entry ()
                    (while (progn
                             ;; Skip over hidden sub-entries in tree
                             (goto-char (max (line-end-position)
                                             (hyrolo-to-entry-end)))
                             (setq last-point (point))
                             (goto-char
                              (or (next-single-property-change
                                   (point) :hyrolo-level)
                                  (point)))
                             (while (and (> (point) last-point)
                                         (outline-invisible-p)
                                         (progn
                                           (end-of-visible-line)
                                           (hyrolo-hdr-to-first-line-p)
                                           (< (point) (hyrolo-to-entry-end)))))))))
          ;; Move to the start of -argth previous entry when arg < 0
	  (while (and (not (bobp)) (< arg 0))
            (unless (bobp)
	      (hyrolo-hdr-to-first-line-p)
	      (hyrolo-funcall-match #'to-prev-entry nil t)
	      (when (< (point) last-point)
		(setq found t)))
	    (setq arg (1+ arg)))

          ;; Move to the start of argth next entry when arg > 0
	  (while (and (not (eobp)) (> arg 0))
	    (unless (eobp)
	      (if (hyrolo-hdr-move-after-p)
		  (setq found t)
		(hyrolo-funcall-match #'to-next-entry)
		(when (< last-point (point))
		  (setq found t))))
	    (setq arg (1- arg)))

	  (cond (found
		 (beginning-of-line))
		((> orig-arg 0)
		 (goto-char (point-max)))
		((< orig-arg 0)
		 (goto-char (point-min)))
		(t (goto-char opoint))))
      ;; Prevent error and move to start or end of file header at point,
      ;; if any
      (error (if (>= arg 0)
		 (hyrolo-hdr-move-after-p)
	       (hyrolo-hdr-to-first-line-p))))
    (and found (/= (point) opoint) t)))