28

Background information:

I'm on a Mac, and I've just upgraded to Emacs 23.1 via http://emacsformacosx.com/. There are a few issues, notably the lack of full screen ability.

I've attempted to get around this last issue by installing Megazoomer, which adds a global input manager bound to Cmd-return. This causes the currently forward application to maximise. However, Emacs reports that <s-return> is undefined. I've never seen an s-[key] mentioned before, and Google isn't forthcoming with an answer.

So, two parts:

  1. What does s-[key] mean? This is purely for my satisfaction; and
  2. Can I tell Emacs to ignore this key combination and let the key combination carry through to the system (so that hopefully I can have full screen Emacs back again)?

EDIT: so 1) is resolved, and as to 2) I've got: (global-set-key (kbd "<s-return>") 'ignore), which at least stops the error. However, Emacs still swallows the key combination, which isn't ideal.

Brad Wright
  • 5,602
  • 6
  • 29
  • 30
  • If you're new to Mac, you might want to try Aquamacs. F7 (or m-X aquamacs-toggle-full-frame) toggles full-screen mode. – G__ Aug 30 '09 at 18:12
  • I'm not new to the Mac, I'm new to Emacs. And I've tried Aquamacs and didn't like it. Thanks anyway. – Brad Wright Aug 30 '09 at 18:44
  • So I've got: (global-set-key (kbd "") 'ignore) which means I no longer get an error, but Emacs still swallows the combination. :( – Brad Wright Aug 30 '09 at 18:52
  • You would normally bind a key to `nil` to remove that binding from the keymap in question. – phils Jan 24 '12 at 20:28

4 Answers4

27

It's the Super key, like M- is the Meta key (alt key on a PC keyboard, Command key on your keyboard) and C- is the Control key.

I have of course never actually seen a super key on my keyboard... they are from a long gone era. Wikipedia has an image of this impressive "Space Cadet keyboard" which has all the modifiers you'll ever need:

Community
  • 1
  • 1
Martin Geisler
  • 72,968
  • 25
  • 171
  • 229
  • 1
    I would really love to have one of these nowadays. +1 for the pic. – Jonathan Aug 30 '09 at 18:26
  • 1
    Me too, imagine having a thumbs-up and thumbs-down button on your keyboard! Not to mention the four roman numerals... :-) – Martin Geisler Aug 30 '09 at 18:40
  • Awesome, thanks for that. You wouldn't happen to know how I can tell Emacs to drop that combination though...? – Brad Wright Aug 30 '09 at 18:47
  • I'm sorry, but I don't know the answer to your second part. I can only offer this link which has several recipes: http://www.emacswiki.org/emacs/FullScreen – Martin Geisler Sep 02 '09 at 20:42
  • ... except that it says: "fullscreen functionality has not made it into Emacs-23 as of early 2009" when talking about full screen on Mac OS X :-( – Martin Geisler Sep 02 '09 at 20:43
  • I don't think Emacs is doing anything with that key combination. If it gets to Emacs, it means your window manager doesn't think that key does anything. – jrockway Oct 24 '09 at 20:52
  • To ward off some confusion between the key binding syntax in Emacs: The lower case "s" followed by a dash, `s-`, stands for the Super modifier, while upper-case "s", `S-`, stands for the Shift modifier (http://www.gnu.org/software/emacs/emacs-faq.html#Binding-combinations-of-modifiers-and-function-keys). – bgoodr May 13 '13 at 17:54
  • @BradWright `C-x @ s` applies the super modifier to the next key you press, i.e. `C-x @ s RET` would be equivalent to `s-RET`. But it's probably more convenient to just rebind the command you are interested in. Type `C-x @ C-h` for more info. – tboyce12 Oct 15 '15 at 00:15
8

With plain Emacs 23.1 on a Macbook Pro, I can map the right option key to super by

(setq ns-right-option-modifier 'super)

Your other choice seems to be the function key, which would be ns-function-modifier. However, fn might have other uses, whereas Emacs’ default is to map ns-right-option-modifier to ’left (ie, the same effect as the left option key, which I at any rate need to get the # character!), so the right option key is to some extent redundant.

Left-handers may want to reverse this.

Marcin
  • 48,559
  • 18
  • 128
  • 201
Simon Wright
  • 25,108
  • 2
  • 35
  • 62
2

For the question about what the s-[key] means, on ubuntu box it means the Windows® shaped key. What it means on the OSX systems, I do not know.

As for maximizing windows, could you try this? (It should work, iif OSX runs an X server somewhere underneath it all)

(if (equal (window-system) 'x)
  (progn
   (defun toggle-fullscreen ()
     "Toggles fullscreen"
     (interactive)
     (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
              '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
     (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
              '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))) 

   (global-set-key (kbd "C-c C-y") 'x-clipboard-yank)
   (global-set-key (kbd "M-RET") 'toggle-fullscreen)))

This little snippet is what I use to toggle fullscreen on my *nix computers. And yanking from X's clipboard is a neat ability to have.

As for how to set keybindings, use global-set-key for mode independent keybindings. (Add it to your .emacs file if you want it to be permanent.)

1
(setq ns-command-modifier nil)

That is supposed to do what you want. However, it's having somewhat unpredictable behaviour on machine when I test it, so be warned.

Singletoned
  • 5,089
  • 3
  • 30
  • 32