Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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")))
share|improve this question
What is it doing with your frame position info - is it ignoring it altogether? – blueberryfields Dec 11 '10 at 6:59
up vote 2 down vote accepted

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

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

share|improve this answer
This worked perfect. +50 to you. – Avery Chan Dec 12 '10 at 12:31
I get Symbol's value as variable is void: my-win32 – incandescentman Jul 28 '14 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.

share|improve this answer

You must log in to answer this question.

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