Function: ibut:next-occurrence

ibut:next-occurrence is a byte-compiled function defined in hbut.el.

Signature

(ibut:next-occurrence NAME-KEY &optional BUFFER)

Documentation

Move point to next occurrence of an implicit button with NAME-KEY.

Optional BUFFER defaults to current buffer. It may be a buffer name. Return non-nil iff occurrence is found.

Remember to use (goto-char (point-min)) before calling this in order to move to the first occurrence of the button.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260822.1645/hbut.el
(defun    ibut:next-occurrence (name-key &optional buffer)
  "Move point to next occurrence of an implicit button with NAME-KEY.
Optional BUFFER defaults to current buffer.  It may be a buffer name.
Return non-nil iff occurrence is found.

Remember to use (goto-char (point-min)) before calling this in order to
move to the first occurrence of the button."
  (when buffer
    (if (not (or (bufferp buffer) (and (stringp buffer) (get-buffer buffer))))
	(error "(ibut:next-occurrence): Invalid buffer arg: %s" buffer)
      (switch-to-buffer buffer)))
  (when (or
         ;; Match to <[name-key]>
         (re-search-forward (ibut:name-regexp name-key) nil t)
         ;; Match to unnamed implicit button where the text is delimited in
         ;; some way and starts with the label version of `name-key'
	 (and (re-search-forward (ibut:name-regexp name-key t) nil t)
              (save-match-data
                (equal name-key
                       (or (ibut:label-p nil "<" ">" nil t)
                           (ibut:label-p nil "{" "}" nil t)
                           (ibut:label-p nil "[" "]" nil t)
                           (ibut:label-p nil "(" ")" nil t)
                           (ibut:label-p nil "\"" "\"" nil t))))))
    (goto-char (+ (match-beginning 0) (length ibut:label-start)))))