From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Eli Zaretskii <eliz@gnu.org>
Newsgroups: gmane.emacs.bugs
Subject: bug#66742: 30.0.50;
 transient-mark-mode is not enabled after re-dumping Emacs
Date: Thu, 26 Oct 2023 15:06:31 +0300
Message-ID: <837cn9h9ko.fsf@gnu.org>
References: <8734xz2guk.fsf@localhost> <m2msw53fzp.fsf@Pro.fritz.box>
 <874jidd2ym.fsf@localhost>
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="11572"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: gerd.moellmann@gmail.com, 66742@debbugs.gnu.org
To: Ihor Radchenko <yantar92@posteo.net>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 26 14:07:57 2023
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1qvz9Z-0002lD-Ep
	for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Oct 2023 14:07:57 +0200
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1qvz9B-0002EF-KD; Thu, 26 Oct 2023 08:07:33 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1qvz99-0002DW-LF
 for bug-gnu-emacs@gnu.org; Thu, 26 Oct 2023 08:07:31 -0400
Original-Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1qvz99-0001eP-AU
 for bug-gnu-emacs@gnu.org; Thu, 26 Oct 2023 08:07:31 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1qvz9d-0005Yp-LT
 for bug-gnu-emacs@gnu.org; Thu, 26 Oct 2023 08:08:01 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Eli Zaretskii <eliz@gnu.org>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Thu, 26 Oct 2023 12:08:01 +0000
Resent-Message-ID: <handler.66742.B66742.169832203221312@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 66742
X-GNU-PR-Package: emacs
Original-Received: via spool by 66742-submit@debbugs.gnu.org id=B66742.169832203221312
 (code B ref 66742); Thu, 26 Oct 2023 12:08:01 +0000
Original-Received: (at 66742) by debbugs.gnu.org; 26 Oct 2023 12:07:12 +0000
Original-Received: from localhost ([127.0.0.1]:60724 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1qvz8n-0005Xd-V7
 for submit@debbugs.gnu.org; Thu, 26 Oct 2023 08:07:12 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44252)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@gnu.org>) id 1qvz8i-0005X3-J3
 for 66742@debbugs.gnu.org; Thu, 26 Oct 2023 08:07:08 -0400
Original-Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@gnu.org>)
 id 1qvz83-0000z7-JF; Thu, 26 Oct 2023 08:06:27 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=fQkBnblPxGhtQtN1CnOzuzxj7ttmQfFRmyXAcdpey2k=; b=sAkshkU4SLCP
 GbQCXMieqOSyeQUHJz3/VfA/B/1lorG/uYZoCww4KsluB5zesxSqaEVrKoZSvuWyJZzpD2dIJjTdK
 miPqlj1+g1jxsg07wqQ+8iUh8InRxXkKf/1Gb9zaN3k2zdzvDXQbfmfDn3vinq/BWwh6yJTis2+L/
 mCR2Zr3e0aE20U3ELzAdocVI4K/8F/CabhLbDIbDCENZyEaryEecR7ZDn4VCaOS6b9MuFAFX1SnXo
 ejPbNhqAc41n3x9d/QK6cU1redkPEYbQ0SWywOnWED9Dkb5l2B/PmxFje9wbpfVq/nZmeUKWYjgg/
 OzZuRQnYhwyMpYJwcvXq2g==;
In-Reply-To: <874jidd2ym.fsf@localhost> (message from Ihor Radchenko on Thu,
 26 Oct 2023 11:42:57 +0000)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:273268
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/273268>

> Cc: 66742@debbugs.gnu.org
> From: Ihor Radchenko <yantar92@posteo.net>
> Date: Thu, 26 Oct 2023 11:42:57 +0000
> 
> Actually, I think that I will not be wrong to say that (defvar foo
> <value>. ..), (defcustom foo <value> ...), and similar expressions are
> often assumed to evaluated in the same Emacs session that will use the
> library.

There should be no such assumption, and so you will be wrong saying
that.  We actually try paying attention to this aspect when reviewing
patches where a defcustom has a default value that is not a constant,
precisely for this reason.

> For example, Org mode often calculated default variable values
> dynamically:
> 
> (defcustom org-clock-x11idle-program-name
>   (if (executable-find "xprintidle")
>       "xprintidle" "x11idle")
> ...)

That's a bug in Org, unless the rest of the code doesn't arrange for
this defcustom to be re-evaluated at startup.

> Things get worse when loading a library relies on side effects:
> 
> ----- org-persist.el ---------
> ;; Point to temp directory when `org-persist--disable-when-emacs-Q' is set.
> (when (and org-persist--disable-when-emacs-Q
>            ;; FIXME: This is relying on undocumented fact that
>            ;; Emacs sets `user-init-file' to nil when loaded with
>            ;; "-Q" argument.
>            (not user-init-file))
>   (setq org-persist-directory
>         (make-temp-file "org-persist-" 'dir)))
> ----------------------------

Which library does the above load, and how is it related to something
determined at dump time?

> I suspect that it is only truly safe to re-dump parts of the libraries
> that do not emit (byte-code ...) in the compiler output.
> 
> For example, the following is .elc part corresponding to the above
> defcustom:
> 
> (defvar org-x11idle-exists-p (byte-code "\302>?\205%17\303\304\305	\"!\306=\205%17\303	!\306=\207" [system-type org-clock-x11idle-program-name (windows-nt ms-dos) call-process-shell-command format "command -v %s" 0] 4))#@46 Return the current X11 idle time in seconds.
> 
> The variable itself can be defined, but its value is (byte-code ...) and
> thus should be evaluated during startup, and not dumped.
> 
> And the side-effect clause is a complete (byte-code ...):
> 
> (byte-code "\203%d	\204%d\303\304\305\"%12\306\307\n!!\310%1!\204%%0\211\306\311%3!!\211\262%3\232\203%12\312%1!\2044%0\313\314\n\"\266%2\202D%0\315\316\317\"\210\315\316\320\"\210\315\316\321\"\266%2\315\322\323\"\210\324\325!\207" [org-persist--disable-when-emacs-Q user-init-file org-persist-directory make-temp-file "org-persist-" dir directory-file-name file-name-as-directory file-exists-p file-name-directory file-writable-p message "Missing write access rights to org-persist-directory: %S" add-hook kill-emacs-hook org-persist-clear-storage-maybe org-persist-write-all org-persist-gc after-init-hook org-persist-load-all provide org-persist] 5)

You lost me here.