[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: |
floriansbriefe |
Subject: |
Re: frame.el: call before-make-frame-hook earlier in make-frame |
Date: |
Fri, 31 Jul 2015 09:40:34 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
> > 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.
>
> We could easily do that. But encouraging users to set a variable called
> `default-frame-alist' in a hook is probably a very bad advice. Where
> would you change the default value back after you're done with making
> the frame? In `after-make-frame-functions'?
As the hook is registered, the hook will always adjust the 'default-frame-alist'
and thereby make its value dynamic. There is no need to restore the former
default.
But I see your point, that it is a kind of hack.
> Creating a frame under the mouse cursor should be done by a special
> function that calls `make-frame' with the mouse position passed via the
> `left' and `top' PARAMETERS thus _overriding_ any default parameters.
> Please tell us if and why such a function would not be practicable for
> you.
That is a viable solution, but it has the drawback that you have to override a
default key-binding (C-x 5 2) with your own make-frame function and that you do
not benefit from the nice things that 'make-frame-command' additionally does for
you a) at the moment (setting the focus to the new frame etc) and b) potentially
in future emacs releases. Thats why I would prefer using the hook. Thats what
hooks are for: Adjusting behaviour with minimal invasion.
Cheers,
Florian