1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 12:21:25 -08:00

Avoid prompting when creating a restricted-sexp widget

* lisp/wid-edit.el (restricted-sexp): Turn value into a
string before reading.
(widget-field-value-create): Guard against value being nil,
so the field can be created even if the widget has a bad
default value.  (Bug#59937)
This commit is contained in:
Mauro Aranda 2023-07-16 19:46:54 -03:00 committed by Eli Zaretskii
parent a403e2832d
commit a9210e8efd

View file

@ -2127,7 +2127,8 @@ the earlier input."
;; `widget-setup' is called.
(overlay (cons (make-marker) (make-marker))))
(widget-put widget :field-overlay overlay)
(insert value)
(when value
(insert value))
(and size
(< (length value) size)
(insert-char ?\s (- size (length value))))
@ -3655,7 +3656,9 @@ match-alternatives: %S"
value
(widget-get widget :match)
(widget-get widget :match-alternatives))
:warning))
:warning)
;; Make sure we will `read' a string.
(setq value (prin1-to-string value)))
(read value)))
(defun widget-restricted-sexp-match (widget value)