Function: widget-move
widget-move is a byte-compiled function defined in wid-edit.el.gz.
Signature
(widget-move ARG &optional SUPPRESS-ECHO)
Documentation
Move point to the ARG next field or button.
ARG may be negative to move backward. When the second optional argument is non-nil, nothing is shown in the echo area.
Source Code
;; Defined in /usr/src/emacs/lisp/wid-edit.el.gz
(defun widget-move (arg &optional suppress-echo)
"Move point to the ARG next field or button.
ARG may be negative to move backward.
When the second optional argument is non-nil,
nothing is shown in the echo area."
(let* ((wrapped 0)
(number arg)
(fwd (> arg 0)) ; widget-forward is caller.
(bwd (< arg 0)) ; widget-backward is caller.
(old (widget-tabable-at))
(tabable (if old 1 0))
pos)
(catch 'one
(while (> (abs arg) 0)
(cond ((or (and fwd (eobp)) (and bwd (bobp)))
(goto-char (cond (fwd (point-min))
(bwd (point-max))))
(setq wrapped (1+ wrapped)))
(widget-use-overlay-change
(goto-char (cond (fwd (next-overlay-change (point)))
(bwd (previous-overlay-change (point))))))
(t
(cond (fwd (forward-char 1))
(bwd (backward-char 1)))))
(and (= wrapped 2)
(eq arg number)
(if (= tabable 1)
(progn
(goto-char pos)
(throw 'one (message "Only one tabable widget")))
(error "No buttons or fields found")))
(let ((new (widget-tabable-at)))
(when new
(if (eq new old)
(setq pos (point))
(incf tabable)
(setq arg (cond (fwd (1- arg))
(bwd (1+ arg))))
(setq old new))))))
(let ((new (widget-tabable-at)))
(while (and (eq (widget-tabable-at) new) (not (bobp)))
(backward-char)))
;; If the widget is at BOB, point is already at the widget's
;; starting position; otherwise, advance point to put it at the
;; start of the widget (cf. bug#69943 and bug#72995).
(unless (and (widget-tabable-at) (bobp)) (forward-char)))
(unless suppress-echo
(widget-echo-help (point)))
(run-hooks 'widget-move-hook))