1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Avoid errors when a restricted-sexp widget is empty

* lisp/wid-edit.el (restricted-sexp): Don't try to read
an empty string when converting the current value to the
external format.  (Bug#63838)

* test/lisp/wid-edit-tests.el (widget-test-restricted-sexp-empty-val):
New test.
This commit is contained in:
Mauro Aranda 2023-09-09 21:59:30 +08:00 committed by Eli Zaretskii
parent 68976b00f1
commit 2ea98ea35c
2 changed files with 14 additions and 1 deletions

View file

@ -3681,7 +3681,9 @@ match-alternatives: %S"
:warning)
;; Make sure we will `read' a string.
(setq value (prin1-to-string value)))
(read value)))
(if (string-empty-p value)
value
(read value))))
(defun widget-restricted-sexp-match (widget value)
(let ((alternatives (widget-get widget :match-alternatives))