GNU bug report logs - #73084
[PATCH] Include the variable name in the `setopt` warning

Previous Next

Package: emacs;

Reported by: Okamsn <okamsn <at> protonmail.com>

Date: Sat, 7 Sep 2024 00:24:01 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Philip Kaludercic <philipk <at> posteo.net>
To: Okamsn <okamsn <at> protonmail.com>
Cc: 73084 <at> debbugs.gnu.org
Subject: bug#73084: [PATCH] Include the variable name in the `setopt` warning
Date: Sat, 07 Sep 2024 12:36:05 +0000
Okamsn <okamsn <at> protonmail.com> writes:

> 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.

I think this is a good idea!  What might also be useful would be to
generate line warnings, as the backtrace should have the necessary
information.

> Thank you.
>
> From 7cc7134b1b751428b7c14a0b54f55193a59363b1 Mon Sep 17 00:00:00 2001
> From: Earl Hyatt <okamsn <at> protonmail.com>
> 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))

-- 
	Philip Kaludercic on siskin




This bug report was last modified 255 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.