help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Understanding after-make-frame-functions


From: Eli Zaretskii
Subject: Re: Understanding after-make-frame-functions
Date: Tue, 17 May 2016 06:44:11 +0300

> From: Kaushal Modi <kaushal.modi@gmail.com>
> Date: Mon, 16 May 2016 23:35:15 +0000
> 
> ===== temp.el =====
> (add-hook 'after-make-frame-functions (lambda (frame) (message "frame:
> %S")))
> =====
> 
> When you run "emacs -Q -l temp.el&", the above message will not be printed.
> But it prints fine when emacs is launched in daemon mode.
> 
> So I need to add the find-font call in window-setup-hook (which non-daemon
> emacs can see but emacsclient cannot. Is that right?).
> 
> So I have ended up with few code snippets in both
> after-make-frame-functions and in window-setup-hook.  I have the actual
> snippets from my config at the end of this email, in the case they come
> helpful in understanding my problem statement.
> 
> (1) Is the above after-make-frame-functions behavior specific to daemon
> sessions as expected? If so, I was unable to find reference to that in the
> emacs/elisp manual.

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.

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

> (3) What would be a more concise manner to do stuff like linum activation,
> find-font call, etc. correctly in both emacs and emacsclient?

I don't understand the question.  Emacs daemon can be started with a
non-empty ~/.emacs, so why is this an issue?  IOW, what's wrong with
the answer "as you usually do with customizations"?



reply via email to

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