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

前端 未结 4 1176
一生所求
一生所求 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: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.)

提交回复
热议问题