mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-13 09:32:47 +00:00
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).
This commit is contained in:
parent
3dac48d1b7
commit
088fec0a1f
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user