How to Change the Default Window Size and Position in Emacs

(0 votes, average 0 out of 5)

Depending on your screen resolution, the default size of the Emacs window may be agonizingly small.  Instead of manually adjusting the size each time, you can configure Emacs to open to a different width and height by default.  To do so, add the following to your .emacs file (typically located in your home directory):

;; Set Frame width/height
(defun arrange-frame (w h x y)
  "Set the width, height, and x/y position of the current frame"
  (let ((frame (selected-frame)))
    (delete-other-windows)
    (set-frame-position frame x y)
    (set-frame-size frame w h)))
 
 
(arrange-frame 105 60 5 5)

 

The arrange-frame function call at the end is what you should modify based on personal preference.  The first two numbers represent the window size, the following two represent location.  The configuration above creates a page-sized window in the upper left hand corner.  There will be a slight delay from the time when emacs draws the intial frame to when it resizes the window, but it is mostly negligible.

Partner Links:
Last Updated on Monday, 13 February 2012 13:23  
Related Articles

» How to Setup and Secure a Wireless Network Using a Linksys Router

First thing to do is setup your router. Make sure you hook up the power cable, the modem, and all wired computers to the router. Once this has been done, verify that you can see the wireless network associated with your router. A newly created network will most likely be named 'linksys'.Open a web browser on one of the computers connected to the network. Once the web browser is open, type http://192.168.1.1 into the address bar. This will take you to the routers build-in administrator portal....

» How To Take a Screenshot On Mac OS X

To take a screenshot on an Apple computer running Mac OS X, you simply use the 'Grab' application. You can open the 'Grab' application by searching for its title in the spotlight menu.Once the application is open, select 'Capture' from the menu bar and select the type of screenshot you would like to take.The four different types of screenshots are:Selection - This allows you to take a screenshot of part of the screen defined by you.Window - This allows you to take a screenshot of a single...

» How to Use a Linux (or Mac OS X) Terminal

Every computer hobbyist, at some point, learns to use Linux.  The transition from using a UI based interface in Windows or Mac to performing many functions through the terminal can be a jarring experience for many people.  Many users find the terminal difficult to use and inferior to navigating a UI.  However, the Linux terminal is an extremely powerful device that many learn to love and use often.  Here is a basic introduction to get your feet wet with a terminal.  It...