[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: save-frame-excursion?
From: |
Robert Goldman |
Subject: |
Re: save-frame-excursion? |
Date: |
Thu, 23 Jul 2009 21:24:07 -0500 |
User-agent: |
Thunderbird 2.0.0.22 (Macintosh/20090605) |
Stefan Monnier wrote:
>> Currently we use this in Org-mode to save frame excursion:
>> (defmacro org-save-frame-excursion (&rest body)
>> "Eval BODY and return to the currently selected frame."
>> (let ((frame-var (gensym "FRAME")))
>> `(let ((,frame-var (selected-frame)))
>> (unwind-protect
>> (progn ,@body)
>> (select-frame-set-input-focus ,frame-var)))))
>
>> This was required when selecting a date for an Org entry.
>> Org has a mechanism that lets the user browse the calendar
>> while the cursor is still in the minibuffer (see org-read-date).
>
>> When the calendar is displayed in a separate frame, this
>> mechanism was broken because org-read-date was losing the
>> focus.
>
> Do you know when/why it lost the focus?
The org frame lost focus because focus shifted to the frame that
contained the *Calendar* buffer. The interaction in the *Calendar*
buffer was protected by save-excursion and save-window-excursion. That
was enough to save the state /within/ the frame containing the org
buffer, but was /not/ enough to restore focus to the original frame.
>
> What was used before this macro (i.e. which part of this macro is the
> important one)?
>
>> Is this a pattern that other developers already met?
>
> Well, there's save-selected-window, as well as with-selected-window,
> which cover similar grounds, but without knowing more details it's hard
> to tell.
I am not that experienced in this area, but as far as I can tell
save-window-excursion covers similar ground, but only controls what
window is selected /within a given frame/. So this macro, on which I
based org-save-frame-excursion covers similar ground, but it does not
subsume this macro.
I hope this helps,
Robert
- save-frame-excursion?, Bastien, 2009/07/23
- Re: save-frame-excursion?, Stefan Monnier, 2009/07/23
- Re: save-frame-excursion?,
Robert Goldman <=
- Re: save-frame-excursion?, Stefan Monnier, 2009/07/23
- Re: save-frame-excursion?, Robert Goldman, 2009/07/24
- Re: save-frame-excursion?, Stefan Monnier, 2009/07/24
- Re: save-frame-excursion?, Robert Goldman, 2009/07/25
- Re: save-frame-excursion?, Stefan Monnier, 2009/07/25
- Re: save-frame-excursion?, Bastien, 2009/07/25
- Re: save-frame-excursion?, Stefan Monnier, 2009/07/25
- Re: save-frame-excursion?, Bastien, 2009/07/25
- Re: save-frame-excursion?, Stefan Monnier, 2009/07/26
- RE: save-frame-excursion?, Drew Adams, 2009/07/26