emacs-devel
[Top][All Lists]
Advanced

[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 22:28:42 -0500
User-agent: Thunderbird 2.0.0.22 (Macintosh/20090605)

Stefan Monnier wrote:
>>> 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.
> 
> OK, so the next question is "why/when did focus shift to the *Calendar"
> buffer" (and just to be more clear by "why/when" I mean at the level of
> the Elisp code, which trail of calls causes it).

The calendar buffer was configured to be sticky in a particular frame,
so that when emacs wanted to show that calendar buffer, it showed it in
the different frame.

I don't entirely understand how the stickiness happens -- configuration
of the emacs calendar is far beyond me.
> 
>> 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 know neither subsumes the other (sadly).  I just hope new ones can be
> made a bit more orthogonal (i.e. with less overlap).

Right.  I believe that these need to be done "inside to out" i.e.,

(save-excursion
  (save-window-excursion
    (org-save-frame-excursion
       ....)))

in order that they unwind properly.

What I think is at least a bit odd is that I don't know of a case where
one would /not/ want the current frame focus to be restored when doing a
save-excursion.  Admittedly it's unlikely (at least now) to get into a
state where you will change the frame focus, but whenever you /do/
change the frame focus, wouldn't you want it restored?

But this may simply expose my naiveté about emacs.

Best,
r





reply via email to

[Prev in Thread] Current Thread [Next in Thread]