[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help using the right hook for loading theme on emacs daemon GUI

From: Eli Zaretskii
Subject: Re: Help using the right hook for loading theme on emacs daemon GUI
Date: Thu, 24 Jan 2019 21:44:49 +0200

> Date: Fri, 25 Jan 2019 08:17:05 +1300
> From: Phil Sainty <address@hidden>
> Cc: address@hidden, address@hidden
> 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))

> (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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]