Reputation: 67
So I have been using emacs a lot lately. And I have been noticing that the window resizes for a second when it starts up. Is there a way to fix that?
Here is the GIF of what I'm talking about.
Upvotes: 3
Views: 2676
Reputation: 985
My Sample Code (Ensure to put these codes at the first line of your init.el file)
(setq frame-inhibit-implied-resize t) ;; prevent resize window on startup
(setq default-frame-alist '((width . 120) (height . 42)))
(defun x/disable-scroll-bars (frame)
(modify-frame-parameters frame '((horizontal-scroll-bars . nil)
(vertical-scroll-bars . nil))))
(if (display-graphic-p)
(progn
(scroll-bar-mode -1)
(tool-bar-mode -1)
(fringe-mode '(8 . 0))
(add-hook 'after-make-frame-functions 'x/disable-scroll-bars))
(progn
(menu-bar-mode -1)
(setq-default
left-margin-width 1
right-margin-width 0)))
The core is (setq frame-inhibit-implied-resize t)
.
Upvotes: 2
Reputation: 3335
I run Emacs from WSL with an X11 server on Windows 10. I could set some -geometry
to make it not resize into a minimal initial window, but that seemed to be flaky and random. This happened with both Xming
and Vcxsrv
. It happened even with -Q
so in my case it was not related to anything in my startup files.
I haven't tried Cygwins X11 server, but when I tried the evaluation version X410
(available in the Windows Store) it did not have the same problem.
Upvotes: 0
Reputation: 5564
I've got this line in my .emacs
to go fullscreen on startup:
(add-to-list 'default-frame-alist '(fullscreen . maximized))
Upvotes: 0
Reputation: 4606
To prevent Emacs from resizing its window after startup, put all geometry and font options on the command line or .Xdefaults
file rather than in .emacs
or other lisp init files.
The initial Emacs frame is drawn before running the lisp startup files, but the X config and command line options have already been read.
As your GIF is mainly showing a width change, with only a minor change in height and no change in the position of the frame, I suspect it is most likely font settings rather than size settings that you need to look for.
Upvotes: 2