Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to associate the following function (which toggles on and off full-screen on the active buffer):

(defun toggle-maximize-buffer () "Maximize buffer"
  (if (= 1 (length (window-list)))
    (jump-to-register '_)
      (set-register '_ (list (current-window-configuration)))

with the keyboard shortcut Alt+Sfhit+o.

When I look up the Emacs code for this shortcut with M-x describe-key, I get ESC O- in the minibuffer, but when I add the following line on my .emacs config file it doesn't work

(global-set-key (kbd "<ESC O>") 'toggle-maximize-buffer) 
share|improve this question
See stackoverflow.com/q/4016914/1030675 – choroba Sep 6 '12 at 15:43
up vote 2 down vote accepted

You got the syntax of the kbd macro wrong. <ESC O> would be for a key called ESC O (with a space; Emacs key names don't contain spaces). For the two-key sequence ESC then O, use ESC O or equivalently M-O.

(global-set-key (kbd "ESC O") 'toggle-maximize-buffer)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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