[Aquamacs-devel] Help with emacs-lisp for aquamacs

Robert Goldman rpgoldman at sift.info
Wed Jul 15 22:53:27 UTC 2009


I'm having some trouble managing frames in aquamacs and I was wondering
if someone could provide some advice.

Here's my problem:

I'm using org-mode.  Org-mode allows me to associate scheduling
information with outline items.  To do this, I can do org-schedule,
which will pop up an emacs calendar window and harvest out of it a date.

Here's the problem:  On aquamacs, I often find that the emacs calendar
window appears in a /different/ frame from the buffer where I'm working.
 Focus is being "trapped" somehow in the calendar window.  Even though
the calendar interaction is wrapped in

(save-excursion
  (save-window-excursion
    ....))

the cursor's being left in the calendar window, instead of in its
original position.

I *believe* that this is because the calendar window is in a different
frame.  I was trying to fix this by wrapping it like so:

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

Where save-frame-excursion is this macro:

(defmacro save-frame-excursion (&rest body)
  "Carry out some operations and then return to the currently
selected frame."
  (let ((frame-var (gensym "FRAME")))
    `(let ((,frame-var (selected-frame)))
       (unwind-protect
           (progn , at body)
         (select-frame ,frame-var) ))))

Unfortunately, this does nothing, and I see the following in the
documentation of select-frame:

If you are using a window system, the previously
selected frame may be restored as the selected frame after return to
the command loop, because it still may have the window system's input
focus.

I suspect that this is my problem.  However, it's clear that aquamacs
/is/ able to force focus onto a frame so I was wondering if someone
could explain how this is done.



More information about the Aquamacs-devel mailing list