GNU bug report logs - #30994
27.0.50; Cursor doesn't blink (X window system)

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Fri, 30 Mar 2018 03:32:01 UTC

Severity: normal

Merged with 45857

Found in versions 27.0.50, 28.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 30994 in the body.
You can then email your comments to 30994 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Fri, 30 Mar 2018 03:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Heerdegen <michael_heerdegen <at> web.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 30 Mar 2018 03:32:02 GMT) Full text and rfc822 format available.

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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; Cursor doesn't blink (X window system)
Date: Fri, 30 Mar 2018 05:31:20 +0200
[Message part 1 (text/plain, inline)]
Hello,

I start emacs -Q (under openbox in X on Debian if it matters), and I get
an Emacs where the cursor doesn't blink.  Thankfully only on master but
not with an emacs-26 build.

The problem is simply that `blink-cursor-mode' is not turned on when
starting, but I can successfully enable it.

The reason is that at the moment the :init-value expression of
`blink-cursor-mode' is evaluated, `window-system' is bound to nil,
i.e. when installing the following:

[0001-WIP-test-no-blinking-cursor.patch (text/x-diff, inline)]
From befd2667396125748d6e9e0e15c5fc38f7846082 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen <at> web.de>
Date: Fri, 30 Mar 2018 04:25:00 +0200
Subject: [PATCH] WIP: test no-blinking-cursor

---
 lisp/frame.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/frame.el b/lisp/frame.el
index fbf2f6e773..b07e2800ba 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2357,10 +2357,12 @@ blink-cursor-mode
 
 This command is effective only on graphical frames.  On text-only
 terminals, cursor blinking is controlled by the terminal."
-  :init-value (not (or noninteractive
-		       no-blinking-cursor
-		       (eq system-type 'ms-dos)
-		       (not (memq window-system '(x w32 ns)))))
+  :init-value (progn
+                (message "window-system: %S" window-system)
+                (not (or noninteractive
+		         no-blinking-cursor
+		         (eq system-type 'ms-dos)
+                         (not (memq window-system '(x w32 ns))))))
   :initialize 'custom-initialize-delay
   :group 'cursor
   :global t
-- 
2.16.2

[Message part 3 (text/plain, inline)]
I get a *Messages* buffer like

| window-system: nil
| For information about GNU Emacs and the GNU system, type C-h C-a.

After starting up,

window-system
   ==> x

as expected.


Thanks,

Michael.


In GNU Emacs 27.0.50 (build 5, x86_64-pc-linux-gnu, GTK+ Version 3.22.29)
 of 2018-03-30 built on drachen
Repository revision: befd2667396125748d6e9e0e15c5fc38f7846082
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Debian GNU/Linux buster/sid


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Fri, 30 Mar 2018 05:06:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 30994 <at> debbugs.gnu.org
Subject: Re: bug#30994: 27.0.50; Cursor doesn't blink (X window system)
Date: Fri, 30 Mar 2018 01:05:12 -0400
I guess (without testing) that this is due to 2db57579b0 moving
custom-reevaluate-setting before the window setup. (I note there's no
blinking in emacs started as --daemon in earlier versions of Emacs for
similar reasons.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Fri, 30 Mar 2018 07:59:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: michael_heerdegen <at> web.de, 30994 <at> debbugs.gnu.org
Subject: Re: bug#30994: 27.0.50; Cursor doesn't blink (X window system)
Date: Fri, 30 Mar 2018 10:58:32 +0300
> From: Glenn Morris <rgm <at> gnu.org>
> Date: Fri, 30 Mar 2018 01:05:12 -0400
> Cc: 30994 <at> debbugs.gnu.org
> 
> I guess (without testing) that this is due to 2db57579b0 moving
> custom-reevaluate-setting before the window setup.

Can we fix that by calling custom-reevaluate-setting one more time
after the window setup?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Sat, 31 Mar 2018 01:06:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: michael_heerdegen <at> web.de, 30994 <at> debbugs.gnu.org
Subject: Re: bug#30994: 27.0.50; Cursor doesn't blink (X window system)
Date: Fri, 30 Mar 2018 21:04:33 -0400
Eli Zaretskii wrote:

>> I guess (without testing) that this is due to 2db57579b0 moving
>> custom-reevaluate-setting before the window setup.
>
> Can we fix that by calling custom-reevaluate-setting one more time
> after the window setup?

I don't know. It seems ugly to call it twice, but perhaps it works.

I guess that it would clobber "early init" settings made outside the
customize mechanism, but I haven't looked at how this new init file is
supposed to work.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Sat, 31 Mar 2018 08:07:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: michael_heerdegen <at> web.de, 30994 <at> debbugs.gnu.org
Subject: Re: bug#30994: 27.0.50; Cursor doesn't blink (X window system)
Date: Sat, 31 Mar 2018 11:06:09 +0300
> From: Glenn Morris <rgm <at> gnu.org>
> Cc: michael_heerdegen <at> web.de,  30994 <at> debbugs.gnu.org
> Date: Fri, 30 Mar 2018 21:04:33 -0400
> 
> Eli Zaretskii wrote:
> 
> >> I guess (without testing) that this is due to 2db57579b0 moving
> >> custom-reevaluate-setting before the window setup.
> >
> > Can we fix that by calling custom-reevaluate-setting one more time
> > after the window setup?
> 
> I don't know. It seems ugly to call it twice, but perhaps it works.

We already do such things with other features.  Sometimes it's
necessary.

> I guess that it would clobber "early init" settings made outside the
> customize mechanism, but I haven't looked at how this new init file is
> supposed to work.

Another idea is to define a function that would re-evaluate only
certain specific defcustoms, then add that function to
after-init-hook.  But that is more problematic, because maintaining
the list of defcustoms which need this is a maintenance burden.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Tue, 12 Jun 2018 15:11:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: michael_heerdegen <at> web.de
Cc: 30994 <at> debbugs.gnu.org
Subject: Re: bug#30994: 27.0.50; Cursor doesn't blink (X window system)
Date: Tue, 12 Jun 2018 18:10:01 +0300
See more discussions of this issue in this thread:

  http://lists.gnu.org/archive/html/emacs-devel/2018-06/msg00349.html

I think I fixed the original problem now.  I'm leaving the bug open
because the secondary issue of clobbering user customizations of
variables in the custom-delayed-init-variables list still needs
attention, perhaps some reasonable solution could be found.  For now,
I just added to the docs a warning against moving customizations into
the early init file that don't have to be there.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Sun, 23 Aug 2020 01:25:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: michael_heerdegen <at> web.de, 30994 <at> debbugs.gnu.org
Subject: Re: bug#30994: 27.0.50; Cursor doesn't blink (X window system)
Date: Sat, 22 Aug 2020 21:24:22 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:

> See more discussions of this issue in this thread:
>
>   http://lists.gnu.org/archive/html/emacs-devel/2018-06/msg00349.html
>
> I think I fixed the original problem now.  I'm leaving the bug open
> because the secondary issue of clobbering user customizations of
> variables in the custom-delayed-init-variables list still needs
> attention, perhaps some reasonable solution could be found.  For now,
> I just added to the docs a warning against moving customizations into
> the early init file that don't have to be there.

(That was 2 years ago.)

Has the custom-delayed-init-variables problem discussed here been
solved?

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Sun, 23 Aug 2020 05:54:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: michael_heerdegen <at> web.de, 30994 <at> debbugs.gnu.org
Subject: Re: bug#30994: 27.0.50; Cursor doesn't blink (X window system)
Date: Sun, 23 Aug 2020 08:53:13 +0300
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Sat, 22 Aug 2020 21:24:22 -0400
> Cc: michael_heerdegen <at> web.de, 30994 <at> debbugs.gnu.org
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > See more discussions of this issue in this thread:
> >
> >   http://lists.gnu.org/archive/html/emacs-devel/2018-06/msg00349.html
> >
> > I think I fixed the original problem now.  I'm leaving the bug open
> > because the secondary issue of clobbering user customizations of
> > variables in the custom-delayed-init-variables list still needs
> > attention, perhaps some reasonable solution could be found.  For now,
> > I just added to the docs a warning against moving customizations into
> > the early init file that don't have to be there.
> 
> (That was 2 years ago.)
> 
> Has the custom-delayed-init-variables problem discussed here been
> solved?

I don't think so, but we should probably close this bug anyway, and
leave the rest for another day/bug.

Thanks.




Reply sent to Stefan Kangas <stefan <at> marxist.se>:
You have taken responsibility. (Sun, 23 Aug 2020 12:00:03 GMT) Full text and rfc822 format available.

Notification sent to Michael Heerdegen <michael_heerdegen <at> web.de>:
bug acknowledged by developer. (Sun, 23 Aug 2020 12:00:03 GMT) Full text and rfc822 format available.

Message #31 received at 30994-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: michael_heerdegen <at> web.de, 30994-done <at> debbugs.gnu.org
Subject: Re: bug#30994: 27.0.50; Cursor doesn't blink (X window system)
Date: Sun, 23 Aug 2020 07:59:29 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:

> I don't think so, but we should probably close this bug anyway, and
> leave the rest for another day/bug.

Thanks, I'm therefore closing this bug report.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 21 Sep 2020 11:24:03 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Stefan Monnier <monnier <at> iro.umontreal.ca> to control <at> debbugs.gnu.org. (Thu, 14 Jan 2021 16:55:01 GMT) Full text and rfc822 format available.

Forcibly Merged 30994 45857. Request was from Stefan Monnier <monnier <at> iro.umontreal.ca> to control <at> debbugs.gnu.org. (Thu, 14 Jan 2021 16:55:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Thu, 14 Jan 2021 18:22:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ola x Nilsson <ola.x.nilsson <at> axis.com>
Cc: 45857 <at> debbugs.gnu.org, 30994 <at> debbugs.gnu.org
Subject: Re: 28.0.50; Not possible to set package-user-dir in early-init.el
Date: Thu, 14 Jan 2021 13:20:53 -0500
>> the package-user-dir defcustom gets the custom-initialize-delay
>> intializer.  At least for me, this overrides any setting of
>> package-user-dir that is done in early-init.el.
> Oh, I see you're right, and I think this issue is wider than
> `package-user-dir` since it affects all the other vars that use
> `custom-initialize-delay`.

Back in June 2018, Eli wrote:
> I can see several ways out of this:
> 
>   . Move the call to custom-reevaluate-setting back where it was, and
>     instead call custom-reevaluate-setting in that earlier place only
>     for Info-default-directory-list, which was the original reason why
>     the call was moved;
>   . Add a call to custom-reevaluate-setting for blink-cursor-mode
>     where the window-system is already set up;
>   . Call custom-reevaluate-setting for all the delayed-init variables
>     twice: once where we do that now, and again where we did that
>     before the above commit;
>   . Introduce yet another variable similar to
>     custom-delayed-init-variables, but separate from it, and put on
>     it all the delayed-init variables that need the window-system to
>     be set up, leaving all the rest in custom-delayed-init-variables.

We ended up going with the 3rd option, but this is the source of the
problem here.  I think we should change to option 2 for now and plan on
fixing it for good by removing this exception, i.e. by making
the default value of `blink-cursor-mode` be t.

More concretely, I suggest the patch below,


        Stefan


diff --git a/lisp/startup.el b/lisp/startup.el
index 57fd87f20f..8c9ac4e30f 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1311,12 +1312,13 @@ command-line
     (startup--setup-quote-display)
     (setq internal--text-quoting-flag t))
 
-  ;; Re-evaluate again the predefined variables whose initial value
-  ;; depends on the runtime context, in case some of them depend on
-  ;; the window-system features.  Example: blink-cursor-mode.
-  (let (current-load-list) ; c-r-s may call defvar, and hence LOADHIST_ATTACH
-    (mapc 'custom-reevaluate-setting custom-delayed-init-variables)
-    (setq custom-delayed-init-variables nil))
+  ;; Some vars's initialization need to be delayed yet further, until
+  ;; after we setup the real initial frame, because their initial
+  ;; value depends on the window-system features.
+  ;; Currently, the only such var is `blink-cursor-mode'.  See bug#30994.
+  ;; FIXME: We should arrange for `blink-cursor-mode's default to be
+  ;; unconditionally `t' so as to finally eliminate this problem.
+  (custom-reevaluate-setting 'blink-cursor-mode)
 
   (normal-erase-is-backspace-setup-frame)
 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Thu, 14 Jan 2021 18:42:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: ola.x.nilsson <at> axis.com, 45857 <at> debbugs.gnu.org, 30994 <at> debbugs.gnu.org
Subject: Re: bug#45857: 28.0.50;
 Not possible to set package-user-dir in early-init.el
Date: Thu, 14 Jan 2021 20:40:45 +0200
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Date: Thu, 14 Jan 2021 13:20:53 -0500
> Cc: 45857 <at> debbugs.gnu.org, 30994 <at> debbugs.gnu.org
> 
> >> the package-user-dir defcustom gets the custom-initialize-delay
> >> intializer.  At least for me, this overrides any setting of
> >> package-user-dir that is done in early-init.el.
> > Oh, I see you're right, and I think this issue is wider than
> > `package-user-dir` since it affects all the other vars that use
> > `custom-initialize-delay`.
> 
> Back in June 2018, Eli wrote:
> > I can see several ways out of this:
> > 
> >   . Move the call to custom-reevaluate-setting back where it was, and
> >     instead call custom-reevaluate-setting in that earlier place only
> >     for Info-default-directory-list, which was the original reason why
> >     the call was moved;
> >   . Add a call to custom-reevaluate-setting for blink-cursor-mode
> >     where the window-system is already set up;
> >   . Call custom-reevaluate-setting for all the delayed-init variables
> >     twice: once where we do that now, and again where we did that
> >     before the above commit;
> >   . Introduce yet another variable similar to
> >     custom-delayed-init-variables, but separate from it, and put on
> >     it all the delayed-init variables that need the window-system to
> >     be set up, leaving all the rest in custom-delayed-init-variables.
> 
> We ended up going with the 3rd option, but this is the source of the
> problem here.  I think we should change to option 2 for now and plan on
> fixing it for good by removing this exception, i.e. by making
> the default value of `blink-cursor-mode` be t.
> 
> More concretely, I suggest the patch below,

Is there any place where all these complications are described, so
that people (and we ourselves) could have a complete, comprehensive
overview of this stuff and the various problems it needs to solve?  If
not, how about taking this opportunity to describe that?  Because
otherwise these incidents will keep happening.

FWIW, I'm not sure I have a good understand how is this old issue
related to the new one.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Thu, 14 Jan 2021 19:33:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: ola.x.nilsson <at> axis.com, 45857 <at> debbugs.gnu.org, 30994 <at> debbugs.gnu.org
Subject: Re: bug#45857: 28.0.50; Not possible to set package-user-dir in
 early-init.el
Date: Thu, 14 Jan 2021 14:32:13 -0500
> Is there any place where all these complications are described, so
> that people (and we ourselves) could have a complete, comprehensive
> overview of this stuff and the various problems it needs to solve?  If
> not, how about taking this opportunity to describe that?  Because
> otherwise these incidents will keep happening.

Here's the story:

We have a few variables which are predefined in the dumped Emacs but
whose default value depends on information only available when Emacs is
executed, such as the user's $HOME.

We handle those using `custom-initialize-delayed`, so when the
variable's `defcustom` is procesed the variable isn't initialized yet,
and instead initialization happens in `startup.el` by calling
`custom-reevaluate-setting` on each one of those delayed variables.

In Emacs-26, we did that just before loading the `.emacs` file and
everybody was happy.  But the `early-init.el` file added to Emacs-27
introduced a difficulty there:

- Those vars's values might be needed in `early-init.el` so we should
  call `custom-reevaluate-setting` before we load `early-init.el`.

- The value of `blink-cursor-mode` depends on whether window-system is
  nil or not, which is only known after loading `early-init.el`, so we
  should call `custom-reevaluate-setting` after we load `early-init.el`.

Currently we solve this by calling `custom-reevaluate-setting` twice for
every one of those variables.  But it means that we silently override
any change made to those variables from `early-init.el`.

As noted, the only var whose default value needs to be (re)computed
after loading `early-init.el` is `blink-cursor-mode`.  In theory there
could be more, but I think we should aim to reduce rather than increase
those cases.  E.g. the current way `blink-cursor-mode` is defined means
that if I start `emacs -Q -nw` and later create a GUI frame, that frame
won't have a blinking cursor.  I think this is a bug (tho I can see
that some people may consider it a feature if they (like me) dislike
blinking cursors ;-0)


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Thu, 14 Jan 2021 20:42:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: ola.x.nilsson <at> axis.com, 45857 <at> debbugs.gnu.org, 30994 <at> debbugs.gnu.org
Subject: Re: bug#45857: 28.0.50; Not possible to set package-user-dir in
 early-init.el
Date: Thu, 14 Jan 2021 22:41:22 +0200
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: ola.x.nilsson <at> axis.com,  45857 <at> debbugs.gnu.org,  30994 <at> debbugs.gnu.org
> Date: Thu, 14 Jan 2021 14:32:13 -0500
> 
> > Is there any place where all these complications are described, so
> > that people (and we ourselves) could have a complete, comprehensive
> > overview of this stuff and the various problems it needs to solve?  If
> > not, how about taking this opportunity to describe that?  Because
> > otherwise these incidents will keep happening.
> 
> Here's the story:

Thanks, I actually meant to have that in the sources in some prominent
place.

> Currently we solve this by calling `custom-reevaluate-setting` twice for
> every one of those variables.  But it means that we silently override
> any change made to those variables from `early-init.el`.
> 
> As noted, the only var whose default value needs to be (re)computed
> after loading `early-init.el` is `blink-cursor-mode`.  In theory there
> could be more, but I think we should aim to reduce rather than increase
> those cases.

I think relying on a small number of such variables is not
future-proof enough.  This case is a living proof: we decided
something 2 years ago, but changes we did since then require us now to
change that decision, which means we risk bumping into issues which we
wanted to avoid back then.  That's a general problem with kludgey
solutions.

I think we need some new infrastructure that would support the two
init files that are loaded in different stages of startup.

Basically, some variables can only be usefully initialized after some
part(s) of startup have happened already.  One way of dealing with
this is to have the variables record this information (e.g., in a
plist of their symbol) that would allow us evaluate each variable only
once, at the earliest opportunity where the prerequisites are
fulfilled.

> E.g. the current way `blink-cursor-mode` is defined means that if I
> start `emacs -Q -nw` and later create a GUI frame, that frame won't
> have a blinking cursor.  I think this is a bug (tho I can see that
> some people may consider it a feature if they (like me) dislike
> blinking cursors ;-0)

I think that's a separate issue.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Thu, 14 Jan 2021 21:03:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: ola.x.nilsson <at> axis.com, 45857 <at> debbugs.gnu.org, 30994 <at> debbugs.gnu.org
Subject: Re: bug#45857: 28.0.50; Not possible to set package-user-dir in
 early-init.el
Date: Thu, 14 Jan 2021 16:02:30 -0500
> Thanks, I actually meant to have that in the sources in some prominent
> place.

Ah, OK, I'll do that.

>> Currently we solve this by calling `custom-reevaluate-setting` twice for
>> every one of those variables.  But it means that we silently override
>> any change made to those variables from `early-init.el`.
>> 
>> As noted, the only var whose default value needs to be (re)computed
>> after loading `early-init.el` is `blink-cursor-mode`.  In theory there
>> could be more, but I think we should aim to reduce rather than increase
>> those cases.
>
> I think relying on a small number of such variables is not
> future-proof enough.  This case is a living proof: we decided
> something 2 years ago, but changes we did since then require us now to
> change that decision, which means we risk bumping into issues which we
> wanted to avoid back then.  That's a general problem with kludgey
> solutions.

Indeed.  Other than eliminate the `blink-cursor-mode` special case,
I can't see how to make it less kludgey.

> I think we need some new infrastructure that would support the two
> init files that are loaded in different stages of startup.
>
> Basically, some variables can only be usefully initialized after some
> part(s) of startup have happened already.  One way of dealing with
> this is to have the variables record this information (e.g., in a
> plist of their symbol) that would allow us evaluate each variable only
> once, at the earliest opportunity where the prerequisites are
> fulfilled.

In theory I would agree, but:
- We don't have any such system to record dependencies, so we'd have to
  design and implement it.  A minimal version would simply duplicate
  `customize-initialize-delayed` into two different options depending on
  the stage at which we should initialize it, but that'd still be pretty
  ad-hoc.
- The only need for this complexity is `blink-cursor-mode` and it's only
  needed because we currently handle `blink-cursor-mode` incorrectly.
  So, I'd rather fix the bug and avoid the complexity.

>> E.g. the current way `blink-cursor-mode` is defined means that if I
>> start `emacs -Q -nw` and later create a GUI frame, that frame won't
>> have a blinking cursor.  I think this is a bug (tho I can see that
>> some people may consider it a feature if they (like me) dislike
>> blinking cursors ;-0)
> I think that's a separate issue.

Agreed, which is why the patch I propose keeps this for later.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Fri, 15 Jan 2021 07:53:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: ola.x.nilsson <at> axis.com, 45857 <at> debbugs.gnu.org, 30994 <at> debbugs.gnu.org
Subject: Re: bug#45857: 28.0.50; Not possible to set package-user-dir in
 early-init.el
Date: Fri, 15 Jan 2021 09:52:12 +0200
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: ola.x.nilsson <at> axis.com,  45857 <at> debbugs.gnu.org,  30994 <at> debbugs.gnu.org
> Date: Thu, 14 Jan 2021 16:02:30 -0500
> 
> > I think relying on a small number of such variables is not
> > future-proof enough.  This case is a living proof: we decided
> > something 2 years ago, but changes we did since then require us now to
> > change that decision, which means we risk bumping into issues which we
> > wanted to avoid back then.  That's a general problem with kludgey
> > solutions.
> 
> Indeed.  Other than eliminate the `blink-cursor-mode` special case,
> I can't see how to make it less kludgey.

But that's still the same kludge: we will rely on the fact that there
are currently no (i.e. zero, a.k.a. "a small number") of such
variables.

> > Basically, some variables can only be usefully initialized after some
> > part(s) of startup have happened already.  One way of dealing with
> > this is to have the variables record this information (e.g., in a
> > plist of their symbol) that would allow us evaluate each variable only
> > once, at the earliest opportunity where the prerequisites are
> > fulfilled.
> 
> In theory I would agree, but:
> - We don't have any such system to record dependencies, so we'd have to
>   design and implement it.  A minimal version would simply duplicate
>   `customize-initialize-delayed` into two different options depending on
>   the stage at which we should initialize it, but that'd still be pretty
>   ad-hoc.

It isn't ad-hoc, because the stages in the startup process and their
effects are clearly defined and didn't change much for a long time.

> - The only need for this complexity is `blink-cursor-mode` and it's only
>   needed because we currently handle `blink-cursor-mode` incorrectly.
>   So, I'd rather fix the bug and avoid the complexity.

That'd probably work for another couple of years, and then break
again.  The early-init file introduction is letting a genie out of the
bottle: we don't yet know what it will eventually require, but we
already see some serious problems it causes that we need to adapt to.
I say we should get ready for the future now.  Introducing the
infrastructure I mentioned is not a big deal.

I don't want to argue further about this, so if you are still
unconvinced, so be it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Fri, 15 Jan 2021 16:10:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: ola.x.nilsson <at> axis.com, 45857 <at> debbugs.gnu.org, 30994 <at> debbugs.gnu.org
Subject: Re: bug#45857: 28.0.50; Not possible to set package-user-dir in
 early-init.el
Date: Fri, 15 Jan 2021 11:08:52 -0500
> But that's still the same kludge: we will rely on the fact that there
> are currently no (i.e. zero, a.k.a. "a small number") of such
> variables.

I'm hoping that there's a good reason why the one exception we have
suffers from a bug, and for that reason we should resist the temptation
to add more such cases.

>> > Basically, some variables can only be usefully initialized after some
>> > part(s) of startup have happened already.  One way of dealing with
>> > this is to have the variables record this information (e.g., in a
>> > plist of their symbol) that would allow us evaluate each variable only
>> > once, at the earliest opportunity where the prerequisites are
>> > fulfilled.
[...]
> I say we should get ready for the future now.  Introducing the
> infrastructure I mentioned is not a big deal.

Hmm... maybe I misunderstood what you meant by that infrastructure, then.
Could you outline more concretely what it would look like?

Also, would it currently result in a behavior that's different from:

- initialize all delayed vars before early-init
- re-initialize blink-cursor-mode after early-init

?


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Fri, 15 Jan 2021 18:27:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: ola.x.nilsson <at> axis.com, 45857 <at> debbugs.gnu.org, 30994 <at> debbugs.gnu.org
Subject: Re: bug#45857: 28.0.50; Not possible to set package-user-dir in
 early-init.el
Date: Fri, 15 Jan 2021 20:25:49 +0200
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: ola.x.nilsson <at> axis.com,  45857 <at> debbugs.gnu.org,  30994 <at> debbugs.gnu.org
> Date: Fri, 15 Jan 2021 11:08:52 -0500
> 
> >> > Basically, some variables can only be usefully initialized after some
> >> > part(s) of startup have happened already.  One way of dealing with
> >> > this is to have the variables record this information (e.g., in a
> >> > plist of their symbol) that would allow us evaluate each variable only
> >> > once, at the earliest opportunity where the prerequisites are
> >> > fulfilled.
> [...]
> > I say we should get ready for the future now.  Introducing the
> > infrastructure I mentioned is not a big deal.
> 
> Hmm... maybe I misunderstood what you meant by that infrastructure, then.
> Could you outline more concretely what it would look like?

In a nutshell: record the startup phase for each variable in a plits
of its symbol.

> Also, would it currently result in a behavior that's different from:
> 
> - initialize all delayed vars before early-init
> - re-initialize blink-cursor-mode after early-init
> 
> ?

With my proposal, blink-cursor-mode will not be mentioned by name in
any of these places.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Fri, 15 Jan 2021 22:20:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: ola.x.nilsson <at> axis.com, 45857 <at> debbugs.gnu.org, 30994 <at> debbugs.gnu.org
Subject: Re: bug#45857: 28.0.50; Not possible to set package-user-dir in
 early-init.el
Date: Fri, 15 Jan 2021 17:19:33 -0500
>> >> > Basically, some variables can only be usefully initialized after some
>> >> > part(s) of startup have happened already.  One way of dealing with
>> >> > this is to have the variables record this information (e.g., in a
>> >> > plist of their symbol) that would allow us evaluate each variable only
>> >> > once, at the earliest opportunity where the prerequisites are
>> >> > fulfilled.
>> [...]
>> > I say we should get ready for the future now.  Introducing the
>> > infrastructure I mentioned is not a big deal.
>> Hmm... maybe I misunderstood what you meant by that infrastructure, then.
>> Could you outline more concretely what it would look like?
> In a nutshell: record the startup phase for each variable in a plits
> of its symbol.

Ah, so instead of just

    :initialize #'custom-initialize-delay

we'd have something like

    :initialize (custom-initialize-delay 'before-early-init)
or
    :initialize (custom-initialize-delay 'after-early-init)

Where `custom-initialize-delay` becomes something like

    (defun custom-initialize-delay (phase)
      (lambda (symbol)
        (push (cons symbol phase) custom-delayed-init-variables)))

depending on when we want the initialization to take place?

>> Also, would it currently result in a behavior that's different from:
>>
>> - initialize all delayed vars before early-init
>> - re-initialize blink-cursor-mode after early-init
>>
>> ?
>
> With my proposal, blink-cursor-mode will not be mentioned by name in
> any of these places.

Yes, of course, but I'm asking whether the resulting *behavior* you're
after is this one.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Sat, 16 Jan 2021 04:53:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: ola.x.nilsson <at> axis.com, 45857 <at> debbugs.gnu.org, 30994 <at> debbugs.gnu.org
Subject: Re: bug#45857: 28.0.50; Not possible to set package-user-dir in
 early-init.el
Date: Fri, 15 Jan 2021 23:52:29 -0500
I looked at the issue of the default value of `blink-cursor-mode` and
it's actually easy to make it be t unconditionally, so as to eliminate
the need to re-evaluate variables after loading `early-init.el`.

Maybe some time in the future this need will re-appear at which point we
may want to introduce some fancier system to control which var is
initialized when, but I think for now the patch below is
a better solution.


        Stefan


2021-01-15  Stefan Monnier  <monnier <at> iro.umontreal.ca>

    * lisp/startup.el: Fix bug#45857, bug#30994, and bug#45913.

    (command-line): Don't re-evaluate the `custom-delayed-init-variables`
    a second time after reading the `early-init.el` file.
    (x-apply-session-resources): Set `blink-cursor-mode` rather than
    `no-blinking-cursor`.

    * lisp/frame.el (blink-cursor-start): Turn `blink-cursor-mode` off
    if `blink-cursor-mode` was set to nil.
    (blink-cursor-mode): Default to it being enabled regardless of
    `window-system`.


diff --git a/lisp/frame.el b/lisp/frame.el
index e2d7f21a49..06aab269dd 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2552,13 +2552,15 @@ blink-cursor-start
 This starts the timer `blink-cursor-timer', which makes the cursor blink
 if appropriate.  It also arranges to cancel that timer when the next
 command starts, by installing a pre-command hook."
-  (when (null blink-cursor-timer)
+  (cond
+   ((null blink-cursor-mode) (blink-cursor-mode -1))
+   ((null blink-cursor-timer)
     ;; Set up the timer first, so that if this signals an error,
     ;; blink-cursor-end is not added to pre-command-hook.
     (setq blink-cursor-blinks-done 1)
     (blink-cursor--start-timer)
     (add-hook 'pre-command-hook #'blink-cursor-end)
-    (internal-show-cursor nil nil)))
+    (internal-show-cursor nil nil))))
 
 (defun blink-cursor-timer-function ()
   "Timer function of timer `blink-cursor-timer'."
@@ -2637,9 +2639,8 @@ blink-cursor-mode
 terminals, cursor blinking is controlled by the terminal."
   :init-value (not (or noninteractive
 		       no-blinking-cursor
-		       (eq system-type 'ms-dos)
-		       (not (display-blink-cursor-p))))
-  :initialize 'custom-initialize-delay
+		       (eq system-type 'ms-dos)))
+  :initialize #'custom-initialize-delay
   :group 'cursor
   :global t
   (blink-cursor-suspend)
diff --git a/lisp/startup.el b/lisp/startup.el
index 552802a38d..7011fbf458 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1172,6 +1172,7 @@ command-line
         ;; are dependencies between them.
         (nreverse custom-delayed-init-variables))
   (mapc #'custom-reevaluate-setting custom-delayed-init-variables)
+  (setq custom-delayed-init-variables nil)
 
   ;; Warn for invalid user name.
   (when init-file-user
@@ -1301,12 +1302,6 @@ command-line
     (startup--setup-quote-display)
     (setq internal--text-quoting-flag t))
 
-  ;; Re-evaluate again the predefined variables whose initial value
-  ;; depends on the runtime context, in case some of them depend on
-  ;; the window-system features.  Example: blink-cursor-mode.
-  (mapc #'custom-reevaluate-setting custom-delayed-init-variables)
-  (setq custom-delayed-init-variables nil)
-
   (normal-erase-is-backspace-setup-frame)
 
   ;; Register default TTY colors for the case the terminal hasn't a
@@ -1487,13 +1482,13 @@ x-apply-session-resources
 opens a graphical frame.
 
 This can set the values of `menu-bar-mode', `tool-bar-mode',
-`tab-bar-mode', and `no-blinking-cursor', as well as the `cursor' face.
+`tab-bar-mode', and `blink-cursor-mode', as well as the `cursor' face.
 Changed settings will be marked as \"CHANGED outside of Customize\"."
   (let ((no-vals  '("no" "off" "false" "0"))
 	(settings '(("menuBar" "MenuBar" menu-bar-mode nil)
 		    ("toolBar" "ToolBar" tool-bar-mode nil)
 		    ("scrollBar" "ScrollBar" scroll-bar-mode nil)
-		    ("cursorBlink" "CursorBlink" no-blinking-cursor t))))
+		    ("cursorBlink" "CursorBlink" blink-cursor-mode nil))))
     (dolist (x settings)
       (if (member (x-get-resource (nth 0 x) (nth 1 x)) no-vals)
 	  (set (nth 2 x) (nth 3 x)))))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Sat, 16 Jan 2021 07:09:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: ola.x.nilsson <at> axis.com, 45857 <at> debbugs.gnu.org, 30994 <at> debbugs.gnu.org
Subject: Re: bug#45857: 28.0.50; Not possible to set package-user-dir in
 early-init.el
Date: Sat, 16 Jan 2021 09:08:12 +0200
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: ola.x.nilsson <at> axis.com,  45857 <at> debbugs.gnu.org,  30994 <at> debbugs.gnu.org
> Date: Fri, 15 Jan 2021 17:19:33 -0500
> 
> > In a nutshell: record the startup phase for each variable in a plits
> > of its symbol.
> 
> Ah, so instead of just
> 
>     :initialize #'custom-initialize-delay
> 
> we'd have something like
> 
>     :initialize (custom-initialize-delay 'before-early-init)
> or
>     :initialize (custom-initialize-delay 'after-early-init)
> 
> Where `custom-initialize-delay` becomes something like
> 
>     (defun custom-initialize-delay (phase)
>       (lambda (symbol)
>         (push (cons symbol phase) custom-delayed-init-variables)))
> 
> depending on when we want the initialization to take place?

Yes, something like that.  Also 'after-init-file, 'after-term-setup,
'after-window-setup -- per the startup phases we already have.

> >> Also, would it currently result in a behavior that's different from:
> >>
> >> - initialize all delayed vars before early-init
> >> - re-initialize blink-cursor-mode after early-init
> >>
> >> ?
> >
> > With my proposal, blink-cursor-mode will not be mentioned by name in
> > any of these places.
> 
> Yes, of course, but I'm asking whether the resulting *behavior* you're
> after is this one.

The current result will be the same, yes.  But I think it's more
future-proof, the only thing that needs to be figured out is the
earliest startup phase after which a given variable needs to be
initialized.




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Tue, 19 Jan 2021 17:13:02 GMT) Full text and rfc822 format available.

Notification sent to Michael Heerdegen <michael_heerdegen <at> web.de>:
bug acknowledged by developer. (Tue, 19 Jan 2021 17:13:02 GMT) Full text and rfc822 format available.

Message #75 received at 30994-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: ola.x.nilsson <at> axis.com, 45913-done <at> debbugs.gnu.org,
 45857-done <at> debbugs.gnu.org, 30994-done <at> debbugs.gnu.org
Subject: Re: bug#45857: 28.0.50; Not possible to set package-user-dir in
 early-init.el
Date: Tue, 19 Jan 2021 12:11:57 -0500
> Maybe some time in the future this need will re-appear at which point we
> may want to introduce some fancier system to control which var is
> initialized when, but I think for now the patch below is
> a better solution.

Pushed,


        Stefan

>
>         Stefan
>
>
> 2021-01-15  Stefan Monnier  <monnier <at> iro.umontreal.ca>
>
>     * lisp/startup.el: Fix bug#45857, bug#30994, and bug#45913.
>
>     (command-line): Don't re-evaluate the `custom-delayed-init-variables`
>     a second time after reading the `early-init.el` file.
>     (x-apply-session-resources): Set `blink-cursor-mode` rather than
>     `no-blinking-cursor`.
>
>     * lisp/frame.el (blink-cursor-start): Turn `blink-cursor-mode` off
>     if `blink-cursor-mode` was set to nil.
>     (blink-cursor-mode): Default to it being enabled regardless of
>     `window-system`.
>
>
> diff --git a/lisp/frame.el b/lisp/frame.el
> index e2d7f21a49..06aab269dd 100644
> --- a/lisp/frame.el
> +++ b/lisp/frame.el
> @@ -2552,13 +2552,15 @@ blink-cursor-start
>  This starts the timer `blink-cursor-timer', which makes the cursor blink
>  if appropriate.  It also arranges to cancel that timer when the next
>  command starts, by installing a pre-command hook."
> -  (when (null blink-cursor-timer)
> +  (cond
> +   ((null blink-cursor-mode) (blink-cursor-mode -1))
> +   ((null blink-cursor-timer)
>      ;; Set up the timer first, so that if this signals an error,
>      ;; blink-cursor-end is not added to pre-command-hook.
>      (setq blink-cursor-blinks-done 1)
>      (blink-cursor--start-timer)
>      (add-hook 'pre-command-hook #'blink-cursor-end)
> -    (internal-show-cursor nil nil)))
> +    (internal-show-cursor nil nil))))
>  
>  (defun blink-cursor-timer-function ()
>    "Timer function of timer `blink-cursor-timer'."
> @@ -2637,9 +2639,8 @@ blink-cursor-mode
>  terminals, cursor blinking is controlled by the terminal."
>    :init-value (not (or noninteractive
>  		       no-blinking-cursor
> -		       (eq system-type 'ms-dos)
> -		       (not (display-blink-cursor-p))))
> -  :initialize 'custom-initialize-delay
> +		       (eq system-type 'ms-dos)))
> +  :initialize #'custom-initialize-delay
>    :group 'cursor
>    :global t
>    (blink-cursor-suspend)
> diff --git a/lisp/startup.el b/lisp/startup.el
> index 552802a38d..7011fbf458 100644
> --- a/lisp/startup.el
> +++ b/lisp/startup.el
> @@ -1172,6 +1172,7 @@ command-line
>          ;; are dependencies between them.
>          (nreverse custom-delayed-init-variables))
>    (mapc #'custom-reevaluate-setting custom-delayed-init-variables)
> +  (setq custom-delayed-init-variables nil)
>  
>    ;; Warn for invalid user name.
>    (when init-file-user
> @@ -1301,12 +1302,6 @@ command-line
>      (startup--setup-quote-display)
>      (setq internal--text-quoting-flag t))
>  
> -  ;; Re-evaluate again the predefined variables whose initial value
> -  ;; depends on the runtime context, in case some of them depend on
> -  ;; the window-system features.  Example: blink-cursor-mode.
> -  (mapc #'custom-reevaluate-setting custom-delayed-init-variables)
> -  (setq custom-delayed-init-variables nil)
> -
>    (normal-erase-is-backspace-setup-frame)
>  
>    ;; Register default TTY colors for the case the terminal hasn't a
> @@ -1487,13 +1482,13 @@ x-apply-session-resources
>  opens a graphical frame.
>  
>  This can set the values of `menu-bar-mode', `tool-bar-mode',
> -`tab-bar-mode', and `no-blinking-cursor', as well as the `cursor' face.
> +`tab-bar-mode', and `blink-cursor-mode', as well as the `cursor' face.
>  Changed settings will be marked as \"CHANGED outside of Customize\"."
>    (let ((no-vals  '("no" "off" "false" "0"))
>  	(settings '(("menuBar" "MenuBar" menu-bar-mode nil)
>  		    ("toolBar" "ToolBar" tool-bar-mode nil)
>  		    ("scrollBar" "ScrollBar" scroll-bar-mode nil)
> -		    ("cursorBlink" "CursorBlink" no-blinking-cursor t))))
> +		    ("cursorBlink" "CursorBlink" blink-cursor-mode nil))))
>      (dolist (x settings)
>        (if (member (x-get-resource (nth 0 x) (nth 1 x)) no-vals)
>  	  (set (nth 2 x) (nth 3 x)))))





Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Tue, 19 Jan 2021 17:13:02 GMT) Full text and rfc822 format available.

Notification sent to Ola x Nilsson <ola.x.nilsson <at> axis.com>:
bug acknowledged by developer. (Tue, 19 Jan 2021 17:13:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30994; Package emacs. (Fri, 22 Jan 2021 16:09:02 GMT) Full text and rfc822 format available.

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

From: Phillip Lord <phillip.lord <at> russet.org.uk>
To: 30994 <at> debbugs.gnu.org
Cc: michael_heerdegen <at> web.de, monnier <at> iro.umontreal.ca
Subject: Re: bug#30994: bug#45857: 28.0.50; Not possible to set
 package-user-dir in early-init.el
Date: Fri, 22 Jan 2021 16:08:27 +0000

I am still getting start up package.el oddities. While I can reset
package-user-dir in early-init.el now and it is correct when init.el
starts up, my package-initialize is raising an error from auctex in my
case.

    Warning (initialization): An error occurred while loading ‘/home/phillord/.emacs.d/init.el’:

    File is missing: Cannot open load file, No such file or directory, tex-site


package-user-dir looks right

    package-user-dir is a variable defined in ‘package.el’.
    Its value is "~/.emacs.d/elpa/28.0"
    Original value was "~/.emacs.d/elpa"

but load-path is not correct, having been set up for the default
location of package-user-dir


load-path is a variable defined in ‘C source code’.
Its value is
("/home/phillord/.emacs.d/elpa/auctex-13.0.3" "/home/phillord/.emacs.d/elpa/cider-1.0.0" "/home/phillord/.emacs.d/elpa/clojure-mode-5.12.0"

.....


Phil



Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> Maybe some time in the future this need will re-appear at which point we
>> may want to introduce some fancier system to control which var is
>> initialized when, but I think for now the patch below is
>> a better solution.
>
> Pushed,
>
>
>         Stefan
>
>>
>>         Stefan
>>
>>
>> 2021-01-15  Stefan Monnier  <monnier <at> iro.umontreal.ca>
>>
>>     * lisp/startup.el: Fix bug#45857, bug#30994, and bug#45913.
>>
>>     (command-line): Don't re-evaluate the `custom-delayed-init-variables`
>>     a second time after reading the `early-init.el` file.
>>     (x-apply-session-resources): Set `blink-cursor-mode` rather than
>>     `no-blinking-cursor`.
>>
>>     * lisp/frame.el (blink-cursor-start): Turn `blink-cursor-mode` off
>>     if `blink-cursor-mode` was set to nil.
>>     (blink-cursor-mode): Default to it being enabled regardless of
>>     `window-system`.
>>
>>
>> diff --git a/lisp/frame.el b/lisp/frame.el
>> index e2d7f21a49..06aab269dd 100644
>> --- a/lisp/frame.el
>> +++ b/lisp/frame.el
>> @@ -2552,13 +2552,15 @@ blink-cursor-start
>>  This starts the timer `blink-cursor-timer', which makes the cursor blink
>>  if appropriate.  It also arranges to cancel that timer when the next
>>  command starts, by installing a pre-command hook."
>> -  (when (null blink-cursor-timer)
>> +  (cond
>> +   ((null blink-cursor-mode) (blink-cursor-mode -1))
>> +   ((null blink-cursor-timer)
>>      ;; Set up the timer first, so that if this signals an error,
>>      ;; blink-cursor-end is not added to pre-command-hook.
>>      (setq blink-cursor-blinks-done 1)
>>      (blink-cursor--start-timer)
>>      (add-hook 'pre-command-hook #'blink-cursor-end)
>> -    (internal-show-cursor nil nil)))
>> +    (internal-show-cursor nil nil))))
>>  
>>  (defun blink-cursor-timer-function ()
>>    "Timer function of timer `blink-cursor-timer'."
>> @@ -2637,9 +2639,8 @@ blink-cursor-mode
>>  terminals, cursor blinking is controlled by the terminal."
>>    :init-value (not (or noninteractive
>>  		       no-blinking-cursor
>> -		       (eq system-type 'ms-dos)
>> -		       (not (display-blink-cursor-p))))
>> -  :initialize 'custom-initialize-delay
>> +		       (eq system-type 'ms-dos)))
>> +  :initialize #'custom-initialize-delay
>>    :group 'cursor
>>    :global t
>>    (blink-cursor-suspend)
>> diff --git a/lisp/startup.el b/lisp/startup.el
>> index 552802a38d..7011fbf458 100644
>> --- a/lisp/startup.el
>> +++ b/lisp/startup.el
>> @@ -1172,6 +1172,7 @@ command-line
>>          ;; are dependencies between them.
>>          (nreverse custom-delayed-init-variables))
>>    (mapc #'custom-reevaluate-setting custom-delayed-init-variables)
>> +  (setq custom-delayed-init-variables nil)
>>  
>>    ;; Warn for invalid user name.
>>    (when init-file-user
>> @@ -1301,12 +1302,6 @@ command-line
>>      (startup--setup-quote-display)
>>      (setq internal--text-quoting-flag t))
>>  
>> -  ;; Re-evaluate again the predefined variables whose initial value
>> -  ;; depends on the runtime context, in case some of them depend on
>> -  ;; the window-system features.  Example: blink-cursor-mode.
>> -  (mapc #'custom-reevaluate-setting custom-delayed-init-variables)
>> -  (setq custom-delayed-init-variables nil)
>> -
>>    (normal-erase-is-backspace-setup-frame)
>>  
>>    ;; Register default TTY colors for the case the terminal hasn't a
>> @@ -1487,13 +1482,13 @@ x-apply-session-resources
>>  opens a graphical frame.
>>  
>>  This can set the values of `menu-bar-mode', `tool-bar-mode',
>> -`tab-bar-mode', and `no-blinking-cursor', as well as the `cursor' face.
>> +`tab-bar-mode', and `blink-cursor-mode', as well as the `cursor' face.
>>  Changed settings will be marked as \"CHANGED outside of Customize\"."
>>    (let ((no-vals  '("no" "off" "false" "0"))
>>  	(settings '(("menuBar" "MenuBar" menu-bar-mode nil)
>>  		    ("toolBar" "ToolBar" tool-bar-mode nil)
>>  		    ("scrollBar" "ScrollBar" scroll-bar-mode nil)
>> -		    ("cursorBlink" "CursorBlink" no-blinking-cursor t))))
>> +		    ("cursorBlink" "CursorBlink" blink-cursor-mode nil))))
>>      (dolist (x settings)
>>        (if (member (x-get-resource (nth 0 x) (nth 1 x)) no-vals)
>>  	  (set (nth 2 x) (nth 3 x)))))




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 20 Feb 2021 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 58 days ago.

Previous Next


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