GNU bug report logs - #23926
defcustom with STANDARD=<non-constant-expression> gives confusing results

Previous Next

Package: emacs;

Reported by: Noam Postavsky <npostavs <at> users.sourceforge.net>

Date: Sat, 9 Jul 2016 03:12:01 UTC

Severity: minor

Full log


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

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: 23926 <at> debbugs.gnu.org
Cc: Eli Zaretskii <eliz <at> gnu.org>, Noam Postavsky <npostavs <at> gmail.com>,
 Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#23926: defcustom with STANDARD=<non-constant-expression>
 gives confusing results
Date: Tue, 17 Oct 2023 11:19:25 -0300
I took a look at this Bug Report and all of the discussion.

I do agree with Eli that passing to default the following
(current-time-string) is quite nonsensical, but I understand that the
reproducer was just to show a way to see some inconsistency happening.

So I set out to look if there are occurrences like that in current Emacs
sources.  And there is one comparable:

(defcustom archive-tmpdir
  ;; make-temp-name is safe here because we use this name
  ;; to create a directory.
  (make-temp-name
   (expand-file-name (if (eq system-type 'ms-dos) "ar" "archive.tmp")
             temporary-file-directory))
  "Directory for temporary files made by `arc-mode.el'."
  :type 'directory)

That expression will evaluate to something different every time.  So, to
see the problems reported here, in actual Emacs source code:
emacs -Q
(require 'arc-mode)
C-h v archive-tmpdir
See that "the original value", as claimed incorrectly by C-h v (I agree
with Drew here about this terminology being non-accurate) is different
from the value of archive-tmpdir.

Kill the *Help* buffer and do again:
C-h v archive-tmpdir
The value of archive-tmpdir is the same, of course, but not "the
original value".

M-x customize-option RET archive-tmpdir
will show, as reported, that archive-tmpdir was changed outside of
Customize.  That's not true, it's just that the standard-value changed,
and there's no support for that.  Those two things are different to me.


I'm not saying that there's need to code something in Custom to handle these
cases.  At least, I'm not yet convinced.  But the case of archive-tmpdir
shows us, I think, that something needs to be done.  For example, change
the standard value to something that doesn't change that often, or
use the exact same form but wrap the defcustom in a let form, so that
a constant expression gets saved as the standard-value.





This bug report was last modified 1 year and 241 days ago.

Previous Next


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