* Frame resize hook?
@ 2009-04-22 9:49 Juan Pedro Bolivar Puente
2009-04-22 18:02 ` Nikolaj Schumacher
0 siblings, 1 reply; 11+ messages in thread
From: Juan Pedro Bolivar Puente @ 2009-04-22 9:49 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
I'm using Xmonad as window manager so tiling causes frames to get very
small sometimes, and if I'm working with ECB windows are messed
afterwards. I can fix it by calling ecb-redraw-layout, but I don't know
how to get that function called automatically on every resize of the
Emacs frame.
Any hints?
Many thanks,
JP
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Frame resize hook?
2009-04-22 9:49 Frame resize hook? Juan Pedro Bolivar Puente
@ 2009-04-22 18:02 ` Nikolaj Schumacher
2009-04-22 22:57 ` Lennart Borgman
0 siblings, 1 reply; 11+ messages in thread
From: Nikolaj Schumacher @ 2009-04-22 18:02 UTC (permalink / raw)
To: Juan Pedro Bolivar Puente; +Cc: help-gnu-emacs
Juan Pedro Bolivar Puente <magnicida@gmail.com> wrote:
> Any hints?
The dirty way would be running a timer, checking if the window size
changed, and redrawing then...
regards,
Nikolaj Schumacher
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Frame resize hook?
2009-04-22 18:02 ` Nikolaj Schumacher
@ 2009-04-22 22:57 ` Lennart Borgman
2009-04-23 8:00 ` Juan Pedro Bolivar Puente
0 siblings, 1 reply; 11+ messages in thread
From: Lennart Borgman @ 2009-04-22 22:57 UTC (permalink / raw)
To: Nikolaj Schumacher; +Cc: help-gnu-emacs, Juan Pedro Bolivar Puente
On Wed, Apr 22, 2009 at 8:02 PM, Nikolaj Schumacher <me@nschum.de> wrote:
> Juan Pedro Bolivar Puente <magnicida@gmail.com> wrote:
>
>> Any hints?
>
> The dirty way would be running a timer, checking if the window size
> changed, and redrawing then...
What about window-configuration-change-hook?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Frame resize hook?
2009-04-22 22:57 ` Lennart Borgman
@ 2009-04-23 8:00 ` Juan Pedro Bolivar Puente
2009-04-23 8:55 ` Lennart Borgman
0 siblings, 1 reply; 11+ messages in thread
From: Juan Pedro Bolivar Puente @ 2009-04-23 8:00 UTC (permalink / raw)
To: help-gnu-emacs; +Cc: help-gnu-emacs
Lennart Borgman wrote:
> On Wed, Apr 22, 2009 at 8:02 PM, Nikolaj Schumacher <me@nschum.de> wrote:
>> Juan Pedro Bolivar Puente <magnicida@gmail.com> wrote:
>>
>>> Any hints?
>> The dirty way would be running a timer, checking if the window size
>> changed, and redrawing then...
>
> What about window-configuration-change-hook?
>
>
>
That hook is triggered on windows change, not a frame change.
JP
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Frame resize hook?
2009-04-23 8:00 ` Juan Pedro Bolivar Puente
@ 2009-04-23 8:55 ` Lennart Borgman
2009-04-23 8:55 ` Juan Pedro Bolivar Puente
0 siblings, 1 reply; 11+ messages in thread
From: Lennart Borgman @ 2009-04-23 8:55 UTC (permalink / raw)
To: Juan Pedro Bolivar Puente; +Cc: help-gnu-emacs
On Thu, Apr 23, 2009 at 10:00 AM, Juan Pedro Bolivar Puente
<magnicida@gmail.com> wrote:
> Lennart Borgman wrote:
>> On Wed, Apr 22, 2009 at 8:02 PM, Nikolaj Schumacher <me@nschum.de> wrote:
>>> Juan Pedro Bolivar Puente <magnicida@gmail.com> wrote:
>>>
>>>> Any hints?
>>> The dirty way would be running a timer, checking if the window size
>>> changed, and redrawing then...
>>
>> What about window-configuration-change-hook?
>>
>>
>>
>
> That hook is triggered on windows change, not a frame change.
Yes, but a frame size change triggers windows changes. Does not that
happen for you?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Frame resize hook?
2009-04-23 8:55 ` Lennart Borgman
@ 2009-04-23 8:55 ` Juan Pedro Bolivar Puente
2009-04-23 9:13 ` Lennart Borgman
0 siblings, 1 reply; 11+ messages in thread
From: Juan Pedro Bolivar Puente @ 2009-04-23 8:55 UTC (permalink / raw)
To: help-gnu-emacs; +Cc: help-gnu-emacs
Lennart Borgman wrote:
> On Thu, Apr 23, 2009 at 10:00 AM, Juan Pedro Bolivar Puente
> <magnicida@gmail.com> wrote:
>> Lennart Borgman wrote:
>>> On Wed, Apr 22, 2009 at 8:02 PM, Nikolaj Schumacher <me@nschum.de> wrote:
>>>> Juan Pedro Bolivar Puente <magnicida@gmail.com> wrote:
>>>>
>>>>> Any hints?
>>>> The dirty way would be running a timer, checking if the window size
>>>> changed, and redrawing then...
>>> What about window-configuration-change-hook?
>>>
>>>
>>>
>> That hook is triggered on windows change, not a frame change.
>
> Yes, but a frame size change triggers windows changes. Does not that
> happen for you?
>
>
>
Yes, but I get into infinite recursion and stack overflow as
ecb-layout-redraw also changes window configuration :p
JP
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Frame resize hook?
2009-04-23 8:55 ` Juan Pedro Bolivar Puente
@ 2009-04-23 9:13 ` Lennart Borgman
2009-04-23 9:32 ` Juan Pedro Bolivar Puente
0 siblings, 1 reply; 11+ messages in thread
From: Lennart Borgman @ 2009-04-23 9:13 UTC (permalink / raw)
To: Juan Pedro Bolivar Puente; +Cc: help-gnu-emacs
On Thu, Apr 23, 2009 at 10:55 AM, Juan Pedro Bolivar Puente
<magnicida@gmail.com> wrote:
> Lennart Borgman wrote:
>> On Thu, Apr 23, 2009 at 10:00 AM, Juan Pedro Bolivar Puente
>> <magnicida@gmail.com> wrote:
>>> Lennart Borgman wrote:
>>>> On Wed, Apr 22, 2009 at 8:02 PM, Nikolaj Schumacher <me@nschum.de> wrote:
>>>>> Juan Pedro Bolivar Puente <magnicida@gmail.com> wrote:
>>>>>
>>>>>> Any hints?
>>>>> The dirty way would be running a timer, checking if the window size
>>>>> changed, and redrawing then...
>>>> What about window-configuration-change-hook?
>>>>
>>>>
>>>>
>>> That hook is triggered on windows change, not a frame change.
>>
>> Yes, but a frame size change triggers windows changes. Does not that
>> happen for you?
>>
>>
>>
>
> Yes, but I get into infinite recursion and stack overflow as
> ecb-layout-redraw also changes window configuration :p
You have to protect against that by let-binding the hook.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Frame resize hook?
2009-04-23 9:13 ` Lennart Borgman
@ 2009-04-23 9:32 ` Juan Pedro Bolivar Puente
2009-04-23 9:58 ` Lennart Borgman
0 siblings, 1 reply; 11+ messages in thread
From: Juan Pedro Bolivar Puente @ 2009-04-23 9:32 UTC (permalink / raw)
To: help-gnu-emacs
>>>
>> Yes, but I get into infinite recursion and stack overflow as
>> ecb-layout-redraw also changes window configuration :p
>
> You have to protect against that by let-binding the hook.
>
>
>
I don't understand very well what you mean. Can you please give me a
further explanation? I'm a newbie on elisp.
Thanks
JP
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Frame resize hook?
2009-04-23 9:32 ` Juan Pedro Bolivar Puente
@ 2009-04-23 9:58 ` Lennart Borgman
0 siblings, 0 replies; 11+ messages in thread
From: Lennart Borgman @ 2009-04-23 9:58 UTC (permalink / raw)
To: Juan Pedro Bolivar Puente; +Cc: help-gnu-emacs
On Thu, Apr 23, 2009 at 11:32 AM, Juan Pedro Bolivar Puente
<magnicida@gmail.com> wrote:
>
>>>>
>>> Yes, but I get into infinite recursion and stack overflow as
>>> ecb-layout-redraw also changes window configuration :p
>>
>> You have to protect against that by let-binding the hook.
>>
>>
>>
>
> I don't understand very well what you mean. Can you please give me a
> further explanation? I'm a newbie on elisp.
You can override the value of a a variable through dynamic binding,
see for example
http://www.emacswiki.org/emacs/DynamicBindingVsLexicalBinding
In your case you can use something like this in the function
(your-hook-fun) you put in the hook:
(defun your-hook-fun ()
(let ((window-configuration-change-hook nil))
...
))
^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <mailman.5790.1240394416.31690.help-gnu-emacs@gnu.org>]
* Re: Frame resize hook?
[not found] <mailman.5790.1240394416.31690.help-gnu-emacs@gnu.org>
@ 2009-04-22 14:46 ` Pascal J. Bourguignon
2009-04-22 17:04 ` Juan Pedro Bolivar Puente
0 siblings, 1 reply; 11+ messages in thread
From: Pascal J. Bourguignon @ 2009-04-22 14:46 UTC (permalink / raw)
To: help-gnu-emacs
Juan Pedro Bolivar Puente <magnicida@gmail.com> writes:
> I'm using Xmonad as window manager so tiling causes frames to get very
> small sometimes, and if I'm working with ECB windows are messed
> afterwards. I can fix it by calling ecb-redraw-layout, but I don't know
> how to get that function called automatically on every resize of the
> Emacs frame.
>
> Any hints?
Perhaps with an advice, but ISTR that advices are not called when the
function is called from within the C layer of emacs (the calls are
"open coded" there). So it would work only if the frame resizing is
done from lisp code.
The functions to advice would be set-frame-size, set-frame-width and set-frame-height.
(perhaps also set-frame-position).
Cf. defadvice
Otherwise, you would have to patch the C code of these primitive functions.
--
__Pascal Bourguignon__
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Frame resize hook?
2009-04-22 14:46 ` Pascal J. Bourguignon
@ 2009-04-22 17:04 ` Juan Pedro Bolivar Puente
0 siblings, 0 replies; 11+ messages in thread
From: Juan Pedro Bolivar Puente @ 2009-04-22 17:04 UTC (permalink / raw)
To: help-gnu-emacs
>
> Perhaps with an advice, but ISTR that advices are not called when the
> function is called from within the C layer of emacs (the calls are
> "open coded" there). So it would work only if the frame resizing is
> done from lisp code.
>
> The functions to advice would be set-frame-size, set-frame-width and set-frame-height.
> (perhaps also set-frame-position).
>
> Cf. defadvice
>
> Otherwise, you would have to patch the C code of these primitive functions.
>
I tried adding:
(defadvice set-frame-size (after jpb-advice-resize-1)
(ecb-redraw-layout))
(defadvice set-frame-width (after jpb-advice-resize-2)
(ecb-redraw-layout))
(defadvice set-frame-height (after jpb-advice-resize-2)
(ecb-redraw-layout))
(ad-activate 'set-frame-size)
(ad-activate 'set-frame-width)
(ad-activate 'set-frame-height)
But, as you said, it only works when calling set-frame-xxx from Elisp
code, not on window manager events.
Thanks for the tip anyways, I didn't know about "advices".
JP
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2009-04-23 9:58 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-22 9:49 Frame resize hook? Juan Pedro Bolivar Puente
2009-04-22 18:02 ` Nikolaj Schumacher
2009-04-22 22:57 ` Lennart Borgman
2009-04-23 8:00 ` Juan Pedro Bolivar Puente
2009-04-23 8:55 ` Lennart Borgman
2009-04-23 8:55 ` Juan Pedro Bolivar Puente
2009-04-23 9:13 ` Lennart Borgman
2009-04-23 9:32 ` Juan Pedro Bolivar Puente
2009-04-23 9:58 ` Lennart Borgman
[not found] <mailman.5790.1240394416.31690.help-gnu-emacs@gnu.org>
2009-04-22 14:46 ` Pascal J. Bourguignon
2009-04-22 17:04 ` Juan Pedro Bolivar Puente
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).