unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: ofv@wanadoo.es, 38143@debbugs.gnu.org
Subject: bug#38143: 27.0.50; Say that before-make-frame-hook & after-make-frame-functions are not invoked for the initial frame
Date: Sun, 05 Dec 2021 11:47:00 +0200	[thread overview]
Message-ID: <83bl1v4c4r.fsf@gnu.org> (raw)
In-Reply-To: <87ee6ru4l4.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun,  05 Dec 2021 04:13:11 +0100)

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Eli Zaretskii <eliz@gnu.org>,  martin rudalics <rudalics@gmx.at>,
>   38143@debbugs.gnu.org
> Date: Sun, 05 Dec 2021 04:13:11 +0100
> 
> Óscar Fuentes <ofv@wanadoo.es> writes:
> 
> > 1. The hooks are not run for the initial frame because it is not created
> >    with `make-frame'.
> >
> > 2. Except when Emacs runs as daemon, in that case make-frame is always
> >    used and therefore the hooks are executed.
> >
> > The added text would be something like this:
> >
> >   When Emacs is not executed as a daemon, `make-frame` is not used for
> >   creating the initial frame, therefore the hooks are not invoked on
> >   that case.
> >
> > Or this:
> >
> >   `make-frame` is not used for the frame that is automatically created
> >   before the init file is processed, therefore the hooks are not invoked
> >   for that frame. Please note that when Emacs is executed as a daemon
> >   there is no such frame.
> 
> I've now added something like this to Emacs 29.

Bother:

   (defvar before-make-frame-hook nil
  -  "Functions to run before `make-frame' creates a new frame.")
  +  "Functions to run before `make-frame' creates a new frame.
  +Note that these functions are usually not run for the initial
  +frame, except when the initial frame is created from an Emacs
  +daemon.")

   (defvar after-make-frame-functions nil
     "Functions to run after `make-frame' created a new frame.
   The functions are run with one argument, the newly created
  -frame.")
  +frame.
  +
  +Note that these functions are usually not run for the initial
  +frame, except when the initial frame is created from an Emacs
  +daemon.")

The new text is incorrect -- assuming that by "initial frame" the doc
strings mean what we usually mean by that: the first frame displayed
by a GUI Emacs session (see "Frame Parameters" in the user manual, and
cf. initial-frame-alist).  You can put a breakpoint on Frun_hooks and
on Frun_hook_with_args, run Emacs, and see that both of these hooks
_are_ called during startup.  And the reason is simple: we do create
that "initial frame" via make-frame, see frame-initialize.

Perhaps the bug report was using "initial frame" in another sense: to
allude to the frame we create in temacs, which is a terminal frame,
normally deleted when a GUI session starts, except in a daemon, which
keeps it.  But in that case, these changes will confuse the heck out
of the users who will read them and try to figure out how to use this
information.  We should in that case explain in the doc strings which
"initial frame" we allude to here.





  reply	other threads:[~2021-12-05  9:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-09  3:18 bug#38143: 27.0.50; Say that before-make-frame-hook & after-make-frame-functions are not invoked for the initial frame Óscar Fuentes
2019-11-09  9:01 ` martin rudalics
2019-11-09  9:27   ` Eli Zaretskii
2019-11-09 17:21     ` Óscar Fuentes
2021-12-05  3:13       ` Lars Ingebrigtsen
2021-12-05  9:47         ` Eli Zaretskii [this message]
2021-12-05 20:17           ` Lars Ingebrigtsen
2021-12-05 20:21             ` Eli Zaretskii
2021-12-06 23:22             ` Óscar Fuentes
2021-12-07 17:58               ` Eli Zaretskii
2019-11-10  9:45     ` martin rudalics
2019-11-14  9:46       ` Eli Zaretskii
2019-11-14  9:59         ` martin rudalics

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83bl1v4c4r.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=38143@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=ofv@wanadoo.es \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).