From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: frame.el: call before-make-frame-hook earlier in make-frame Date: Thu, 30 Jul 2015 10:34:17 -0500 Message-ID: <86h9ol7j7q.fsf@stephe-leake.org> References: <20150730110041.GE23175@csr-pc9.zib.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1438270512 4997 80.91.229.3 (30 Jul 2015 15:35:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 30 Jul 2015 15:35:12 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 30 17:35:03 2015 Return-path: Envelope-to: ged-emacs-devel@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 1ZKprC-0000Bu-9z for ged-emacs-devel@m.gmane.org; Thu, 30 Jul 2015 17:34:54 +0200 Original-Received: from localhost ([::1]:40571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKprB-0004JD-ON for ged-emacs-devel@m.gmane.org; Thu, 30 Jul 2015 11:34:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKpqw-0004Ev-1K for emacs-devel@gnu.org; Thu, 30 Jul 2015 11:34:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKpqs-0005mn-Py for emacs-devel@gnu.org; Thu, 30 Jul 2015 11:34:37 -0400 Original-Received: from gproxy9-pub.mail.unifiedlayer.com ([69.89.20.122]:47373) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1ZKpqs-0005mj-8U for emacs-devel@gnu.org; Thu, 30 Jul 2015 11:34:34 -0400 Original-Received: (qmail 23573 invoked by uid 0); 30 Jul 2015 15:34:32 -0000 Original-Received: from unknown (HELO CMOut01) (10.0.90.82) by gproxy9.mail.unifiedlayer.com with SMTP; 30 Jul 2015 15:34:32 -0000 Original-Received: from host114.hostmonster.com ([74.220.207.114]) by CMOut01 with id yfaP1q00V2UdiVW01faSVy; Thu, 30 Jul 2015 09:34:31 -0600 X-Authority-Analysis: v=2.1 cv=NJxGpSKg c=1 sm=1 tr=0 a=CQdxDb2CKd3SRg4I0/XZPQ==:117 a=CQdxDb2CKd3SRg4I0/XZPQ==:17 a=DsvgjBjRAAAA:8 a=f5113yIGAAAA:8 a=9i_RQKNPAAAA:8 a=y7kgw_RnJtkA:10 a=hEr_IkYJT6EA:10 a=x_XPkuGwIRMA:10 a=zOBTXjUuO1YA:10 a=pGLkceISAAAA:8 a=RKwmaAxuSt_ah1_anscA:9 Original-Received: from [76.218.37.33] (port=61577 helo=TAKVER2) by host114.hostmonster.com with esmtpa (Exim 4.84) (envelope-from ) id 1ZKpqi-0002Hz-3e for emacs-devel@gnu.org; Thu, 30 Jul 2015 09:34:24 -0600 In-Reply-To: <20150730110041.GE23175@csr-pc9.zib.de> (Florian's message of "Thu, 30 Jul 2015 13:00:41 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt) X-Identified-User: {2442:host114.hostmonster.com:stephele:stephe-leake.org} {sentby:smtp auth 76.218.37.33 authed with stephen_leake@stephe-leake.org} X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 69.89.20.122 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:188195 Archived-At: Florian writes: > Dear Emacs developers, > > I would like to propose to call the before-make-frame-hook in the function > make-frame *before* retrieving the parameters of the new frame > (window-system-default-frame-alist and default-frame-alist) and not after. > > That way, one could dynamically set these variables inside the hook, e.g. to > create the new frame under the current position of the mouse cursor. > > frame.el: > [...] > (defun make-frame (&optional parameters) > [...] > ;; NEW position of hook > (run-hooks 'before-make-frame-hook) > ;; Add parameters from `window-system-default-frame-alist'. > (dolist (p (cdr (assq w window-system-default-frame-alist))) > (unless (assq (car p) params) > (push p params))) > ;; Add parameters from `default-frame-alist'. > (dolist (p default-frame-alist) > (unless (assq (car p) params) > (push p params))) > ;; Now make the frame. > ;; OLD position of hook > ;;(run-hooks 'before-make-frame-hook) > [...] > > Is there a reason that the hook is called after reading the params? I would have guessed that 'before-make-frame-hook' could modify the params set by the global variables. But it can't, since it doesn't have access to the local variable 'params'. So perhaps a better change would be to pass 'params' to before-make-frame-hook so it can modify 'params'. For compatibility, that probably requires a new hook. -- -- Stephe