From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Understanding after-make-frame-functions Date: Tue, 17 May 2016 19:36:44 +0300 Message-ID: <83a8jo4p5v.fsf@gnu.org> References: <83futh4ad0.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1463503032 22781 80.91.229.3 (17 May 2016 16:37:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 May 2016 16:37:12 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 17 18:37:07 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b2hzX-000486-9A for geh-help-gnu-emacs@m.gmane.org; Tue, 17 May 2016 18:37:07 +0200 Original-Received: from localhost ([::1]:51452 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2hzW-00057w-Ki for geh-help-gnu-emacs@m.gmane.org; Tue, 17 May 2016 12:37:06 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38729) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2hzL-00057p-Gu for help-gnu-emacs@gnu.org; Tue, 17 May 2016 12:36:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2hzH-0003b0-87 for help-gnu-emacs@gnu.org; Tue, 17 May 2016 12:36:54 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2hzH-0003aw-3x for help-gnu-emacs@gnu.org; Tue, 17 May 2016 12:36:51 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4174 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1b2hzF-0007kv-H4 for help-gnu-emacs@gnu.org; Tue, 17 May 2016 12:36:50 -0400 In-reply-to: (message from Kaushal Modi on Tue, 17 May 2016 16:15:39 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:110022 Archived-At: > From: Kaushal Modi > 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.