Function: elisp-refs--move-to-match

elisp-refs--move-to-match is a byte-compiled function defined in elisp-refs.el.

Signature

(elisp-refs--move-to-match DIRECTION)

Documentation

Move point one match forwards.

If DIRECTION is -1, moves backwards instead.

Source Code

;; Defined in ~/.emacs.d/elpa/elisp-refs-20230920.201/elisp-refs.el
(defun elisp-refs--move-to-match (direction)
  "Move point one match forwards.
If DIRECTION is -1, moves backwards instead."
  (let* ((start-pos (point))
         (match-pos (get-text-property start-pos 'elisp-refs-start-pos))
         current-match-pos)
    (condition-case _err
        (progn
          ;; Move forward/backwards until we're on the next/previous match.
          (catch 'done
            (while t
              (setq current-match-pos
                    (get-text-property (point) 'elisp-refs-start-pos))
              (when (and current-match-pos
                         (not (equal match-pos current-match-pos)))
                (throw 'done nil))
              (forward-char direction)))
          ;; Move to the beginning of that match.
          (while (equal (get-text-property (point) 'elisp-refs-start-pos)
                        (get-text-property (1- (point)) 'elisp-refs-start-pos))
            (forward-char -1))
          ;; Move forward until we're on the first char of match within that
          ;; line.
          (while (or
                  (looking-at " ")
                  (eq (get-text-property (point) 'face)
                      'font-lock-comment-face))
            (forward-char 1)))
      ;; If we're at the last result, don't move point.
      (end-of-buffer
       (progn
         (goto-char start-pos)
         (signal 'end-of-buffer nil))))))