Function: erc--button-next

erc--button-next is a byte-compiled function defined in erc-button.el.gz.

Signature

(erc--button-next ARG)

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-button.el.gz
(defun erc--button-next (arg)
  (let* ((nextp (prog1 (>= arg 1) (setq arg (max 1 (abs arg)))))
         (search-fn (if nextp
                        #'next-single-char-property-change
                      #'previous-single-char-property-change))
         (start (point))
         (p start))
    (while (progn
             ;; Break out of current search context.
             (when-let* ((low (max (point-min) (1- (pos-bol))))
                         (high (min (point-max) (1+ (pos-eol))))
                         (prop (get-text-property p 'erc-callback))
                         (q (if nextp
                                (text-property-not-all p high
                                                       'erc-callback prop)
                              (funcall search-fn p 'erc-callback nil low)))
                         ((< low q high)))
               (setq p q))
             ;; Assume that buttons occur frequently enough that
             ;; omitting LIMIT is acceptable.
             (while
                 (and (setq p (funcall search-fn p 'erc-callback))
                      (if nextp (< p erc-insert-marker) (/= p (point-min)))
                      (run-hook-with-args-until-success
                       'erc-button--prev-next-predicate-functions p)))
             (and arg
                  (< (point-min) p erc-insert-marker)
                  (goto-char p)
                  (not (zerop (cl-decf arg))))))
    (when (= (point) start)
      (user-error (if nextp "No next button" "No previous button")))
    t))