summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1998-09-13 03:36:27 +0000
committerKarl Heuer <kwzh@gnu.org>1998-09-13 03:36:27 +0000
commit8a45f26e721c0bf7ad67a1660a98c009d58d3796 (patch)
tree3c32ffb6e62c07b3e0f5d019d6eca8312d5f043f
parentf4011077c9f572bf11d4c9580a7c35e8aedc033a (diff)
downloademacs-8a45f26e721c0bf7ad67a1660a98c009d58d3796.tar.gz
(widget-menu-max-shortcuts): New variable.
(widget-choose): Don't use single-char shortcuts if # items exceeds that many. Use minibuffer instead.
-rw-r--r--lisp/wid-edit.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 583ab54fbc2..70d61a99d23 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -176,7 +176,13 @@ Larger menus are read through the minibuffer."
:group 'widgets
:type 'integer)
-(defcustom widget-menu-minibuffer-flag (string-match "XEmacs" emacs-version)
+(defcustom widget-menu-max-shortcuts 40
+ "Largest number of items for which it works to choose one with a character.
+For a larger number of items, the minibuffer is used."
+ :group 'widgets
+ :type 'integer)
+
+(defcustom widget-menu-minibuffer-flag nil
"*Control how to ask for a choice from the keyboard.
Non-nil means use the minibuffer;
nil means read a single character."
@@ -202,7 +208,8 @@ minibuffer."
;; We are in Emacs-19, pressed by the mouse
(x-popup-menu event
(list title (cons "" items))))
- (widget-menu-minibuffer-flag
+ ((or widget-menu-minibuffer-flag
+ (> (length items) widget-menu-max-shortcuts))
;; Read the choice of name from the minibuffer.
(setq items (widget-remove-if 'stringp items))
(let ((val (completing-read (concat title ": ") items nil t)))