emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2ce0d397b12: Improve diagnostic of type mismatch in 'setopt'


From: Eli Zaretskii
Subject: master 2ce0d397b12: Improve diagnostic of type mismatch in 'setopt'
Date: Sun, 8 Sep 2024 02:20:28 -0400 (EDT)

branch: master
commit 2ce0d397b12cafcb3e1ac5630bc3fbca61bd6b87
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Improve diagnostic of type mismatch in 'setopt'
    
    * lisp/cus-edit.el (setopt--set): Name the variable in the warning
    message.  (Bug#73084)
    
    * test/lisp/cus-edit-tests.el (test-setopt): Adjust test.
---
 lisp/cus-edit.el            | 3 ++-
 test/lisp/cus-edit-tests.el | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 9f5ac47490c..3ab5f11532e 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -1072,7 +1072,8 @@ plain variables.  This means that `setopt' will execute 
any
   ;; Check that the type is correct.
   (when-let ((type (get variable 'custom-type)))
     (unless (widget-apply (widget-convert type) :match value)
-      (warn "Value `%S' does not match type %s" value type)))
+      (warn "Value `%S' for variable `%s' does not match its type \"%s\""
+            value variable type)))
   (put variable 'custom-check-value (list value))
   (funcall (or (get variable 'custom-set) #'set-default) variable value))
 
diff --git a/test/lisp/cus-edit-tests.el b/test/lisp/cus-edit-tests.el
index 535711e02cf..ecef4c35b47 100644
--- a/test/lisp/cus-edit-tests.el
+++ b/test/lisp/cus-edit-tests.el
@@ -90,7 +90,7 @@
               (erase-buffer))
             (setopt cus-edit-test-foo1 :foo)
             (buffer-substring-no-properties (point-min) (point-max)))))
-    (should (string-search "Value `:foo' does not match type number"
+    (should (string-search "Value `:foo' for variable `cus-edit-test-foo1' 
does not match its type \"number\""
                            warn-txt))))
 
 (defcustom cus-edit-test-bug63290-option nil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]