; Fix documentation of widget commands

* doc/misc/widget.texi (Widgets and the Buffer): Fix the
signatures of 'widget-forward' and 'widget-backward'.  Reported by
Tim Landscheidt <tim@tim-landscheidt.de>.

* lisp/wid-edit.el (widget-forward, widget-backward)
(widget-move): Doc fixes.
This commit is contained in:
Eli Zaretskii 2026-02-07 11:45:00 +02:00
parent cdc390d992
commit e1524740be
2 changed files with 21 additions and 15 deletions

View file

@ -785,13 +785,19 @@ The following navigation commands are available:
@table @kbd
@item @key{TAB}
@deffn Command widget-forward &optional count
Move point @var{count} buttons or editing fields forward.
@deffn Command widget-forward count &optional suppress-echo
Move point @var{count} buttons or editing fields forward. The optional
@var{suppress-echo} argument suppresses showing in the echo-area the
help-echo text, if any, for the final position after the move; it is
always @code{nil} in interactive invocations.
@end deffn
@item M-@key{TAB}
@itemx S-@key{TAB}
@deffn Command widget-backward &optional count
Move point @var{count} buttons or editing fields backward.
@deffn Command widget-backward count &optional suppress-echo
Move point @var{count} buttons or editing fields backward. The optional
@var{suppress-echo} argument suppresses showing in the echo-area the
help-echo text, if any, for the final position after the move; it is
always @code{nil} in interactive invocations.
@end deffn
@end table

View file

@ -1334,10 +1334,10 @@ POS defaults to the value of (point). If user option
This is much faster.")
(defun widget-move (arg &optional suppress-echo)
"Move point to the ARG next field or button.
"Move point to the ARGth 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."
If the optional argument SUPPRESS-ECHO is non-nil, suppress showing
in the echo area the help-echo, if any, for the final position."
(let* ((wrapped 0)
(number arg)
(fwd (> arg 0)) ; widget-forward is caller.
@ -1384,19 +1384,19 @@ nothing is shown in the echo area."
(run-hooks 'widget-move-hook))
(defun widget-forward (arg &optional suppress-echo)
"Move point to the next field or button.
With optional ARG, move across that many fields.
When the second optional argument is non-nil,
nothing is shown in the echo area."
"Move point forward across ARG fields or buttons.
Interactively, ARG is the prefix numeric argument and defaults to 1.
If the optional argument SUPPRESS-ECHO is non-nil, suppress showing
in the echo area the help-echo, if any, for the final position."
(interactive "p")
(run-hooks 'widget-forward-hook)
(widget-move arg suppress-echo))
(defun widget-backward (arg &optional suppress-echo)
"Move point to the previous field or button.
With optional ARG, move across that many fields.
When the second optional argument is non-nil,
nothing is shown in the echo area."
"Move point back across ARG fields or buttons.
Interactively, ARG is the prefix numeric argument and defaults to 1.
If the optional argument SUPPRESS-ECHO is non-nil, suppress showing
in the echo area the help-echo, if any, for the final position."
(interactive "p")
(run-hooks 'widget-backward-hook)
(widget-move (- arg) suppress-echo))