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

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

Re: maximising window?


From: James Freer
Subject: Re: maximising window?
Date: Sun, 8 Jun 2014 18:00:01 +0100 (BST)
User-agent: Alpine 2.10 (DEB 1266 2009-07-14)

On Sun, 8 Jun 2014, Michael Heerdegen wrote:

James Freer <address@hidden> writes:

One thing I want to enter in the .emacs is the equivalent of
alt+f10. Maximise 'window' isn't quite the same from what I've read
this evening... in emacs they're frames. Vary depending on Mac, linux
or windows - I'm using Linux Xubuntu on a CRT monitor.

If you want to do it for all new frames, `default-frame-alist' is the
right place:

   (add-to-list 'default-frame-alist '(fullscreen . maximized))

See (info "(elisp) Frame Parameters") for details.

Interactively: `toggle-frame-maximized', `toggle-frame-fullscreen', as
it had been suggested.  For older Emacsen, you can simply write your own
commands using `modify-frame-parameters'.  These definitions from
frame.el should work in Emacs 23, too:

--8<---------------cut here---------------start------------->8---
(defun toggle-frame-maximized ()
 "Toggle maximization state of the selected frame.
Maximize the selected frame or un-maximize if it is already maximized.
Respect window manager screen decorations.
If the frame is in fullscreen mode, don't change its mode,
just toggle the temporary frame parameter `maximized',
so the frame will go to the right maximization state
after disabling fullscreen mode.
See also `toggle-frame-fullscreen'."
 (interactive)
 (if (memq (frame-parameter nil 'fullscreen) '(fullscreen fullboth))
     (modify-frame-parameters
      nil
      `((maximized
          . ,(unless (eq (frame-parameter nil 'maximized) 'maximized)
               'maximized))))
   (modify-frame-parameters
    nil
    `((fullscreen
        . ,(unless (eq (frame-parameter nil 'fullscreen) 'maximized)
             'maximized))))))

(defun toggle-frame-fullscreen ()
 "Toggle fullscreen mode of the selected frame.
Enable fullscreen mode of the selected frame or disable if it is
already fullscreen.  Ignore window manager screen decorations.
When turning on fullscreen mode, remember the previous value of the
maximization state in the temporary frame parameter `maximized'.
Restore the maximization state when turning off fullscreen mode.
See also `toggle-frame-maximized'."
 (interactive)
 (modify-frame-parameters
  nil
  `((maximized
     . ,(unless (memq (frame-parameter nil 'fullscreen) '(fullscreen fullboth))
           (frame-parameter nil 'fullscreen)))
    (fullscreen
     . ,(if (memq (frame-parameter nil 'fullscreen) '(fullscreen fullboth))
             (if (eq (frame-parameter nil 'maximized) 'maximized)
                 'maximized)
           'fullscreen)))))
--8<---------------cut here---------------end--------------->8---


Michael.

Thanks for putting me on the right track.
Just tried 'default-frame-alist' and that's fine.
I'll save the email and look into the later stuff another time.
A lot to learn with emacs and I'm taking it one step at a time.

james



reply via email to

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