VM

Focus shifting on Aquamacs

Asked by Uday Reddy on 2010-08-20

Alley Stoughton reports (2010-08-19)

I'm trying to get the VM working well with Aquamacs

http://aquamacs.org

on my Mac, and have run into a annoying problem. When I am advancing
through the messages in a VM frame/folder, I find that my focus shifts
to another frame (VM or not) in a semi-random way. The focus shift
doesn't always happen, and it doesn't matter if I advance by typing
"n" or use Motion => Next Message. The same thing happens with "p"/
Previous Message.

The Aquamacs developers don't use VM, but they suggest it's a VM bug. Any thoughts
about what might be causing the problem? I'm running VM 8.1.90a and Aquamacs 2.1,
which is based on GNU Emacs 23.2.50.

Alley

Question information

Language:
English Edit question
Status:
Answered
For:
VM Edit question
Assignee:
No assignee Edit question
Last query:
2010-08-23
Last reply:
2010-08-23

This question was originally filed as bug #621245.

Uday Reddy (reddyuday) said : #1

More info from Alley Stoughton:

It's a problem that occurs with the version of Aquamacs that is based on Emacs 23, which uses the Cocoa library, instead of the earlier Carbon one. In fact, there is also an branch of Aquamacs that uses Emacs 22/Carbon, and the problem that I report *doesn't* happen with it.

It's happening with local folders (I don't use POP/IMAP ones -- I use fetchmail instead).

OK, I downloaded Emacs 23, built it for Mac OS X, installed VM in the site-lisp directory, and the focus problem doesn't occur. So... this seems to show that it's at least partly an Aquamacs problem, and I'll try giving the Aquamacs developers this information. On the other hand, I'm not having the focus shift problem with anything other than VM, so it seems possible that VM is doing something unusual which -- combined with something that Aquamacs does -- triggers the problem.

Bar Shirtcliff (bar-cs) said : #2

        Other people who do use VM on Aquamacs(i.e. myself), using
        the same versions of both as reported here, do not have this
        problem. Therefore it's likely to be some customization which
        one or the other no longer supports, or just possibly, some
        setting that is missing on Alley's side.

Tim Cross (tcross) said : #3

This may or may not be relevant, but there is a thread in the emacs bug tracker relating to issues relating to focus and the mouse for emacs 23 under OSX. Possibly related?
It is bug#6888

I tried stripping out as many Aquamacs and VM customizations as possible, and what I found was
I run into focus problems if-and-only-if I use BBDB (version 2.35, the current release). Note that
sometimes it takes a bit of use before the focus problems start up; sometimes they occur from
the get-go.

My BBDB settings are very simple:

   (require 'bbdb)
   (bbdb-initialize 'vm)
   (setq bbdb/mail-auto-create-p nil)

Uday Reddy (reddyuday) said : #5

> I tried stripping out as many Aquamacs and VM customizations as
> possible, and what I found was I run into focus problems
> if-and-only-if I use BBDB (version 2.35, the current release).

Great, thanks for the info. The recipe is still the same as I
mentioned in the newsgroup: place debug-on-entry on set-buffer and
switch-to-buffer and see if they get any suspicious calls. If they
are under save-excursion or save-current-buffer, then they are safe.
If they are not under one of these primitives, then they are changing
buffer for good.

By "changing focus", did you mean changing buffer or changing frame
(window)? If the latter, what happens if there is no other frame?

Bar Shirtcliff (barshirtcliff) said : #6

If I'm right about having reproduced the bug, it suddenly switches
frame, specifically between VM frames. It doesn't happen if you have
only one VM frame open.

I removed bbdb... I hope Alley can help you debug this one.

Uday Reddy writes:
| > I tried stripping out as many Aquamacs and VM customizations as
| > possible, and what I found was I run into focus problems
| > if-and-only-if I use BBDB (version 2.35, the current release).
|
| Great, thanks for the info. The recipe is still the same as I
| mentioned in the newsgroup: place debug-on-entry on set-buffer and
| switch-to-buffer and see if they get any suspicious calls. If they
| are under save-excursion or save-current-buffer, then they are safe.
| If they are not under one of these primitives, then they are changing
| buffer for good.
|
| By "changing focus", did you mean changing buffer or changing frame
| (window)? If the latter, what happens if there is no other frame?
|
| --
| Focus shifting on Aquamacs
| https://bugs.launchpad.net/bugs/621245
| You received this bug notification because you are subscribed to VM.
|
| Status in VM (View Mail) for Emacs: Incomplete
|
| Bug description:
| Alley Stoughton reports (2010-08-19)
|
| I'm trying to get the VM working well with Aquamacs
|
| http://aquamacs.org
|
| on my Mac, and have run into a annoying problem. When I am advancing
| through the messages in a VM frame/folder, I find that my focus shifts
| to another frame (VM or not) in a semi-random way. The focus shift
| doesn't always happen, and it doesn't matter if I advance by typing
| "n" or use Motion => Next Message. The same thing happens with "p"/
| Previous Message.
|
| The Aquamacs developers don't use VM, but they suggest it's a VM bug. Any thoughts
| about what might be causing the problem? I'm running VM 8.1.90a and Aquamacs 2.1,
| which is based on GNU Emacs 23.2.50.
|
| Alley
|

--

----------------------------------------------------------------------
"All men are born mad. Some remain so."

                                     --Samuel Beckett

Thanks, Bar, for your effort at reproducing the bug!

Uday: it's changing frames, and the problem only occurs when there is more than one frame.

I'll try the debugging you suggest shortly, but I think I understand what's happening now:

BBDB creates a buffer named *BBDB*, containing contact info, and this buffer is included at
the bottom of multiple VM frames. When navigation is done inside a frame/folder, the contents of *BBDB* is
changed, and these changes must be displayed in all the frames in which *BBDB* is included.

Suppose we have two VM frames open, A and B, with *BBDB* included in both frames. When
we move forward or backward in frame A, causing the contents of *BBDB* to be updated,
the changes must be reflected in frame B as well as A. But in Aquamacs 2.1 (Cocoa), the
updating of *BBDB* in frame B causes focus to shift to Frame B. This doesn't happen in
Emacs 23 (Cocoa) or in Aquamacs Class (Carbon), in which frame A retains focus.

Uday: I tried doing the debugging you suggest. When I call debug-on-entry with argument switch-to-buffer, I'm told
"Definition of switch-to-buffer is not a list". Doing debug-on-entry with set-buffer works, but immediately enters
set-buffer. I don't really understand what happens next, probably because I don't understand the debugger at
all well. Given what I wrote above, is there still useful info to be gained by the debugging you suggest? If so,
I can try some more.

Uday Reddy (reddyuday) said : #9

Alley Stoughton writes:

> Uday: it's changing frames, and the problem only occurs when there
> is more than one frame.

Ok, I think we have enough information to narrow down the problem. No
further debugging necessary, at least for now.

It is clear that Aquamacs is taking liberties with the semantics of
switch-to-buffer. Whether it is a bug or an intentional change, I
don't know. I will write to the aquamacs list, giving my
understanding the problem.

Uday

Uday Reddy (reddyuday) said : #10

Given the corrupted buffer that Barbara showed, I think the safest way
to work around the problem is to set bbdb-use-pop-up to nil.

Alley, you might also try setting bbdb-multiple-buffers to
'bbdb-multiple-buffers-default. That will allow each VM folder, I
think, to have its own BBDB buffer.

Uday

Hi Uday,

 > Given the corrupted buffer that Barbara showed, I think the safest way
 > to work around the problem is to set bbdb-use-pop-up to nil.

Perhaps, but that would make using BBDB much less attractive. It's
really nice to see the BBDB buffer at the bottom of a message, reminding
me of what organization someone comes from, or even of their name,
in case they don't include their full name in the from line.

I'm not at all sure why Barbara had such a corrupted frame. That
doesn't happen to me, and it would be good to get to the bottom on
this.

 > Alley, you might also try setting bbdb-multiple-buffers to
 > 'bbdb-multiple-buffers-default. That will allow each VM folder, I
 > think, to have its own BBDB buffer.

This is a good idea, and having a one-to-one correspondence between
frames and BBDB buffers is actually very sensible. That way, the
contact info at the bottom of a message always pertains to that
message.

But when I do this, it works, but I'm getting "No buffer named *BBDB*"
messages each time I navigate or expand someone's name. I'll see if I
can figure out what's going on, but if you have any suggestions,
please let me have them.

Are you still going to write to Aquamacs Developers? David Reitter
believes that switch-to-buffer has different semantics than you do,
it seems.

Looking ahead, it would be great to get VM/BBDB as a package for
Aquamacs. I would think it would be a win-win for VM and Aquamacs.

Alley

Uday Reddy writes:
 > Alley, you might also try setting bbdb-multiple-buffers to
 > 'bbdb-multiple-buffers-default. That will allow each VM folder, I
 > think, to have its own BBDB buffer.

I updated to the development version of BBDB (2.36 devo, from the CVS),
and this now works fine. In my opinion, it's a more sensible setting
than having a single *BBDB* buffer.

Alley

Uday Reddy (reddyuday) said : #13

If you find that VM + BBDB is changing focus while navigating through the folders in Aquamacs, please use the solutions mentioned at the bottom of this session. There is a known incompatibility between BBDB and Aquamacs.

Uday Reddy

Uday Reddy (reddyuday) said : #14

Please see the solutions mentioned at the bottom of the session.

Can you help with this problem?

Provide an answer of your own, or ask Uday Reddy for more information if necessary.

To post a message you must log in.