bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23926: defcustom with STANDARD=<non-constant-expression> gives confu


From: Mauro Aranda
Subject: bug#23926: defcustom with STANDARD=<non-constant-expression> gives confusing results
Date: Tue, 17 Oct 2023 11:19:25 -0300
User-agent: Mozilla Thunderbird

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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]