diff options
author | Stephen Berman <stephen.berman@gmx.net> | 2023-09-02 23:22:01 +0200 |
---|---|---|
committer | Stephen Berman <stephen.berman@gmx.net> | 2023-09-02 23:22:01 +0200 |
commit | 088fec0a1f8bf2ff5182d93ff48063cc17193037 (patch) | |
tree | b3df3bd7c9c727546eda2bb60ececb1ba9bea108 /lisp/wid-edit.el | |
parent | 3dac48d1b73794d2379e233f11736d0279b0733c (diff) | |
download | emacs-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.el | 22 |
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. |