From: http://www.emacswiki.org/emacs/FullScreen
The following should work in Emacs 23:
(defun toggle-fullscreen (&optional f) (interactive) (let ((current-value (frame-parameter nil 'fullscreen))) (set-frame-parameter nil 'fullscreen (if (equal 'fullboth current-value) (if (boundp 'old-fullscreen) old-fullscreen nil) (progn (setq old-fullscreen current-value) 'fullboth)))))
(global-set-key [f11] 'toggle-fullscreen)
; Make new frames fullscreen by default. Note: this hook doesn't do ; anything to the initial frame if it's in your .emacs, since that file is ; read _after_ the initial frame is created. (add-hook 'after-make-frame-functions 'toggle-fullscreen)