11

how to map mouse-2 (middle button click) to (cmd + click) or (ctrl+click) on OS X using trackpad so as to display a popup menu under flyspell-mode.

George
  • 457
  • 4
  • 14

3 Answers3

14

How about mouse-3 like Stefan suggests?

Add this to your init file:

(eval-after-load "flyspell"
    '(progn
       (define-key flyspell-mouse-map [down-mouse-3] #'flyspell-correct-word)
       (define-key flyspell-mouse-map [mouse-3] #'undefined)))
event_jr
  • 17,467
  • 4
  • 47
  • 62
  • This works for me. But obviously you need to run this lisp snippet at start-up; - after `flyspell` is loaded, it is too late. – halloleo Aug 18 '12 at 14:58
  • This is great! I've been modifying flyspell.el.gz each time and everytime I updated I'd lose it. – Joshua Olson Jun 28 '19 at 18:14
3

Rather flyspell needs to be fixed to pop up its menu on mouse-3 since it's really more like a context menu. I.e. I recommend a M-x report-emacs-bug about it.

Stefan
  • 27,908
  • 4
  • 53
  • 82
1

There's already an option built in for this. Take a look at:

mac-emulate-three-button-mouse

Specifically, you should be able to just add:

(setq mac-emulate-three-button-mouse t)

In your .emacs, and then mouse-2 will be Option+Click and mouse-3 will be Cmd+Click