[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 088fec0a1f8: Fix and extend applying substitution in widget-choos
From: |
Stephen Berman |
Subject: |
master 088fec0a1f8: Fix and extend applying substitution in widget-choose |
Date: |
Sat, 2 Sep 2023 17:22:38 -0400 (EDT) |
branch: master
commit 088fec0a1f8bf2ff5182d93ff48063cc17193037
Author: Stephen Berman <stephen.berman@gmx.net>
Commit: Stephen Berman <stephen.berman@gmx.net>
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).
---
lisp/wid-edit.el | 22 +++++++++++++---------
1 file 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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 088fec0a1f8: Fix and extend applying substitution in widget-choose,
Stephen Berman <=