[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 91333dacfa1: Allow tabbing between widgets to skip inactive widge
From: |
Stephen Berman |
Subject: |
master 91333dacfa1: Allow tabbing between widgets to skip inactive widgets (bug#70413) |
Date: |
Wed, 17 Apr 2024 13:33:38 -0400 (EDT) |
branch: master
commit 91333dacfa1b9f1041ceeebb3d46e8e04048c4c9
Author: Stephen Berman <stephen.berman@gmx.net>
Commit: Stephen Berman <stephen.berman@gmx.net>
Allow tabbing between widgets to skip inactive widgets (bug#70413)
* 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.
---
doc/misc/widget.texi | 14 ++++++++++++++
etc/NEWS | 7 +++++++
lisp/wid-edit.el | 13 +++++++++++--
3 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/doc/misc/widget.texi b/doc/misc/widget.texi
index cfb9d2211cf..f74605c92c0 100644
--- a/doc/misc/widget.texi
+++ b/doc/misc/widget.texi
@@ -795,6 +795,11 @@ Move point @var{count} buttons or editing fields backward.
@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:
@@ -3321,6 +3326,15 @@ If non-@code{nil}, toggle when there are just two
options.
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
diff --git a/etc/NEWS b/etc/NEWS
index bc8be557711..e6f8eb5ba46 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1603,6 +1603,13 @@ This allows disabling JavaScript in xwidget Webkit
sessions.
'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.
+
* New Modes and Packages in Emacs 30.1
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 4bc1ebc406a..cb6d8ebc2c4 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -1234,11 +1234,20 @@ If nothing was called, return non-nil."
(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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 91333dacfa1: Allow tabbing between widgets to skip inactive widgets (bug#70413),
Stephen Berman <=