From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Help using the right hook for loading theme on emacs daemon GUI Date: Thu, 24 Jan 2019 21:44:49 +0200 Message-ID: <83d0ol7scu.fsf@gnu.org> References: <6c1611672809c8d7b5011edf0d2dd831@webmail.orcon.net.nz> <83va2e6t7r.fsf@gnu.org> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="89783"; mail-complaints-to="usenet@blaine.gmane.org" Cc: kaushal.modi@gmail.com, emacs-devel@gnu.org To: Phil Sainty Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 24 20:54:57 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gml5T-000N4R-LD for ged-emacs-devel@m.gmane.org; Thu, 24 Jan 2019 20:54:55 +0100 Original-Received: from localhost ([127.0.0.1]:60071 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gml5N-0006bI-BO for ged-emacs-devel@m.gmane.org; Thu, 24 Jan 2019 14:54:49 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gml47-0006LA-Ge for emacs-devel@gnu.org; Thu, 24 Jan 2019 14:53:33 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:50061) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmkvo-0007d1-7R; Thu, 24 Jan 2019 14:44:56 -0500 Original-Received: from [176.228.60.248] (port=2510 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gmkvn-0001UK-Oi; Thu, 24 Jan 2019 14:44:56 -0500 In-reply-to: (message from Phil Sainty on Fri, 25 Jan 2019 08:17:05 +1300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:232676 Archived-At: > Date: Fri, 25 Jan 2019 08:17:05 +1300 > From: Phil Sainty > Cc: emacs-devel@gnu.org, kaushal.modi@gmail.com > > On 2019-01-25 03:11, Eli Zaretskii wrote: > > I think the comment is relevant, because in GUI mode we create a GUI > > frame early during the startup and then delete the initial frame. So > > from the user's perspective, starting Emacs in GUI mode does run the > > hook for the first frame displayed to the user. > > I cannot replicate that in 26.1 or 27. Init file contains: > > (defun foo (frame) > (message "%S => %S" (selected-frame) frame)) > > (add-hook 'after-make-frame-functions 'foo) > > Starting a new emacs instance, whether GUI or -nw, does not generate > that message. > > (I also tried substituting (debug) for the (message) call, and the > debugger was not triggered.) > > What am I missing here? During startup this hook runs before the init file is loaded. It is called by this snippet from startup.el: ;; Under X, create the X frame and delete the terminal frame. (unless (daemonp) (if (or noninteractive emacs-basic-display) (setq menu-bar-mode nil tool-bar-mode nil no-blinking-cursor t)) (frame-initialize)) > (If it's running the hook, but it's happening before the init file > is processed, then that's surely a no-op for the purposes of this > question?) It's not entirely a no-op, since there's early-init-file and package-initialize, both of which are called before this hook.