I would like to make a very basic macro on my Mac, to have a command that writes a list of slashes in the current file : ////////////////////

The "Basic emacs macros" section of the manual says :

     Start defining a keyboard macro
     If a keyboard macro is being defined, end the definition;
     otherwise, execute the most recent keyboard macro

Unfortunately, on my High Sierra Mac the F3 and F4 keys have a builtin "Mission Control" behaviour, so I cannot define macros this way.

How to fix this ?

  • Welcome to Emacs.SE! You either need to change the Mac keybindings so they will not use F3 or F4 (ie, do this outside of Emacs), or else rebind the commands that F3 and F4 refer to and put them on different keys. You can see what commands those are by typing C-h k followed by the key in question, and then look at the manual page on binding keys for more details on how to change the bindings.
    – Dan
    Sep 24, 2018 at 13:37
  • Also, please edit your post to indicate if you want to a) change the Mac-level keybindings, or b) change the Emacs keybindings. If it's the former, this is not the right venue for how to do it. If the latter, this is the right forum.
    – Dan
    Sep 24, 2018 at 13:38
  • @Dan thank you for your feedback. I don't get your point though about clarifying my post, I thought it was clear enough already : I want to do a certain thing in Emacs [which happens to be on a Mac], and I show my failed attempt. The key-bindings tag has been added. Sep 24, 2018 at 14:11
  • Sorry, my point was that you ask "how do I fix this," but it was unclear if you wanted to fix it by changing the F3/F4 keybindings at the OS level, or rebind the keys within Emacs to something other than F3/F4.
    – Dan
    Sep 24, 2018 at 14:21
  • @Dan As a matter of fact, it can be fixed without doing any rebinding at all, as the accepted answer shows. I have edited the title to reflect this. Sep 24, 2018 at 15:37

2 Answers 2


You can also use C-x ( and C-x ).

  • works fine, thank you. Why didn't the manual tell me about this ? I presume your solution works on any system while the Manual's solution does not work on Macs [or at least, does not work without some substantial extra effort ] Sep 24, 2018 at 14:04
  • Good question. Whenever you view the manual inside Emacs, Emacs does process it to insert the current keybindings in place of the ones in the documentation. However, when there are multiple keybindings for a single command it just shows the first one. Also, in this case there is a slight difference between F3 and C-x (: F3 is bound to the function kmacro-start-macro-or-insert-counter, while C-x ( is bound to kmacro-start-macro. So in this case there was really only one keybinding to show. In general you can check for alternate keybindings by using C-h f.
    – db48x
    Sep 24, 2018 at 14:16
  • 1
    Oh, and in this case the prose of section 17.1 of the manual does call out that C-x ( and C-x ) exist. See the next-to-last paragraph.
    – db48x
    Sep 24, 2018 at 14:19

By default, on Macs, pressing F3 does the Mission Control behavior as you mentioned. But this isn't because the operating system intercepts the F3 key; it's because pressing that button sends some sort of "Activate Mission Control" keycode.

It turns out that you can use your keyboard to send an F3 keypress! Press Fn+F3, and the keyboard will send the F3 keycode, which Emacs (and other programs) can react to.

From Apple's documentation:

By default, pressing one of these keys performs the special feature indicated by the icon printed on the key. For example, pressing the keys with speaker icons adjusts the volume.

If you want to use one of these keys as a standard function key, hold the Fn key (usually in the lower-left corner of the keyboard) while pressing the function key. For example, pressing Fn-F10 (speaker icon) performs the function assigned to the F10 key instead of toggling mute on or off.

If you would rather the keys work as the standard Fn keys, go to the Keyboard settings page, where there's an option "Use F1, F2, etc. keys as standard function keys". Check that off, then pressing F3 sends an F3 keycode; Mission Control is Fn-F3.

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.