From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs 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 Message-ID: <83bl1v4c4r.fsf@gnu.org> References: <87mud5ivou.fsf@telefonica.net> <83a7959z7i.fsf@gnu.org> <87imnthsnv.fsf@telefonica.net> <87ee6ru4l4.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10285"; mail-complaints-to="usenet@ciao.gmane.io" Cc: ofv@wanadoo.es, 38143@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 05 10:48:17 2021 Return-path: 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 ) id 1mto80-0002VG-HW for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Dec 2021 10:48:16 +0100 Original-Received: from localhost ([::1]:47830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mto7z-0001O4-3C for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Dec 2021 04:48:15 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mto7p-0001Nw-FT for bug-gnu-emacs@gnu.org; Sun, 05 Dec 2021 04:48:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44823) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mto7m-0008P1-GR for bug-gnu-emacs@gnu.org; Sun, 05 Dec 2021 04:48:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mto7m-00049f-Cb for bug-gnu-emacs@gnu.org; Sun, 05 Dec 2021 04:48:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Dec 2021 09:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38143 X-GNU-PR-Package: emacs Original-Received: via spool by 38143-submit@debbugs.gnu.org id=B38143.163869763615729 (code B ref 38143); Sun, 05 Dec 2021 09:48:02 +0000 Original-Received: (at 38143) by debbugs.gnu.org; 5 Dec 2021 09:47:16 +0000 Original-Received: from localhost ([127.0.0.1]:56369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mto72-00045d-Cm for submit@debbugs.gnu.org; Sun, 05 Dec 2021 04:47:16 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42748) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mto70-00045M-OW for 38143@debbugs.gnu.org; Sun, 05 Dec 2021 04:47:15 -0500 Original-Received: from [2001:470:142:3::e] (port=35568 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mto6u-0008Kp-Iq; Sun, 05 Dec 2021 04:47:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=yjEpGeZNemtiBm+4AXEZuZP5C9t4Yjit4uapqzS9Utw=; b=jwyS5ym0v9+RGPVUHsiH J9Bth3zR7UyRDKtjPfweoA1qapH7n0QTshPdiKlinx/3lwJA/HbM/C+HFNnwiaKLYqVtYcCjeySzy 0BcP4JmaBTjALX4OA2cqf1XBkCo0mMBa+g4DNaAid63BUPIWwyE/Rc4DCNwbR5zjWNXn4lH37uxej rZa8Ir0FD4vIB8Rlv3O0QD/AjH0Z2S9J4bGONywVzcdD9miRz8xVFbQANIx4rrkCwv/qv9/BjPjOS BzBT2wOUgMR1vewTEBE+xZeoPlL5b+i5S0ZJ5h5uflbTZy2iZZwNqmwJczP2o/m0PFbMHcXTAlRA5 TmSNDR1qIPgxkA==; Original-Received: from [87.69.77.57] (port=4508 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mto6t-0007Rl-VB; Sun, 05 Dec 2021 04:47:08 -0500 In-Reply-To: <87ee6ru4l4.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun, 05 Dec 2021 04:13:11 +0100) 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" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:221601 Archived-At: > From: Lars Ingebrigtsen > Cc: Eli Zaretskii , martin rudalics , > 38143@debbugs.gnu.org > Date: Sun, 05 Dec 2021 04:13:11 +0100 > > Óscar Fuentes 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.