unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Changing Frame Sizes
@ 2020-12-08 16:18 steve-humphreys
  2020-12-08 23:08 ` steve-humphreys
  0 siblings, 1 reply; 3+ messages in thread
From: steve-humphreys @ 2020-12-08 16:18 UTC (permalink / raw)
  To: Help Gnu Emacs

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)) ))





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Changing Frame Sizes
  2020-12-08 16:18 Changing Frame Sizes steve-humphreys
@ 2020-12-08 23:08 ` steve-humphreys
  2020-12-08 23:31   ` steve-humphreys
  0 siblings, 1 reply; 3+ messages in thread
From: steve-humphreys @ 2020-12-08 23:08 UTC (permalink / raw)
  To: steve-humphreys; +Cc: Help Gnu Emacs


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)) ))
>
>
>
>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Changing Frame Sizes
  2020-12-08 23:08 ` steve-humphreys
@ 2020-12-08 23:31   ` steve-humphreys
  0 siblings, 0 replies; 3+ messages in thread
From: steve-humphreys @ 2020-12-08 23:31 UTC (permalink / raw)
  To: steve-humphreys; +Cc: Help Gnu Emacs

I would like the margins to be applied to all windows rather that
the current one.

(set-window-margins nil width width)

> Sent: Wednesday, December 09, 2020 at 12:08 AM
> From: steve-humphreys@gmx.com
> To: steve-humphreys@gmx.com
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Changing Frame Sizes
>
>
> 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)) ))
> >
> >
> >
> >
>
>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-08 23:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-08 16:18 Changing Frame Sizes steve-humphreys
2020-12-08 23:08 ` steve-humphreys
2020-12-08 23:31   ` steve-humphreys

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).