GNU bug report logs - #23975
25.0.94: defcustom error message is wrong when :type field has a :match attribute

Previous Next

Package: emacs;

Reported by: rswgnu <at> gmail.com

Date: Wed, 13 Jul 2016 20:05:02 UTC

Severity: minor

Tags: fixed

Found in version 25.0.94

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Robert Weiner <rsw <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.94: defcustom error message is wrong when :type field has a
 :match attribute
Date: Wed, 13 Jul 2016 16:03:28 -0400
Given a defcustom like:

(defcustom bounded-num 999
  "Positive, bounded number"
  :type '(integer :match (lambda (widget value) (and (integerp value)
(> value 0)
      (< value 1000)))))

When this variable is customized and a value of -5 is entered, the
match function fails
and the error signaled is:

  (error "This field should contain an integer")

which is wrong and not helpful.  Instead the error should display what
the match function is and that the value failed to match.

Secondarily, it would be nice if the type were checked before the match
function were applied so that one did not need to add the (integerp
value) test into the match function.

Bob

In GNU Emacs 25.0.94.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21
Version 10.9.5 (Build 13F1603))
 of 2016-05-17 built on builder10-9.local
Windowing system distributor 'Apple', version 10.3.1404
Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp''

Configured features:
NOTIFY ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Custom




This bug report was last modified 4 years and 339 days ago.

Previous Next


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