1
$\begingroup$

I like using emacs key bindings to navigate (c-f, c-b, etc.). But unlike every other application I use on my Mac, those commands don't repeat when I hold them down. So I have to press 'f' each time I want to move the cursor forward (while holding down ctrl).

Is there some way of getting Mathematica to understand that holding down c-f means I want to keep moving forward? And so on for other common emacs commands?

I'm running Mathematica 10.4.1.0 on my iMac if that's relevant.

Thanks for any help.

$\endgroup$
1

1 Answer 1

3
$\begingroup$

Yes, this is a frustrating bug in Mathematica's user interface. Since I've found Wolfram is very slow indeed to fix bugs, don't hold your breath on this one.

Here is a workaround if you happen to own Keyboard Maestro, or are willing to shell out the money to get it.

Create a group called "Mathematica Group" or whatever you like. Select "Available in these applications" and choose Mathematica.app.

Create a macro in this group called forward-char. Let forward-char be triggered by "This hot key" and enter ctrl-f. Then, choose (this is important!) "is down".

Then under "Will execute the following actions" enter "Type a Keystroke" from the "Interface Control" category. Under "simulate keystroke" enter Right Arrow. Then from the options drop down, select "Press and Repeat."

What makes this work is that the Mathematica bug only applies when a key and a modifier are held together. When a key like the Right Arrow, without modifier, is pressed, it repeats. What Keyboard Maestro is doing is translating a Ctrl-f into a pressed and repeated Right Arrow.

For other emacs navigation keys, you can do something similar, but you always have to translate to a key without modifier. If need be, redefine such a key to do what you want in Mathematica's KeyEventTranlations.tr file.

Incidentally, one of the primary reasons I got Keyboard Maestro is to standardize the keyboard navigation in all my Mac apps to a uniform, emacs based set of bindings. This works in a quite straight forward way for almost all apps I use (Path Finder, iTerm, Thunderbird, Skim, Firefox, Office, Logic Pro, Omnifocus, etc.) Because of Mathematica's bugs and strange keyboard handling, it was a bit more of a challenge to deal with Mathematica. In general, I recommend Keyboard Maestro if you want to impose emacs keybindings on pretty much any Mac app.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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