* doc/misc/widget.texi (Widgets and the Buffer, Customization):
Document it.
* etc/NEWS: Announce it.
* lisp/wid-edit.el (widget-skip-inactive): New user option.
(widget-tabable-at): Use it.
(cherry picked from commit
91333dacfa1b9f1041ceeebb3d46e8e04048c4c9)
@end deffn
@end table
+@noindent
+By default, tabbing can put point on an inactive widget. To skip over
+inactive widgets when tabbing, set the user option
+@code{widget-skip-inactive} to a non-@code{nil} value.
+@xref{Customization}.
When editing an @code{editable-field} widget, the following commands
are available:
By default, its value is @code{nil}.
@end defopt
+@defopt widget-skip-inactive
+If non-@code{nil}, skip over inactive widgets when using @kbd{@key{TAB}}
+(@code{widget-forward}) or @kbd{S-@key{TAB}} (@code{widget-backward},
+also bound to @kbd{M-@key{TAB}}) to navigate between widgets.
+
+By default, its value is @code{nil} and tabbing does not skip over
+inactive widgets.
+@end defopt
+
@defopt widget-documentation-links
If non-@code{nil}, add hyperlinks to documentation strings.
@end defopt
'insert-directory', now supports the '--time=TIME' and '--sort=time'
options of GNU 'ls'.
+** Widget
+
++++
+*** New user option 'widget-skip-inactive'.
+If non-nil, moving point forward or backward between widgets by typing
+TAB or S-TAB skips over inactive widgets. The default value is nil.
+
\f
* New Modes and Packages in Emacs 30.1
(when (commandp command)
(call-interactively command))))))
+(defcustom widget-skip-inactive nil
+ "If non-nil, skip inactive widgets when tabbing through buffer."
+ :version "30.1"
+ :group 'widgets
+ :type 'boolean)
+
(defun widget-tabable-at (&optional pos)
"Return the tabable widget at POS, or nil.
-POS defaults to the value of (point)."
+POS defaults to the value of (point). If user option
+`widget-skip-inactive' is non-nil, inactive widgets are not tabable."
(let ((widget (widget-at pos)))
- (if widget
+ (if (and widget (if widget-skip-inactive
+ (widget-apply widget :active)
+ t))
(let ((order (widget-get widget :tab-order)))
(if order
(if (>= order 0)