I have the following set in my .emacs file:

 (if (window-system)
   (set-frame-height (selected-frame) 60)
   (set-frame-position (selected-frame) 50 30))

It sets the frame height correctly but not the frame position. I am running:

GNU Emacs 23.2.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54)


The code offered below is not Mac-specific. You'll have to edit it (just ake out any of the *win* references. Here's what I used that work. Tweak it to your liking!

(setq initial-frame-alist
      `((background-color . ,(face-background 'default))
        (foreground-color . ,(face-foreground 'default))
        (horizontal-scroll-bars . nil)
        (vertical-scroll-bars . nil)
        (menu-bar-lines . 0)
        (top . 50)      ;; This is overridden by my-center-frame later.
        (left . 400)        ;; This is overridden by my-center-frame later.
        (cursor-color . "red")
        (mouse-color . "green")))
  • What is it doing with your frame position info - is it ignoring it altogether? Dec 11, 2010 at 6:59

2 Answers 2


Futzing with the initial-frame-alist settings, ala:


might work. Specifically, try playing with the top and the left properties.

  • This worked perfect. +50 to you. Dec 12, 2010 at 12:31
  • I get Symbol's value as variable is void: my-win32 Jul 28, 2014 at 18:10

You're using if incorrectly, the code you pasted will only run the first form if the condition is true (see here). Try using the when macro instead:

(when (window-system)
  (set-frame-height (selected-frame) 60)
  (set-frame-position (selected-frame) 50 30))

This will run each form after the condition if the condition is true.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .