I have set up Emacs daemon on Windows 10. My Emacs version is GNU Emacs 25.3.1

I have some code in my init.el which resizes the frame size automatically when Emacs starts up. The code is

;; Select a desirable font-size, frame position and frame size when Emacs starts up
(defun originalPosition ()
  (set-frame-font "Courier New-14" t t)
  (set-frame-position (selected-frame) 100 50)
  (when window-system (set-frame-size (selected-frame) 82 28))

This code used to work perfectly when I launched Emacs normally (not as daemon). However, emacsclient does not accept these settings.

Searching around for a solution, I realised that I need to use after-make-frame-functions . So I added an extra line to my init.el

(add-hook 'after-make-frame-functions (lambda (frame)(when (display-graphic-p frame)(originalPosition))))

After adding this line, every instance of emacsclient has different frame sizes (but uses the correct font size).

How can I get emacsclient to use the correct frame size for every instance?

1 Answer 1


I used default-frame-alist and it sets the correct frame size

(add-to-list 'default-frame-alist '(height . 28)) ;; Vertical frame size
(add-to-list 'default-frame-alist '(width . 82)) ;; Horizontal frame size

It works when Emacs is launched normally and also when Emacs is run as daemon.

Your Answer

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

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