all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tim Landscheidt <tim@tim-landscheidt.de>
To: 30101@debbugs.gnu.org
Subject: bug#30101: 25.3; defcustom does not clear old :options when reevaluated
Date: Sat, 13 Jan 2018 22:14:50 +0000	[thread overview]
Message-ID: <87y3l1l82t.fsf@passepartout.tim-landscheidt.de> (raw)

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





             reply	other threads:[~2018-01-13 22:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-13 22:14 Tim Landscheidt [this message]
2018-01-14 20:32 ` bug#30101: 25.3; defcustom does not clear old :options when reevaluated Tim Landscheidt
2018-01-15  5:16   ` Eli Zaretskii
2020-08-29 15:11 ` Mauro Aranda
2020-08-29 15:41   ` Eli Zaretskii
2020-08-29 16:17     ` Mauro Aranda
2020-09-01 15:00       ` Lars Ingebrigtsen
2020-09-01 20:23         ` Mauro Aranda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y3l1l82t.fsf@passepartout.tim-landscheidt.de \
    --to=tim@tim-landscheidt.de \
    --cc=30101@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.