Emacs 24.4 installed on OS X via homebrew: brew install --with-gnutls --cocoa

Dropdown menus work fine with <F10>:

Dropdown menus work fine with <code><F10></code>

But fail when clicked on with the mouse:

enter image description here

I have recompiled as many files as I can, and the problem persists. Some clues, if not an outright solution, would be great. Is something else eating the mouse clicks? Might Helm be interfering?

My base Emacs configuration is prelude, but I am about to remove all my configuration and revert to a vanilla setup to see if I can make the dropdowns work.

  • 2
    Try to replicate the behavior with emacs -Q (which inhibits loading of the init file). If the behavior is still present then you probably ran into a bug and should file a bug report with M-x report-emacs-bug.
    – paprika
    Oct 22 '14 at 13:06
  • Is it really unexpected behavior? On my system (24.3 on linux), with emacs -Q -nw, the menubar does not react to the mouse at all (well, it can select text as any other line of the terminal... but that's not really useful). Or is it some specific feature of the OSX build?
    – T. Verron
    Oct 22 '14 at 13:56
  • @T.Verron: Yes. On MS Windows, from emacs -Q -nw, the mouse (either mouse-1 or mouse-2 works fine with the menus. Sounds like a bug with the OP's build/platform.
    – Drew
    Oct 22 '14 at 15:20
  • @T.Verron - this is a new feature in 24.4: From the NEWS - ** Support for menus on text-mode terminals. If the terminal supports a mouse, clicking on the menu bar, or on sensitive portions of the mode line or header line, will drop down the menu defined at that position. Likewise, clicking C-mouse-1, C-mouse-2, or C-mouse-3 on the text area will pop up the menus defined for those locations.
    – shashin
    Oct 22 '14 at 15:36
  • emacs -Q or emacs -Q -nw results in nothing happening onClick, since the mouse is not enabled by default (so it seems). Simply loading an init.el containing the mouse enabler means that menus open in a new buffer, well, sort of, they don't seem to be the right menus.
    – shashin
    Oct 22 '14 at 15:39

You have two problems in one question.

First, the error message on mouse event in your screenshots is likely to be caused by your configuration, you should try to isolate it by dichotomy (comment out half of your init file, see if the problem still appears, etc.)

Then the fact that emacs -Q does not provide mouse support. That seems to imply that mouse support needs to be enabled somehow. Several functions for this purpose seem to exist (manual):

  • xterm-mouse-mode: enables very basic mouse functionality ("only non-modified single-mouse clicks"); as you noticed, it also uses the old menus with tmm, rather than the new one that appears with <f10>.
  • t-mouse-support, alias for gpm-mouse-support: if your system has gpm running, and if your emacs was compiled with gpm, enable mouse support in the terminal. This is reportedly only for GNU/Linux, it appears to be available for mac if you use X11 (I have no idea how hard to achieve it is).

None of this provides multi-platform, out-of-the-box mouse support. On the other hand, Drew reported that on w32, it works with emacs -Q. Mouse support indeed seems to be handled differently in w32 consoles.

Given that the manual doesn't seem to mention anything more, I will go with a guess: the "if your terminal supports a mouse" in the news corresponds to having one of the mouse modes enabled (either dos mouse, xterm mouse or gpm mouse). Then the news is not about supporting the mouse out of the box, but rather about having it work for the menus as well.

Why not use a graphical frame? :)

  • Thanks for the reply - of ten suggestions in one answer :)
    – shashin
    Oct 23 '14 at 20:25
  • I finally gave up on this last night, but here are my findings: The error message did indeed go away after disabling most of the configuration. I switched around the various mouse modes, and only xterm-mouse-mode is useful in iTerm/Terminal on OS X. You are correct in that. X11 on the Mac is 'XQuartz'. My final discovery was that mouse clicks seem to trigger tmm-menubar, when they should be triggering menu-bar-open. I don't know how to fix this, and even after that, I cannot make emacs recognize a mouse click on a menu item. Boo :(
    – shashin
    Oct 23 '14 at 20:29
  • Oh, and yes, of course, there is always the GUI version, but I have a very particular tmux-based setup in my terminal involving more than just my editor (Yes, I know, emacs can probably do it too) so I am some way off switching to the GUI. I will surely continue to periodically investigate The Mystery Of The Mouse Menu, but there are far better things to be doing right now :D
    – shashin
    Oct 23 '14 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.