Commit 1d869634 authored by Dave Love's avatar Dave Love
Browse files

(widget-sexp-validate): Fix garbled code.

parent 14473664
...@@ -1635,7 +1635,7 @@ If END is omitted, it defaults to the length of LIST." ...@@ -1635,7 +1635,7 @@ If END is omitted, it defaults to the length of LIST."
:action 'widget-field-action :action 'widget-field-action
:validate 'widget-field-validate :validate 'widget-field-validate
:valid-regexp "" :valid-regexp ""
:error "No match" :error "Field's value doesn't match allowed form"
:value-create 'widget-field-value-create :value-create 'widget-field-value-create
:value-delete 'widget-field-value-delete :value-delete 'widget-field-value-delete
:value-get 'widget-field-value-get :value-get 'widget-field-value-get
...@@ -2998,26 +2998,27 @@ It will read a directory name from the minibuffer when invoked." ...@@ -2998,26 +2998,27 @@ It will read a directory name from the minibuffer when invoked."
(with-temp-buffer (with-temp-buffer
(insert (widget-apply widget :value-get)) (insert (widget-apply widget :value-get))
(goto-char (point-min)) (goto-char (point-min))
(condition-case data (let (err)
(progn (condition-case data
;; Avoid a confusing end-of-file error. (progn
(skip-syntax-forward "\\s-") ;; Avoid a confusing end-of-file error.
(if (eobp) (skip-syntax-forward "\\s-")
(error "Empty sexp -- use `nil'?")) (if (eobp)
(if (eobp) (setq err "Empty sexp -- use `nil'?")
(unless (widget-apply widget :match (read (current-buffer))) (unless (widget-apply widget :match (read (current-buffer)))
(widget-put widget :error (widget-get widget :type-error)) (setq err (widget-get widget :type-error))))
widget) (if (and (not (eobp))
(widget-put widget (not err))
:error (format "Junk at end of expression: %s" (setq err (format "Junk at end of expression: %s"
(buffer-substring (point) (buffer-substring (point)
(point-max)))) (point-max))))))
widget)) (end-of-file ; Avoid confusing error message.
(end-of-file ; Avoid confusing error message. (setq err "Unbalanced sexp"))
(widget-put widget :error "Unbalanced sexp") (error (setq err (error-message-string data))))
widget) (if (not err)
(error (widget-put widget :error (error-message-string data)) nil
widget)))) (widget-put widget :error err)
widget))))
(defvar widget-sexp-prompt-value-history nil (defvar widget-sexp-prompt-value-history nil
"History of input to `widget-sexp-prompt-value'.") "History of input to `widget-sexp-prompt-value'.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment