[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: frame.el: call before-make-frame-hook earlier in make-frame
From: |
Stephen Leake |
Subject: |
Re: frame.el: call before-make-frame-hook earlier in make-frame |
Date: |
Thu, 30 Jul 2015 10:34:17 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt) |
Florian <address@hidden> 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