* lisp/frame.el (frame-maximization-style): New user option.

(toggle-frame-maximized): Toggle frame maximization according to
`frame-maximization-style', bound to <f11>.
(cycle-frame-maximized): Cycle between all maximization styles and
non-maximized frame, bound to shift-<f11>.
This commit is contained in:
Sam Steingold 2012-12-12 09:43:45 -05:00
parent fd49a2185f
commit 37f38bca1d
3 changed files with 41 additions and 0 deletions

View file

@ -35,6 +35,9 @@ simply disabling Transient Mark mode does the same thing.
* Editing Changes in Emacs 24.4
** New commands `toggle-frame-maximized' and `cycle-frame-maximized',
bound to <f11> and S-<f11>, respectively.
* Changes in Specialized Modes and Packages in Emacs 24.4

View file

@ -1,3 +1,11 @@
2012-12-12 Sam Steingold <sds@gnu.org>
* frame.el (frame-maximization-style): New user option.
(toggle-frame-maximized): Toggle frame maximization according to
`frame-maximization-style', bound to <f11>.
(cycle-frame-maximized): Cycle between all maximization styles and
non-maximized frame, bound to shift-<f11>.
2012-12-12 David Cadé <codename68@gmail.com>
* mpc.el (mpc-format): Use truncate-string-to-width (bug#13143).

View file

@ -1653,6 +1653,34 @@ terminals, cursor blinking is controlled by the terminal."
blink-cursor-delay
'blink-cursor-start))))
;; Frame maximization
(defcustom frame-maximization-style 'maximized
"The maximization style of \\[toggle-frame-maximized]."
:version "24.4"
:type '(choice
(const :tab "Respect window manager screen decorations." maximized)
(const :tab "Ignore window manager screen decorations." fullscreen))
:group 'frames)
(defun toggle-frame-maximized ()
"Maximize/un-maximize Emacs frame according to `frame-maximization-style'.
See also `cycle-frame-maximized'."
(interactive)
(modify-frame-parameters
nil `((fullscreen . ,(if (frame-parameter nil 'fullscreen)
nil frame-maximization-style)))))
(defun cycle-frame-maximized ()
"Cycle Emacs frame between normal, maximized, and fullscreen.
See also `toggle-frame-maximized'."
(interactive)
(modify-frame-parameters
nil `((fullscreen . ,(cl-case (frame-parameter nil 'fullscreen)
((nil) 'maximized)
((maximized) 'fullscreen)
((fullscreen) nil))))))
;;;; Key bindings
@ -1660,6 +1688,8 @@ terminals, cursor blinking is controlled by the terminal."
(define-key ctl-x-5-map "1" 'delete-other-frames)
(define-key ctl-x-5-map "0" 'delete-frame)
(define-key ctl-x-5-map "o" 'other-frame)
(define-key global-map [f11] 'toggle-frame-maximized)
(define-key global-map [(shift f11)] 'cycle-frame-maximized)
;; Misc.