Go to the first, previous, next, last section, table of contents.


Frame Size And Position

You can read or change the size and position of a frame using the frame parameters left, top, height, and width. Whatever geometry parameters you don't specify are chosen by the window manager in its usual fashion.

Here are some special features for working with sizes and positions:

Function: set-frame-position frame left top
This function sets the position of the top left corner of frame to left and top. These arguments are measured in pixels, and count from the top left corner of the screen. Negative parameter values count up or rightward from the top left corner of the screen.

Function: frame-height &optional frame
Function: frame-width &optional frame
These functions return the height and width of frame, measured in characters. If you don't supply frame, they use the selected frame.

Function: frame-pixel-height &optional frame
Function: frame-pixel-width &optional frame
These functions return the height and width of frame, measured in pixels. If you don't supply frame, they use the selected frame.

Function: frame-char-height &optional frame
Function: frame-char-width &optional frame
These functions return the height and width of a character in frame, measured in pixels. The values depend on the choice of font. If you don't supply frame, these functions use the selected frame.

Function: set-frame-size frame cols rows
This function sets the size of frame, measured in characters; cols and rows specify the new width and height.

To set the size based on values measured in pixels, use frame-char-height and frame-char-width to convert them to units of characters.

The old-fashioned functions set-screen-height and set-screen-width, which were used to specify the height and width of the screen in Emacs versions that did not support multiple frames, are still usable. They apply to the selected frame. See section Screen Size.

Function: x-parse-geometry geom
The function x-parse-geometry converts a standard X windows geometry string to an alist that you can use as part of the argument to make-frame.

The alist describes which parameters were specified in geom, and gives the values specified for them. Each element looks like (parameter . value). The possible parameter values are left, top, width, and height.

For the size parameters, the value must be an integer. The position parameter names left and top are not totally accurate, because some values indicate the position of the right or bottom edges instead. These are the value possibilities for the position parameters:

an integer
A positive integer relates the left edge or top edge of the window to the left or top edge of the screen. A negative integer relates the right or bottom edge of the window to the right or bottom edge of the screen.
(+ position)
This specifies the position of the left or top edge of the window relative to the left or top edge of the screen. The integer position may be positive or negative; a negative value specifies a position outside the screen.
(- position)
This specifies the position of the right or bottom edge of the window relative to the right or bottom edge of the screen. The integer position may be positive or negative; a negative value specifies a position outside the screen.

Here is an example:

(x-parse-geometry "35x70+0-0")
     => ((width . 35) (height . 70)
         (left . 0) (top - 0))


Go to the first, previous, next, last section, table of contents.