summaryrefslogtreecommitdiff
path: root/lisp/wid-edit.el
diff options
context:
space:
mode:
authorStephen Berman <stephen.berman@gmx.net>2023-09-02 23:22:01 +0200
committerStephen Berman <stephen.berman@gmx.net>2023-09-02 23:22:01 +0200
commit088fec0a1f8bf2ff5182d93ff48063cc17193037 (patch)
treeb3df3bd7c9c727546eda2bb60ececb1ba9bea108 /lisp/wid-edit.el
parent3dac48d1b73794d2379e233f11736d0279b0733c (diff)
downloademacs-088fec0a1f8bf2ff5182d93ff48063cc17193037.tar.gz
Fix and extend applying substitution in widget-choose
* lisp/wid-edit.el (widget-choose): Iterate only over proper lists when applying substitution (bug#64046, Message #53). With simple item definitions, apply substitution only to the item text, not to its value (bug#64046, Message #86). Apply substitution also to the widget title (bug#64046, Message #92).
Diffstat (limited to 'lisp/wid-edit.el')
-rw-r--r--lisp/wid-edit.el22
1 files changed, 13 insertions, 9 deletions
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index ae060c92d0e..d18d721f7ed 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -282,16 +282,20 @@ The user is asked to choose between each NAME from ITEMS.
If ITEMS has simple item definitions, then this function returns the VALUE of
the chosen element. If ITEMS is a keymap, then the return value is the symbol
in the key vector, as in the argument of `define-key'."
- ;; Apply quote substitution to customize choice menu item text,
- ;; whether it occurs in a widget buffer or in a popup menu.
+ ;; Apply substitution to choice menu title and item text, whether it
+ ;; occurs in a widget buffer or in a popup menu.
(let ((items (mapc (lambda (x)
- (when (consp x)
- (dotimes (i (1- (length x)))
- (when (stringp (nth i x))
- (setcar (nthcdr i x)
- (substitute-command-keys
- (car (nthcdr i x))))))))
- items)))
+ (if (proper-list-p x)
+ (dotimes (i (1- (length x)))
+ (when (stringp (nth i x))
+ (setcar (nthcdr i x)
+ (substitute-command-keys
+ (car (nthcdr i x))))))
+ ;; ITEMS has simple item definitions.
+ (when (and (consp x) (stringp (car x)))
+ (setcar x (substitute-command-keys (car x))))))
+ items))
+ (title (substitute-command-keys title)))
(cond ((and (< (length items) widget-menu-max-size)
event (display-popup-menus-p))
;; Mouse click.