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 06:44:11 +0300 Message-ID: <83futh4ad0.fsf@gnu.org> References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1463456674 28773 80.91.229.3 (17 May 2016 03:44:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 May 2016 03:44:34 +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 05:44:29 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 1b2Vvn-0001te-0r for geh-help-gnu-emacs@m.gmane.org; Tue, 17 May 2016 05:44:27 +0200 Original-Received: from localhost ([::1]:48254 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2Vvm-0007S3-F8 for geh-help-gnu-emacs@m.gmane.org; Mon, 16 May 2016 23:44:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2Vvd-0007HE-5K for help-gnu-emacs@gnu.org; Mon, 16 May 2016 23:44:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2VvX-0003vk-3z for help-gnu-emacs@gnu.org; Mon, 16 May 2016 23:44:16 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42829) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2VvX-0003vg-0V for help-gnu-emacs@gnu.org; Mon, 16 May 2016 23:44:11 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3082 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1b2VvW-0004w8-7W for help-gnu-emacs@gnu.org; Mon, 16 May 2016 23:44:10 -0400 In-reply-to: (message from Kaushal Modi on Mon, 16 May 2016 23:35:15 +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:110010 Archived-At: > From: Kaushal Modi > 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"?