GNU bug report logs - #30101
25.3; defcustom does not clear old :options when reevaluated

Previous Next

Package: emacs;

Reported by: Tim Landscheidt <tim <at> tim-landscheidt.de>

Date: Sat, 13 Jan 2018 22:16:02 UTC

Severity: minor

Tags: fixed

Found in version 25.3

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: Tim Landscheidt <tim <at> tim-landscheidt.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.3; defcustom does not clear old :options when reevaluated
Date: Sat, 13 Jan 2018 22:14:50 +0000
If one evaluates first:

| (defcustom tmp-test-variable2 nil
|   "A vowel."
|   :type 'alist
|   :options '("A" "F" "I" "O" "U"))

and then changes "F" to "E" and evaluates:

| (defcustom tmp-test-variable2 nil
|   "A vowel."
|   :type 'alist
|   :options '("A" "E" "I" "O" "U"))

the resulting customization page looks like:

| Hide Tmp Test Variable2:
| [ ] Key: E
|     Value: nil
| [ ] Key: A
|     Value: nil
| [ ] Key: F
|     Value: nil
| [ ] Key: I
|     Value: nil
| [ ] Key: O
|     Value: nil
| [ ] Key: U
|     Value: nil
| INS
|     State : STANDARD.
|    A vowel.
| Groups: Nil

i. e., it is the superset of the :options of the two calls.
This is unexpected and undocumented.

AFAICT, this behaviour stems from lisp/custom.el's:

| […]
|                 ((eq keyword :options)
|                  (if (get symbol 'custom-options)
|                      ;; Slow safe code to avoid duplicates.
|                      (mapc (lambda (option)
|                              (custom-add-option symbol option))
|                            value)
|                    ;; Fast code for the common case.
|                    (put symbol 'custom-options (copy-sequence value))))
| […]

which has not been substantially touched since the initial
revision (d543e20b611fc289b174aa82cab940d873a586ff).

Is there any harm in always putting the copied sequence un-
conditionally?

(Workaround: (put 'tmp-test-variable2 'custom-options nil).)




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

Previous Next


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