Emacs: set-frame-height does not work when I create a new frame

In my .emacs initialization file, I have a command called (set-frame-height (selected frame) 55)that resizes the frame, so it takes up most of my vertical screen space. I have this command placed at the end of the .emacs file to make sure it works.

I like to make copies of copies in several copies in order to simultaneously work with different sections of the same code fragment. The problem is that when I create a new frame using C-x 5 2, the new frame does not accept the frame size that I want. Instead, it reverts to the default frame size. How to fix it?

thank

+5
source share
2 answers

For new frames, you can configure the parameters in a variable default-frame-alist, for example, as follows:

(add-to-list 'default-frame-alist '(height . 48))

I have the following code in my configuration:

(add-to-list 'default-frame-alist '(font . "Consolas-13"))
(add-to-list 'default-frame-alist '(height . 48))
(add-to-list 'default-frame-alist '(width . 145))
(add-to-list 'default-frame-alist '(background-color . "grey92"))
(setq initial-frame-alist default-frame-alist)
(setq special-display-frame-alist default-frame-alist)

to configure settings for all frames ...

+6
source

Try after-make-frames-functions and things like this:

(add-hook 'after-make-frame-functions
          '(lambda (f)
         (with-selected-frame f
       ;set frame height
)))
+3
source

All Articles