Subject: bug#73084: closed (Re: bug#73084: [PATCH] Include the variable name in the `setopt` warning)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 08 Sep 2024 06:23:02 +0000

Your bug report

#73084: [PATCH] Include the variable name in the `setopt` warning

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
73084: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73084
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#73084: [PATCH] Include the variable name in the `setopt` warning
From: Eli Zaretskii <[email-masked]>
To: Okamsn <[email-masked]>
Cc: [email-masked]
Date: Sun, 08 Sep 2024 09:21:59 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Sat, 07 Sep 2024 00:23:00 +0000
> From:  Okamsn via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> The attached patch adds the variable name to the `setopt` warning.
> 
> I write my Emacs config in an Org file, from which I make the Emacs Lisp 
> file.  Currently, if `setopt` detects that the value I wish to make a 
> variable hold does not conform to the variable's Custom.el type, then it 
> reports the type and the problematic value, but not the variable itself, 
> when I open Emacs.  This adds extra steps to editing the code in the Org 
> file to fix the warning, especially when the value is created 
> programmatically.  It would be faster to search for the variable name 
> directly in the Org file and to then re-tangle the Org file.

Thanks, I made the warning say

  Value `foo' for variable `bar' does not match its type "type"

I installed this on the master branch, and I'm therefore closing this
bug.

Subject: [PATCH] Include the variable name in the `setopt` warning
From: Okamsn <[email-masked]>
To: [email-masked]
Date: Sat, 07 Sep 2024 00:23:00 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello,

The attached patch adds the variable name to the `setopt` warning.

I write my Emacs config in an Org file, from which I make the Emacs Lisp 
file.  Currently, if `setopt` detects that the value I wish to make a 
variable hold does not conform to the variable's Custom.el type, then it 
reports the type and the problematic value, but not the variable itself, 
when I open Emacs.  This adds extra steps to editing the code in the Org 
file to fix the warning, especially when the value is created 
programmatically.  It would be faster to search for the variable name 
directly in the Org file and to then re-tangle the Org file.

Thank you.

From 7cc7134b1b751428b7c14a0b54f55193a59363b1 Mon Sep 17 00:00:00 2001
From: Earl Hyatt <[email-masked]>
Date: Fri, 6 Sep 2024 20:04:24 -0400
Subject: [PATCH] Include the variable name in the warning in `setopt--set'.

Including the variable name makes it easier to find the location of the
error.

* lisp/cus-edit.el (setopt--set): Include the variable name in the
warning.
---
 lisp/cus-edit.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 9f5ac47490c..035499deb71 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -1072,7 +1072,7 @@ setopt--set
   ;; 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 "`%s': Value `%S' does not match type %s" variable value type)))
   (put variable 'custom-check-value (list value))
   (funcall (or (get variable 'custom-set) #'set-default) variable value))
 
-- 
2.34.1