What does “s-[keyname]” refer to in Emacs, and how do I tell Emacs to ignore it?

前端 未结 4 1174
一生所求
一生所求 2021-02-05 04:11

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 abil

相关标签:
4条回答
  • 2021-02-05 04:54

    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.

    0 讨论(0)
  • 2021-02-05 04:55
    (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.

    0 讨论(0)
  • 2021-02-05 04:57

    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.)

    0 讨论(0)
  • 2021-02-05 04:58

    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:

    0 讨论(0)
提交回复
热议问题