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

When I disconnect my external cinema display monitor from my Mac laptop (running OS X 10.6), many windows become overly sized, especially Aquamacs (and the terminal window). It creates a frustrating situation where the window is too big for the screen, so that the lower part of the window (where the mini-buffer is) is not visible. This also means that I can find the lower right corner where I can resize the window to make it fit the screen. Restarting Aquamacs does not fix this. Any ideas on how I can resize the windows, or prevent this from happening altogether when I disconnect my screen?


share|improve this question

migrated from Feb 21 '10 at 22:35

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

The following will resize an emacs frame (emacs uses an older terminology that predates modern windowing systems, what would normally be called a "window", emacs calls a "frame").

(set-frame-size (selected-frame) <width in characters> <height in characters>)

Also potentially helpful, the following could move the emacs window so the bottom right corner will be visible, if OSX lets the window be placed in such a way that the title bar is above the top of the screen:

(set-frame-position (selected-frame) x y)

Since you cannot see the minibuffer, and these functions are not interactive, and do not have key shortcuts, you could use the version of emacs that runs in Terminal to add a keyboard shortcut to your .emacs as follows:

(define-key global-map "\C-c\C-c"
  (lambda ()
    (set-frame-size (selected-frame) 80 24)))

If you don't get elisp, this creates a keyboard shortcut globally (working in all buffers) that will resize the current to 80x24 (standard tty size) when you type "Control-c Control-c".

share|improve this answer
Thanks for the code. Now is there a way within emacs to compute the required width/height based on what display monitor is used? – phs Jul 9 '15 at 10:20

Why don't you just press the maximize button on the window's titlebar?

share|improve this answer
yes but it is good to be able to do this from inside emacs. There are many situations where grabbing the mouse, moving it, and pressing a button on a window is not convenient. – phs Jul 9 '15 at 10:18

You must log in to answer this question.

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