Function: scan-buf-move-to-region
scan-buf-move-to-region is an autoloaded and byte-compiled function
defined in help-at-pt.el.gz.
Signature
(scan-buf-move-to-region PROP &optional ARG HOOK)
Documentation
Go to the start of the next region with non-nil PROP property.
Then run HOOK, which should be a quoted symbol that is a normal hook variable, or an expression evaluating to such a symbol. Adjacent areas with different non-nil PROP properties are considered different regions.
With numeric argument ARG, move to the start of the ARGth next such region, then run HOOK. If ARG is negative, move backward. If point is already in a region, then that region does not count toward ARG. If ARG is 0 and point is inside a region, move to the start of that region. If ARG is 0 and point is not in a region, print a message to that effect, but do not move point and do not run HOOK. If there are not enough regions to move over, an error results and the number of available regions is mentioned in the error message. Point is not moved and HOOK is not run.
Source Code
;; Defined in /usr/src/emacs/lisp/help-at-pt.el.gz
;;;###autoload
(defun scan-buf-move-to-region (prop &optional arg hook)
"Go to the start of the next region with non-nil PROP property.
Then run HOOK, which should be a quoted symbol that is a normal
hook variable, or an expression evaluating to such a symbol.
Adjacent areas with different non-nil PROP properties are
considered different regions.
With numeric argument ARG, move to the start of the ARGth next
such region, then run HOOK. If ARG is negative, move backward.
If point is already in a region, then that region does not count
toward ARG. If ARG is 0 and point is inside a region, move to
the start of that region. If ARG is 0 and point is not in a
region, print a message to that effect, but do not move point and
do not run HOOK. If there are not enough regions to move over,
an error results and the number of available regions is mentioned
in the error message. Point is not moved and HOOK is not run."
(cond ((> arg 0)
(if (= (point) (point-max))
(error "No further `%s' regions" prop))
(let ((pos (point)))
(dotimes (x arg)
(setq pos (next-single-char-property-change pos prop))
(unless (get-char-property pos prop)
(setq pos (next-single-char-property-change pos prop))
(unless (get-char-property pos prop)
(cond ((= x 0)
(error "No further `%s' regions" prop))
((= x 1)
(error "There is only one further `%s' region" prop))
(t
(error
"There are only %d further `%s' regions"
x prop))))))
(goto-char pos)
(run-hooks hook)))
((= arg 0)
(let ((val (get-char-property (point) prop)))
(cond ((not val)
(message "Point is not in a `%s' region" prop))
((eq val (get-char-property (1- (point)) prop))
(goto-char
(previous-single-char-property-change (point) prop))
(run-hooks hook))
(t (run-hooks hook)))))
((< arg 0)
(let ((pos (point)) (val (get-char-property (point) prop)))
(and val
(eq val (get-char-property (1- pos) prop))
(setq pos
(previous-single-char-property-change pos prop)))
(if (= pos (point-min))
(error "No prior `%s' regions" prop))
(dotimes (x (- arg))
(setq pos (previous-single-char-property-change pos prop))
(unless (get-char-property pos prop)
(setq pos (previous-single-char-property-change pos prop))
(unless (get-char-property pos prop)
(cond ((= x 0)
(error "No prior `%s' regions" prop))
((= x 1)
(error "There is only one prior `%s' region" prop))
(t
(error "There are only %d prior `%s' regions"
x prop))))))
(goto-char pos)
(run-hooks hook)))))