all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Understanding after-make-frame-functions
Date: Tue, 17 May 2016 19:36:44 +0300	[thread overview]
Message-ID: <83a8jo4p5v.fsf@gnu.org> (raw)
In-Reply-To: <CAFyQvY2LeH0CnO2xFcb7aQ+C2UAmnZYWys4fmJZKxOPhPuHTKw@mail.gmail.com> (message from Kaushal Modi on Tue, 17 May 2016 16:15:39 +0000)

> From: Kaushal Modi <kaushal.modi@gmail.com>
> Date: Tue, 17 May 2016 16:15:39 +0000
> 
> > There's nothing specific to daemon here, it is all just side effect of
> > how and when frames are created by Emacs.  In particular, the daemon
> > creates frames when emacsclient connects to it, and doesn't have any
> > displayable frames before that.
> >
> > In general, _any_ call to make-frame will always run
> > after-make-frame-functions, you can clearly see that in the code.
> >
> 
> Thanks. But I think that this side effect should be documented. I used the
> below test snippet in 3 different invocations of emacs:
> 
> (1) emacs &
> (2) emacsclient -c -a '' &
> (3) emacs -nw

What Emacs does during startup is documented in the ELisp manual, see
the node "Startup Summary".  If you have specific suggestions for
amendments there, please file a bug report with those suggestions.

> So in conclusion, it looks like however the user customizes the
> before-make-frame-hook and after-make-frame-functions, those would be
> ineffective when running non-daemon emacs and emacs -nw. It is obvious that
> frames are not being created for emacs -nw and so those hooks are not
> called. But it is not evident that the init.el/.emacs is called after frame
> generation when running emacs& and so those frame hook customizations serve
> no purpose in that case.

The above-mentioned node in the manual describes more hooks, so maybe
you should simply use a different hook for your needs.

> > > (2) Is window-setup-hook supposed to run only in non-daemon emacs?
> >
> > No, of course not.  It is supposed to be used by any customizations
> > that need to hook into stuff that Emacs does early on during its
> > startup (see startup.el), which you cannot do later.
> 
> Thanks. I now understand that. Just that I cannot use window-setup-hook for
> my font check when running emacsclient because the frame/fonts haven't been
> loaded yet

Once again, perhaps a different hook, which runs later, will do what
you want.

> There's something else too which is undocumented and I learned through
> experimentation; that I need to add select-frame to
> after-make-frame-functions first for the find-font to work as intended
> (else it always returns nil). Would adding that to that hook be a good
> default?

I would suggest moving the code to a hook that runs later, when the
initial frame is already the selected one.

> At the end of this, let me know if you too think that the
> after-make-frame-functions needs more clarification in the documentation,
> and I will file a bug report for that.

Not sure, but if there's specific information you'd like to be there,
let's talk specifics.



  reply	other threads:[~2016-05-17 16:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-16 23:35 Understanding after-make-frame-functions Kaushal Modi
2016-05-16 23:42 ` Kaushal Modi
2016-05-17  3:39   ` Eli Zaretskii
2016-05-17  3:44 ` Eli Zaretskii
2016-05-17 16:15   ` Kaushal Modi
2016-05-17 16:36     ` Eli Zaretskii [this message]
2016-05-17 18:08       ` Kaushal Modi
2016-05-17 20:18         ` Eli Zaretskii
2016-05-18  2:31           ` Kaushal Modi
2016-05-18  2:39             ` Eli Zaretskii
2016-05-18  2:46               ` Kaushal Modi

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

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

  git send-email \
    --in-reply-to=83a8jo4p5v.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.