1

When coding I prefer to have my screen split vertically in two with my editor on the right and reference material or browser opened on the left. This saves me from physically switching workspaces or windows more often than I find necessary.

I have therefore configured my emacs frames to take that position on the right when started. I acheive that with this code in my init.el:

; Frame
(use-package frame
  :ensure nil
  :custom
  ;(initial-frame-alist (quote ((fullscreen . maximized))))
  (initial-frame-alist (quote ((top . 0) (left . 748) (width . 84) (height . 30))))
  (default-frame-alist (quote ((top . 0) (left . 748) (width . 84) (height . 30))))
  :config
  (blink-cursor-mode -1)
  (when (member "OperatorMono NF" (font-family-list))
    (set-frame-font "OperatorMono NF-14:weight=regular" t t))
  (defun my/disable-scroll-bars (frame)
    (modify-frame-parameters frame
                             '((vertical-scroll-bars . nil)
                               (horizontal-scroll-bars . nil)
                               (left . 748))))
  (add-hook 'after-make-frame-functions 'my/disable-scroll-bars))

When I start emacs for the first time however, I see two different frames flash briefly on the top left of the screen, each with a different size before finaly respecting the settings in my config.

Is there a way to set the very first frame that shows up to take up the correct postion on the screen instead of starting from the top left of the screen?

1
  • Emacs 27 (not yet released) has a new early-init.el file. I recommend downloading a snapshot and giving it a whirl. I personally let my Emacs 25 (Frankenstein with some Emacs 26/27 stuff) load the main frame in default and then I kick-in my personal stuff that fills the entire screen to exact pixel specification, but without "full-screen" stuff ... I.e., I briefly see the small default frame, and then I take over programmatically with my custom stuff ... However, I must admit, that I haven't played much with Emacs 27 ...
    – lawlist
    Jan 19, 2020 at 8:15

1 Answer 1

1

You will have to set these things in early-init.el as pointed out by @lawlist. I have following snippet in my settings and it starts really smoothly:

(setq default-frame-alist
       '((height . 55)
         (width . 174)
         (left . 613)
         (top . 391)
         (vertical-scroll-bars . nil)
         (horizontal-scroll-bars . nil)
         (tool-bar-lines . 0)))

The parameters names are documented in (elisp) Window Frame Parameters. Yes this is in elisp manual and not in emacs manual.

2
  • default-frame-alist is documented in the Emacs manual, and the relevant node has a reference to the expanded description in the the elisp manual.
    – rpluim
    Dec 2, 2020 at 10:21
  • @rpluim, I was talking about frame parameters. These are documented more thoroughly in elisp manual. Dec 3, 2020 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.