Depending on exactly what you mean by maximized, you can use either
toggle-frame-fullscreen
or toggle-frame-maximized
to achieve
it through elisp (or M-x ...
). Note, as @lawlist's answer
points out, you may need to adjust frame-resize-pixelwise
.
Here are the relevant docstrings. First, the "fullscreen" version:
(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.
Note that with some window managers you may have to set
frame-resize-pixelwise
to non-nil in order to make a frame
appear truly fullscreen.
See also toggle-frame-maximized
.
And the "maximized" version:
(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.
Note that with some window managers you may have to set
frame-resize-pixelwise
to non-nil in order to make a frame
appear truly maximized.
See also toggle-frame-fullscreen
.
(display-graphic-p)
, i.e., using GUI Emacs frames, or is it with Emacs in console mode? Just how did you try to maximize the frame? A recipe will likely lead to better help.M-x report-emacs-bug
.M-x toggle-frame-maximized
and see if you have any luck. I gave up on having Emacs calculate it exactly (without any help from the user) and have been using my own recipe, in conjunction with implemented feature request 21415, to fill the entire screen: emacs.stackexchange.com/a/20220/2287 I have a custom function to shrink and maximize. If you decide to implement something similar,set-frame-size
has an optional PIXELWISE argument: gnu.org/software/emacs/manual/html_node/elisp/…frame-resize-pixelwise
does what I want without any further programming. Please change the last part of your comment with the documentation into an answer so that I can accept it.