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:39:31 +0300 Message-ID: <83h9dx4aks.fsf@gnu.org> References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1463456397 25072 80.91.229.3 (17 May 2016 03:39:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 May 2016 03:39:57 +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:39:52 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 1b2VrJ-0000F8-Fv for geh-help-gnu-emacs@m.gmane.org; Tue, 17 May 2016 05:39:49 +0200 Original-Received: from localhost ([::1]:48240 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2VrI-0000nZ-Iu for geh-help-gnu-emacs@m.gmane.org; Mon, 16 May 2016 23:39:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2Vr7-0000jw-33 for help-gnu-emacs@gnu.org; Mon, 16 May 2016 23:39:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2Vr2-00033D-RB for help-gnu-emacs@gnu.org; Mon, 16 May 2016 23:39:35 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42761) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2Vr2-000331-ON for help-gnu-emacs@gnu.org; Mon, 16 May 2016 23:39:32 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3075 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1b2Vr0-0004V9-T5 for help-gnu-emacs@gnu.org; Mon, 16 May 2016 23:39:31 -0400 In-reply-to: (message from Kaushal Modi on Mon, 16 May 2016 23:42:43 +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:110009 Archived-At: > From: Kaushal Modi > Date: Mon, 16 May 2016 23:42:43 +0000 > > On Mon, May 16, 2016 at 7:35 PM Kaushal Modi wrote: > > > Here is a little snippet for testing > > > > ===== temp.el ===== > > (add-hook 'after-make-frame-functions (lambda (frame) (message "frame: > > %S"))) > > ===== > > > I have a typo above; it should be > > (add-hook 'after-make-frame-functions (lambda (frame) (message "frame: %S" > frame))) > > When you run "emacs -Q -l temp.el&", the above message will not be printed. By the time Emacs gets around to run the code in temp.el, it already created the initial frame, so your hook is not called because make-frame for the initial frame was already done by that time. Which is exactly the reason we have various hooks that specifically target steps in the startup procedure. Just use them.