GNU bug report logs - #56400
Make setopt warn on type mismatch

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Tue, 5 Jul 2022 15:33:02 UTC

Severity: wishlist

Tags: moreinfo

Fixed in version 29.1

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 56400 <at> debbugs.gnu.org
Subject: bug#56400: Make setopt warn on type mismatch
Date: Tue, 05 Jul 2022 18:57:17 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> Why not make `setopt' warn in case there is a type mismatch?
> For example, in:
>
>     (setopt tetris-buffer-width "hello")
>
> But the type of `tetris-buffer-width' is natnum.

It should throw an error already:

;;;###autoload
(defun setopt--set (variable value)
  (custom-load-symbol variable)
  ;; Check that the type is correct.
  (when-let ((type (get variable 'custom-type)))
    (unless (widget-apply (widget-convert type) :match value)
      (user-error "Value `%S' does not match type %s" value type)))

Did you mean a byte compilation warning?  I don't really think that
people will be using setopt much in code, just in .emacs, so I'm not
sure that'd give us much.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 2 years and 359 days ago.

Previous Next


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