all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
To: emacs-devel@gnu.org
Subject: Re: frame.el: call before-make-frame-hook earlier in make-frame
Date: Thu, 30 Jul 2015 10:34:17 -0500	[thread overview]
Message-ID: <86h9ol7j7q.fsf@stephe-leake.org> (raw)
In-Reply-To: <20150730110041.GE23175@csr-pc9.zib.de> (Florian's message of "Thu, 30 Jul 2015 13:00:41 +0200")

Florian <floriansbriefe@gmail.com> 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



  reply	other threads:[~2015-07-30 15:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-30 11:00 frame.el: call before-make-frame-hook earlier in make-frame Florian
2015-07-30 15:34 ` Stephen Leake [this message]
2015-07-31  7:09 ` martin rudalics
2015-07-31  7:40   ` floriansbriefe
2015-07-31  9:55     ` martin rudalics
2015-07-31 10:38       ` floriansbriefe
2015-08-01 10:50         ` martin rudalics
2015-08-03  9:16         ` Florian
2015-08-03 10:41           ` martin rudalics
2015-08-03 14:57             ` Eli Zaretskii
2015-08-03 21:14             ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86h9ol7j7q.fsf@stephe-leake.org \
    --to=stephen_leake@stephe-leake.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.