help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing Frame Sizes


From: steve-humphreys
Subject: Re: Changing Frame Sizes
Date: Wed, 9 Dec 2020 00:08:16 +0100

What is the difference between set-frame-parameter and set-frame-size?



> Sent: Tuesday, December 08, 2020 at 5:18 PM
> From: steve-humphreys@gmx.com
> To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Changing Frame Sizes
>
> Have the following code to change the frame size.  It works fairly well
> when using numbers. But have got into problems when trying to use 'fullwidth,
> 'fullheight, 'fullboth.
>
> Another problem that I am encountering is this.  When there exist multiple 
> buffers
> in the frame, the window margins are only made on the current buffer.  I 
> would like
> that the margins are applied to all windows in the frame when calling 
> put-margins.
>
> (defun put-margins (&optional width)
>    (interactive)
>    (unless width (setq width 3))
>    (set-window-margins nil width width) )
>
> (defun fullframe-enable ()
>    (interactive)
>    (set-frame-parameter nil 'fullscreen 'fullboth)
>    (tool-bar-mode -1)
>    (menu-bar-mode -1))
>
> (defun fullframe-disable ()
>    (interactive)
>    (set-frame-parameter nil 'fullscreen 'fullheight)
>    (tool-bar-mode t)
>    (menu-bar-mode t))
>
> (defvar frame-size-state 1)
> (defun frame-size-cycle ()
>    (interactive)
>
>    (pcase frame-size-state
>     (1 (message "Full Frame")
>        (if (one-window-p)
>           (put-margins)    ; single window
>           (put-margins 2)) ; multiple windows
>        (fullframe-enable)
>        (setq frame-size-state 2))
>     (2 (message "Frame: Size 90x34")
>        (put-margins 0)
>        (fullframe-disable)
>        (set-frame-size (selected-frame) 'fullboth)
>        (setq frame-size-state 3))
>     (3 (message "Frame: Size 75x34")
>        (set-frame-size (selected-frame) 75 'fullheight)
>        (setq frame-size-state 4))
>     (4 (message "Frame: Size 58x21")
>        (set-frame-size (selected-frame) 58 'fullheight)
>        (setq frame-size-state 1)) ))
>
>
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]